mirror of https://github.com/qt/qtbase.git
Compare commits
6 Commits
bff3127750
...
7c02c04e93
Author | SHA1 | Date |
---|---|---|
|
7c02c04e93 | |
|
33855af7f7 | |
|
5aecefc6a1 | |
|
dbcc76b132 | |
|
e6f8cc8598 | |
|
a22cbf33a0 |
|
@ -26,9 +26,11 @@ QT_BEGIN_NAMESPACE
|
|||
class QWindow;
|
||||
#if QT_CONFIG(opengl)
|
||||
class QOpenGLContext;
|
||||
#endif
|
||||
class QPlatformOpenGLContext;
|
||||
#endif
|
||||
class QPlatformOffscreenSurface;
|
||||
class QSurfaceFormat;
|
||||
class QOffscreenSurface;
|
||||
|
||||
namespace QtWaylandClient {
|
||||
|
||||
|
@ -52,6 +54,7 @@ public:
|
|||
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0;
|
||||
#if QT_CONFIG(opengl)
|
||||
virtual QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay contextDisplay, QOpenGLContext *shareContext) const = 0;
|
||||
virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const { Q_UNUSED(surface); return nullptr; }
|
||||
#endif
|
||||
|
||||
enum NativeResource {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <QtCore/QDebug>
|
||||
#include <private/qeglconvenience_p.h>
|
||||
#include <private/qeglpbuffer_p.h>
|
||||
|
||||
#ifndef EGL_EXT_platform_base
|
||||
typedef EGLDisplay (*PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
|
@ -134,6 +135,11 @@ QOpenGLContext *QWaylandEglClientBufferIntegration::createOpenGLContext(EGLConte
|
|||
return QEGLPlatformContext::createFrom<QWaylandGLContext>(context, contextDisplay, m_eglDisplay, shareContext);
|
||||
}
|
||||
|
||||
QPlatformOffscreenSurface *QWaylandEglClientBufferIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
|
||||
{
|
||||
return new QEGLPbuffer(m_eglDisplay, surface->requestedFormat(), surface);
|
||||
}
|
||||
|
||||
void *QWaylandEglClientBufferIntegration::nativeResource(NativeResource resource)
|
||||
{
|
||||
switch (resource) {
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
|
||||
QWaylandWindow *createEglWindow(QWindow *window) override;
|
||||
QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
|
||||
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
|
||||
QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay contextDisplay, QOpenGLContext *shareContext) const override;
|
||||
|
||||
void *nativeResource(NativeResource resource) override;
|
||||
|
|
|
@ -157,6 +157,13 @@ QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGL
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
QPlatformOffscreenSurface *QWaylandIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
|
||||
{
|
||||
if (mDisplay->clientBufferIntegration())
|
||||
return mDisplay->clientBufferIntegration()->createPlatformOffscreenSurface(surface);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QOpenGLContext *QWaylandIntegration::createOpenGLContext(EGLContext context, EGLDisplay contextDisplay, QOpenGLContext *shareContext) const
|
||||
{
|
||||
return mClientBufferIntegration->createOpenGLContext(context, contextDisplay, shareContext);
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
QPlatformWindow *createPlatformWindow(QWindow *window) const override;
|
||||
#if QT_CONFIG(opengl)
|
||||
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
|
||||
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
|
||||
QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override;
|
||||
#endif
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include <QtCore/qoperatingsystemversion.h>
|
||||
|
||||
#include <dwmapi.h>
|
||||
#include <gdiplus.h>
|
||||
|
||||
#if QT_CONFIG(vulkan)
|
||||
#include "qwindowsvulkaninstance.h"
|
||||
|
|
|
@ -508,7 +508,7 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
|
|||
drawRoundedRect(painter, frameRect, Qt::NoPen, option->palette.brush(QPalette::Base));
|
||||
|
||||
if (combobox->frame)
|
||||
drawLineEditFrame(painter, frameRect, option);
|
||||
drawLineEditFrame(painter, frameRect, combobox, combobox->editable);
|
||||
|
||||
const bool isMouseOver = state & State_MouseOver;
|
||||
const bool hasFocus = state & State_HasFocus;
|
||||
|
|
|
@ -255,7 +255,8 @@ public:
|
|||
|
||||
void setup(const QWizardLayoutInfo &info, const QString &title,
|
||||
const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
|
||||
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat);
|
||||
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat,
|
||||
QWizard::BannerSizePolicy bannerSizePolicy);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
@ -269,6 +270,7 @@ private:
|
|||
QLabel *logoLabel;
|
||||
QGridLayout *layout;
|
||||
QPixmap bannerPixmap;
|
||||
QWizard::BannerSizePolicy wizardBannerSizePolicy;
|
||||
};
|
||||
|
||||
QWizardHeader::QWizardHeader(QWidget *parent)
|
||||
|
@ -323,7 +325,8 @@ bool QWizardHeader::vistaDisabled() const
|
|||
|
||||
void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
|
||||
const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
|
||||
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat)
|
||||
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat,
|
||||
QWizard::BannerSizePolicy bannerSizePolicy)
|
||||
{
|
||||
bool modern = ((info.wizStyle == QWizard::ModernStyle)
|
||||
#if QT_CONFIG(style_windowsvista)
|
||||
|
@ -331,6 +334,8 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
|
|||
#endif
|
||||
);
|
||||
|
||||
wizardBannerSizePolicy = bannerSizePolicy;
|
||||
|
||||
layout->setRowMinimumHeight(0, modern ? ModernHeaderTopMargin : 0);
|
||||
layout->setRowMinimumHeight(1, modern ? info.topLevelMarginTop - ModernHeaderTopMargin - 1 : 0);
|
||||
layout->setRowMinimumHeight(6, (modern ? 3 : GapBetweenLogoAndRightEdge) + 2);
|
||||
|
@ -356,7 +361,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
|
|||
bannerPixmap = QPixmap();
|
||||
}
|
||||
|
||||
if (bannerPixmap.isNull()) {
|
||||
if (bannerPixmap.isNull() || wizardBannerSizePolicy != QWizard::BannerSizePolicy::NoStretch) {
|
||||
/*
|
||||
There is no widthForHeight() function, so we simulate it with a loop.
|
||||
*/
|
||||
|
@ -384,7 +389,15 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
|
|||
void QWizardHeader::paintEvent(QPaintEvent * /* event */)
|
||||
{
|
||||
QStylePainter painter(this);
|
||||
painter.drawPixmap(0, 0, bannerPixmap);
|
||||
switch (wizardBannerSizePolicy) {
|
||||
case QWizard::BannerSizePolicy::Stretch:
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
painter.drawPixmap(0, 0, width(), height(), bannerPixmap);
|
||||
break;
|
||||
case QWizard::BannerSizePolicy::NoStretch:
|
||||
painter.drawPixmap(0, 0, bannerPixmap);
|
||||
break;
|
||||
}
|
||||
|
||||
int x = width() - 2;
|
||||
int y = height() - 2;
|
||||
|
@ -566,6 +579,7 @@ public:
|
|||
QList<QWizard::WizardButton> buttonsCustomLayout;
|
||||
Qt::TextFormat titleFmt = Qt::AutoText;
|
||||
Qt::TextFormat subTitleFmt = Qt::AutoText;
|
||||
QWizard::BannerSizePolicy bannerSizePolicy = QWizard::BannerSizePolicy::NoStretch;
|
||||
mutable QPixmap defaultPixmaps[QWizard::NPixmaps];
|
||||
|
||||
union {
|
||||
|
@ -1221,7 +1235,7 @@ void QWizardPrivate::updateLayout()
|
|||
Q_ASSERT(page);
|
||||
headerWidget->setup(info, page->title(), page->subTitle(),
|
||||
page->pixmap(QWizard::LogoPixmap), page->pixmap(QWizard::BannerPixmap),
|
||||
titleFmt, subTitleFmt);
|
||||
titleFmt, subTitleFmt, bannerSizePolicy);
|
||||
}
|
||||
|
||||
if (info.watermark || info.sideWidget) {
|
||||
|
@ -2079,6 +2093,15 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
|
|||
\sa setWizardStyle(), WizardOption, {Wizard Look and Feel}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QWizard::BannerSizePolicy
|
||||
|
||||
This enum specifies the banner size policy when there is a banner.
|
||||
|
||||
\value NoStretch Do not stretch the banner (default)
|
||||
\value Stretch Stretch the banner
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QWizard::WizardOption
|
||||
|
||||
|
@ -2773,6 +2796,28 @@ Qt::TextFormat QWizard::subTitleFormat() const
|
|||
return d->subTitleFmt;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QWizard::bannerSizePolicy
|
||||
\brief the banner size policy
|
||||
|
||||
The default policy is \l{QWizard::}{NoStretch}
|
||||
*/
|
||||
void QWizard::setBannerSizePolicy(QWizard::BannerSizePolicy bannerSizePolicy)
|
||||
{
|
||||
Q_D(QWizard);
|
||||
if (d->bannerSizePolicy == bannerSizePolicy)
|
||||
return;
|
||||
|
||||
d->bannerSizePolicy = bannerSizePolicy;
|
||||
d->updateLayout();
|
||||
}
|
||||
|
||||
QWizard::BannerSizePolicy QWizard::bannerSizePolicy() const
|
||||
{
|
||||
Q_D(const QWizard);
|
||||
return d->bannerSizePolicy;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the pixmap for role \a which to \a pixmap.
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class Q_WIDGETS_EXPORT QWizard : public QDialog
|
|||
Q_PROPERTY(Qt::TextFormat subTitleFormat READ subTitleFormat WRITE setSubTitleFormat)
|
||||
Q_PROPERTY(int startId READ startId WRITE setStartId)
|
||||
Q_PROPERTY(int currentId READ currentId WRITE setCurrentId NOTIFY currentIdChanged)
|
||||
Q_PROPERTY(BannerSizePolicy bannerSizePolicy READ bannerSizePolicy WRITE setBannerSizePolicy REVISION(6, 11))
|
||||
|
||||
public:
|
||||
enum WizardButton {
|
||||
|
@ -61,6 +62,12 @@ public:
|
|||
};
|
||||
Q_ENUM(WizardStyle)
|
||||
|
||||
enum class BannerSizePolicy {
|
||||
NoStretch,
|
||||
Stretch,
|
||||
};
|
||||
Q_ENUM(BannerSizePolicy)
|
||||
|
||||
enum WizardOption {
|
||||
IndependentPages = 0x00000001,
|
||||
IgnoreSubTitles = 0x00000002,
|
||||
|
@ -124,6 +131,8 @@ public:
|
|||
Qt::TextFormat titleFormat() const;
|
||||
void setSubTitleFormat(Qt::TextFormat format);
|
||||
Qt::TextFormat subTitleFormat() const;
|
||||
void setBannerSizePolicy(BannerSizePolicy bannerSizePolicy);
|
||||
QWizard::BannerSizePolicy bannerSizePolicy() const;
|
||||
void setPixmap(WizardPixmap which, const QPixmap &pixmap);
|
||||
QPixmap pixmap(WizardPixmap which) const;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
// Qt-Security score:significant reason:default
|
||||
|
||||
#include "qplatformdefs.h"
|
||||
#include "qabstracteventdispatcher.h"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
// Qt-Security score:significant reason:default
|
||||
|
||||
#ifndef QAPPLICATION_H
|
||||
#define QAPPLICATION_H
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
// Qt-Security score:significant reason:default
|
||||
|
||||
#ifndef QAPPLICATION_P_H
|
||||
#define QAPPLICATION_P_H
|
||||
|
|
|
@ -83,9 +83,9 @@ private slots:
|
|||
|
||||
void columnWidthWithImage_data();
|
||||
void columnWidthWithImage();
|
||||
#endif
|
||||
|
||||
void QTBUG138678_insertColumnAtStartWithRowspan();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QTextTable *create2x2Table();
|
||||
|
@ -1413,7 +1413,6 @@ void tst_QTextTable::columnWidthWithImage()
|
|||
QVERIFY(rightRect.left() > leftRect.right());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QTextTable::QTBUG138678_insertColumnAtStartWithRowspan()
|
||||
{
|
||||
|
@ -1457,6 +1456,7 @@ void tst_QTextTable::QTBUG138678_insertColumnAtStartWithRowspan()
|
|||
// Don't assert
|
||||
currentTable->insertColumns(0, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
QTEST_MAIN(tst_QTextTable)
|
||||
|
|
|
@ -389,6 +389,7 @@ void tst_QWizard::setPixmap()
|
|||
QPixmap p3(3, 3);
|
||||
QPixmap p4(4, 4);
|
||||
QPixmap p5(5, 5);
|
||||
QPixmap p6(1024, 40);
|
||||
|
||||
QWizard wizard;
|
||||
QWizardPage *page = new QWizardPage;
|
||||
|
@ -434,6 +435,28 @@ void tst_QWizard::setPixmap()
|
|||
QCOMPARE(page2->pixmap(QWizard::LogoPixmap).size(), p2.size());
|
||||
QCOMPARE(page2->pixmap(QWizard::WatermarkPixmap).size(), p3.size());
|
||||
QCOMPARE(page2->pixmap(QWizard::BackgroundPixmap).size(), p4.size());
|
||||
|
||||
wizard.setWizardStyle(QWizard::ModernStyle);
|
||||
// Without subtitle QWizard considers there is no header...
|
||||
page2->setSubTitle("SubTitle");
|
||||
page2->setPixmap(QWizard::BannerPixmap, p6);
|
||||
wizard.restart();
|
||||
wizard.next();
|
||||
wizard.show();
|
||||
QCOMPARE(wizard.currentPage(), page2);
|
||||
QCOMPARE(page2->pixmap(QWizard::BannerPixmap).size(), p6.size());
|
||||
int oldWidth = wizard.width();
|
||||
int newWidth = 1240;
|
||||
wizard.resize(newWidth, 720);
|
||||
QCOMPARE(wizard.width(), oldWidth);
|
||||
wizard.setBannerSizePolicy(QWizard::BannerSizePolicy::Stretch);
|
||||
wizard.resize(newWidth, 720);
|
||||
QCOMPARE(wizard.width(), newWidth);
|
||||
wizard.setBannerSizePolicy(QWizard::BannerSizePolicy::NoStretch);
|
||||
QCOMPARE(wizard.width(), oldWidth);
|
||||
wizard.setBannerSizePolicy(QWizard::BannerSizePolicy::Stretch);
|
||||
wizard.resize(newWidth, 720);
|
||||
QCOMPARE(wizard.width(), newWidth);
|
||||
}
|
||||
|
||||
class MyPage1 : public QWizardPage
|
||||
|
|
Loading…
Reference in New Issue