Compare commits

...

6 Commits

Author SHA1 Message Date
Christian Ehrlicher 7c02c04e93 Windows11Style: don't draw non-editable QComboBox as drawable
Only draw the blue underline when the QComboBox is actually editable.
This amends b335784c25.

Pick-to: 6.10
Task-number: QTBUG-137403
Change-Id: I3dbad7917a00c9be63c145163b71678d092870b5
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
2025-09-23 22:44:05 +02:00
MohammadHossein Qanbari 33855af7f7 CRA review: src/widgets/kernel/qapplication.*
The qapplication.* files' security scores are tagged as significant
since the command-line arguments and environment variables are
considered trusted input. It does not expose to high-risk
vulnerabilities and the data is available for validation before
reaching QApplication.

QUIP: 23
Fixes: QTBUG-140349
Task-number: QTBUG-135741
Pick-to: 6.10 6.8
Change-Id: Iadb7b4b8f516f89b70999b9ae8993d75084a5adb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-09-23 20:22:49 +00:00
Robert Löhning 5aecefc6a1 Fix test compilation with QT_NO_WIDGETS
Amends 68a5ec23f6 where the
test function was added outside the right #ifdef-block.

Pick-to: 6.5 6.8 6.9 6.10
Task-number: QTBUG-138678
Change-Id: If96132d724b3373d728c8b440f3d5c2473d44610
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2025-09-23 18:30:01 +00:00
Kai Uwe Broulik dbcc76b132 wayland: Implement createPlatformOffscreenSurface
Using QEGLPbuffer.

Change-Id: I44c10c6caf2364cfa2cf99650383f8e90e476f12
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2025-09-23 18:37:48 +01:00
Wladimir Leuschner e6f8cc8598 WindowsQPA: Remove unused GDIPlus include from qwindowswindow.cpp
GDIPlus is not used anymore to draw the custom titlebar, therefore the
gdiplus include can be removed.

Fixes: QTBUG-139653
Pick-to: 6.10 6.9
Change-Id: Id80b9d58bd6729dad8a4a428333e41d41aec5cd0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2025-09-23 15:59:47 +00:00
Xavier BESSON a22cbf33a0 Allow stretching QWizard banner on ModernStyle
Currently with ModernStyle, if a banner is set on page, then when
reaching this page, the QWizard gets a fixed size because of
layouting.

This change would allow stretching the banner preventing the
QWizard fixed resizing.

Task-number: QTIFW-3852
Change-Id: If96285b7c3969b1377da69749fb7b8a0fac554b3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-09-23 17:59:47 +02:00
14 changed files with 107 additions and 10 deletions

View File

@ -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 {

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -44,7 +44,6 @@
#include <QtCore/qoperatingsystemversion.h>
#include <dwmapi.h>
#include <gdiplus.h>
#if QT_CONFIG(vulkan)
#include "qwindowsvulkaninstance.h"

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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