summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-09-30 12:57:57 +0200
committerLiang Qi <liang.qi@qt.io>2019-09-30 14:43:02 +0200
commit99cdd5fc67386fb3361299b9ec493e081043097d (patch)
tree2c1d41d3d71f671f104e93b87bf11bdd169ba746 /src/widgets
parent86876744f07cbaa01daca6869b896741878c39a3 (diff)
parent46201f0e82a7b1629adad196dfa8f7ff1cf4dffd (diff)
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts: src/corelib/global/qrandom.cpp src/corelib/io/qfileinfo.cpp src/corelib/kernel/qeventdispatcher_win.cpp src/corelib/kernel/qeventdispatcher_win_p.h src/gui/text/qfontdatabase.cpp src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm src/plugins/platforms/windows/qwindowsglcontext.cpp src/testlib/qtestcase.cpp Done-With: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Done-With: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4893212471aa24be804c989a581810e2f714545c
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qwizard.cpp180
-rw-r--r--src/widgets/kernel/qwidget.cpp2
2 files changed, 76 insertions, 106 deletions
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 5752e218c2..0295241a74 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -55,10 +55,14 @@
#if QT_CONFIG(lineedit)
#include "qlineedit.h"
#endif
+#include <qpointer.h>
#include "qpainter.h"
#include "qwindow.h"
#include "qpushbutton.h"
#include "qset.h"
+#if QT_CONFIG(shortcut)
+# include "qshortcut.h"
+#endif
#include "qstyle.h"
#include "qvarlengtharray.h"
#if defined(Q_OS_MACX)
@@ -232,31 +236,24 @@ void QWizardField::findProperty(const QWizardDefaultProperty *properties, int pr
class QWizardLayoutInfo
{
public:
- inline QWizardLayoutInfo()
- : topLevelMarginLeft(-1), topLevelMarginRight(-1), topLevelMarginTop(-1),
- topLevelMarginBottom(-1), childMarginLeft(-1), childMarginRight(-1),
- childMarginTop(-1), childMarginBottom(-1), hspacing(-1), vspacing(-1),
- wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false),
- subTitle(false), extension(false), sideWidget(false) {}
-
- int topLevelMarginLeft;
- int topLevelMarginRight;
- int topLevelMarginTop;
- int topLevelMarginBottom;
- int childMarginLeft;
- int childMarginRight;
- int childMarginTop;
- int childMarginBottom;
- int hspacing;
- int vspacing;
- int buttonSpacing;
- QWizard::WizardStyle wizStyle;
- bool header;
- bool watermark;
- bool title;
- bool subTitle;
- bool extension;
- bool sideWidget;
+ int topLevelMarginLeft = -1;
+ int topLevelMarginRight = -1;
+ int topLevelMarginTop = -1;
+ int topLevelMarginBottom = -1;
+ int childMarginLeft = -1;
+ int childMarginRight = -1;
+ int childMarginTop = -1;
+ int childMarginBottom = -1;
+ int hspacing = -1;
+ int vspacing = -1;
+ int buttonSpacing = -1;
+ QWizard::WizardStyle wizStyle = QWizard::ClassicStyle;
+ bool header = false;
+ bool watermark = false;
+ bool title = false;
+ bool subTitle = false;
+ bool extension = false;
+ bool sideWidget = false;
bool operator==(const QWizardLayoutInfo &other);
inline bool operator!=(const QWizardLayoutInfo &other) { return !operator==(other); }
@@ -486,21 +483,18 @@ class QWizardPagePrivate : public QWidgetPrivate
public:
enum TriState { Tri_Unknown = -1, Tri_False, Tri_True };
- inline QWizardPagePrivate()
- : wizard(0), completeState(Tri_Unknown), explicitlyFinal(false), commit(false) {}
-
bool cachedIsComplete() const;
void _q_maybeEmitCompleteChanged();
void _q_updateCachedCompleteState();
- QWizard *wizard;
+ QWizard *wizard = nullptr;
QString title;
QString subTitle;
QPixmap pixmaps[QWizard::NPixmaps];
QVector<QWizardField> pendingFields;
- mutable TriState completeState;
- bool explicitlyFinal;
- bool commit;
+ mutable TriState completeState = Tri_Unknown;
+ bool explicitlyFinal = false;
+ bool commit = false;
bool initialized = false;
QMap<int, QString> buttonCustomTexts;
};
@@ -556,42 +550,6 @@ public:
Forward
};
- inline QWizardPrivate()
- : start(-1)
- , startSetByUser(false)
- , current(-1)
- , canContinue(false)
- , canFinish(false)
- , disableUpdatesCount(0)
- , wizStyle(QWizard::ClassicStyle)
- , opts(0)
- , buttonsHaveCustomLayout(false)
- , titleFmt(Qt::AutoText)
- , subTitleFmt(Qt::AutoText)
- , placeholderWidget1(0)
- , placeholderWidget2(0)
- , headerWidget(0)
- , watermarkLabel(0)
- , sideWidget(0)
- , pageFrame(0)
- , titleLabel(0)
- , subTitleLabel(0)
- , bottomRuler(0)
-#if QT_CONFIG(style_windowsvista)
- , vistaHelper(0)
- , vistaInitPending(true)
- , vistaState(QVistaHelper::Dirty)
- , vistaStateChanged(false)
- , inHandleAeroStyleChange(false)
-#endif
- , minimumWidth(0)
- , minimumHeight(0)
- , maximumWidth(QWIDGETSIZE_MAX)
- , maximumHeight(QWIDGETSIZE_MAX)
- {
- std::fill(btns, btns + QWizard::NButtons, static_cast<QAbstractButton *>(0));
- }
-
void init();
void reset();
void cleanupPagesNotInHistory();
@@ -631,21 +589,21 @@ public:
QMap<QString, int> fieldIndexMap;
QVector<QWizardDefaultProperty> defaultPropertyTable;
QList<int> history;
- int start;
- bool startSetByUser;
- int current;
- bool canContinue;
- bool canFinish;
+ int start = -1;
+ bool startSetByUser = false;
+ int current = -1;
+ bool canContinue = false;
+ bool canFinish = false;
QWizardLayoutInfo layoutInfo;
- int disableUpdatesCount;
+ int disableUpdatesCount = 0;
- QWizard::WizardStyle wizStyle;
+ QWizard::WizardStyle wizStyle = QWizard::ClassicStyle;
QWizard::WizardOptions opts;
QMap<int, QString> buttonCustomTexts;
- bool buttonsHaveCustomLayout;
+ bool buttonsHaveCustomLayout = false;
QList<QWizard::WizardButton> buttonsCustomLayout;
- Qt::TextFormat titleFmt;
- Qt::TextFormat subTitleFmt;
+ Qt::TextFormat titleFmt = Qt::AutoText;
+ Qt::TextFormat subTitleFmt = Qt::AutoText;
mutable QPixmap defaultPixmaps[QWizard::NPixmaps];
union {
@@ -660,32 +618,35 @@ public:
} btn;
mutable QAbstractButton *btns[QWizard::NButtons];
};
- QWizardAntiFlickerWidget *antiFlickerWidget;
- QWidget *placeholderWidget1;
- QWidget *placeholderWidget2;
- QWizardHeader *headerWidget;
- QWatermarkLabel *watermarkLabel;
- QWidget *sideWidget;
- QFrame *pageFrame;
- QLabel *titleLabel;
- QLabel *subTitleLabel;
- QWizardRuler *bottomRuler;
-
- QVBoxLayout *pageVBoxLayout;
- QHBoxLayout *buttonLayout;
- QGridLayout *mainLayout;
+ QWizardAntiFlickerWidget *antiFlickerWidget = nullptr;
+ QWidget *placeholderWidget1 = nullptr;
+ QWidget *placeholderWidget2 = nullptr;
+ QWizardHeader *headerWidget = nullptr;
+ QWatermarkLabel *watermarkLabel = nullptr;
+ QWidget *sideWidget = nullptr;
+ QFrame *pageFrame = nullptr;
+ QLabel *titleLabel = nullptr;
+ QLabel *subTitleLabel = nullptr;
+ QWizardRuler *bottomRuler = nullptr;
+
+ QVBoxLayout *pageVBoxLayout = nullptr;
+ QHBoxLayout *buttonLayout = nullptr;
+ QGridLayout *mainLayout = nullptr;
#if QT_CONFIG(style_windowsvista)
- QVistaHelper *vistaHelper;
- bool vistaInitPending;
- QVistaHelper::VistaState vistaState;
- bool vistaStateChanged;
- bool inHandleAeroStyleChange;
+ QVistaHelper *vistaHelper = nullptr;
+# if QT_CONFIG(shortcut)
+ QPointer<QShortcut> vistaNextShortcut;
+# endif
+ bool vistaInitPending = true;
+ QVistaHelper::VistaState vistaState = QVistaHelper::Dirty;
+ bool vistaStateChanged = false;
+ bool inHandleAeroStyleChange = false;
#endif
- int minimumWidth;
- int minimumHeight;
- int maximumWidth;
- int maximumHeight;
+ int minimumWidth = 0;
+ int minimumHeight = 0;
+ int maximumWidth = QWIDGETSIZE_MAX;
+ int maximumHeight = QWIDGETSIZE_MAX;
};
static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate)
@@ -720,6 +681,8 @@ void QWizardPrivate::init()
{
Q_Q(QWizard);
+ std::fill(btns, btns + QWizard::NButtons, nullptr);
+
antiFlickerWidget = new QWizardAntiFlickerWidget(q, this);
wizStyle = QWizard::WizardStyle(q->style()->styleHint(QStyle::SH_WizardStyle, 0, q));
if (wizStyle == QWizard::MacStyle) {
@@ -1461,10 +1424,17 @@ void QWizardPrivate::updateButtonTexts()
// Vista: Add shortcut for 'next'. Note: native dialogs use ALT-Right
// even in RTL mode, so do the same, even if it might be counter-intuitive.
// The shortcut for 'back' is set in class QVistaBackButton.
-#if QT_CONFIG(shortcut)
- if (btns[QWizard::NextButton] && isVistaThemeEnabled())
- btns[QWizard::NextButton]->setShortcut(QKeySequence(Qt::ALT | Qt::Key_Right));
-#endif
+#if QT_CONFIG(shortcut) && QT_CONFIG(style_windowsvista)
+ if (btns[QWizard::NextButton] && isVistaThemeEnabled()) {
+ if (vistaNextShortcut.isNull()) {
+ vistaNextShortcut =
+ new QShortcut(QKeySequence(Qt::ALT | Qt::Key_Right),
+ btns[QWizard::NextButton], SLOT(animateClick()));
+ }
+ } else {
+ delete vistaNextShortcut;
+ }
+#endif // shortcut && style_windowsvista
}
void QWizardPrivate::updateButtonLayout()
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index cf5a81c204..6889c2e9e5 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -6204,7 +6204,7 @@ void QWidget::setFocusProxy(QWidget * w)
if (changingAppFocusWidget) {
QWidget *newDeepestFocusProxy = d_func()->deepestFocusProxy();
- QApplicationPrivate::focus_widget = newDeepestFocusProxy ? newDeepestFocusProxy : this;
+ QApplicationPrivate::setFocusWidget(newDeepestFocusProxy ? newDeepestFocusProxy : this, Qt::NoFocusReason);
}
}