summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/configure.json28
-rw-r--r--src/widgets/dialogs/dialogs.pri12
-rw-r--r--src/widgets/dialogs/qcolordialog.h9
-rw-r--r--src/widgets/dialogs/qdialog.h2
-rw-r--r--src/widgets/dialogs/qdialog_p.h2
-rw-r--r--src/widgets/dialogs/qerrormessage.h9
-rw-r--r--src/widgets/dialogs/qfiledialog.h9
-rw-r--r--src/widgets/dialogs/qfontdialog.h11
-rw-r--r--src/widgets/dialogs/qinputdialog.h11
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.h9
-rw-r--r--src/widgets/dialogs/qprogressdialog.h9
-rw-r--r--src/widgets/dialogs/qwizard.cpp2
-rw-r--r--src/widgets/dialogs/qwizard.h5
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp1
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp58
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp1
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp1
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp7
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp6
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp12
-rw-r--r--src/widgets/widgets/qplaintextedit_p.h3
-rw-r--r--src/widgets/widgets/qpushbutton.cpp13
-rw-r--r--src/widgets/widgets/qpushbutton_p.h4
-rw-r--r--src/widgets/widgets/qtextedit_p.h11
-rw-r--r--src/widgets/widgets/qtoolbox.cpp10
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp47
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p_p.h2
-rw-r--r--src/widgets/widgets/widgets.pri12
31 files changed, 216 insertions, 96 deletions
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index 14e4d10d38..13c7c774ed 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -163,10 +163,17 @@
"condition": "features.rubberband",
"output": [ "publicFeature", "feature" ]
},
+ "widgettextcontrol": {
+ "label": "QWidgetTextControl",
+ "purpose": "Provides text control functionality to other widgets.",
+ "section": "Widgets",
+ "output": [ "privateFeature" ]
+ },
"label": {
"label": "QLabel",
"purpose": "Provides a text or image display.",
"section": "Widgets",
+ "condition": "features.widgettextcontrol",
"output": [ "publicFeature" ]
},
"formlayout": {
@@ -193,6 +200,7 @@
"label": "QLineEdit",
"purpose": "Provides single-line edits.",
"section": "Widgets",
+ "condition": "features.widgettextcontrol",
"output": [ "publicFeature", "feature" ]
},
"radiobutton": {
@@ -382,7 +390,7 @@
"label": "QGraphicsView",
"purpose": "Provides a canvas/sprite framework.",
"section": "Widgets",
- "condition": "features.scrollarea",
+ "condition": "features.scrollarea && features.widgettextcontrol",
"output": [ "publicFeature", "feature" ]
},
"graphicseffect": {
@@ -396,7 +404,7 @@
"label": "QTextEdit",
"purpose": "Supports rich text editing.",
"section": "Widgets",
- "condition": "features.scrollarea && features.properties",
+ "condition": "features.scrollarea && features.properties && features.widgettextcontrol",
"output": [ "publicFeature", "feature" ]
},
"syntaxhighlighter": {
@@ -460,11 +468,17 @@
"condition": "features.lineedit && features.shortcut",
"output": [ "publicFeature", "feature" ]
},
+ "dialog" : {
+ "label": "QDialog",
+ "purpose": "Base class of dialog windows.",
+ "section": "Dialogs",
+ "output": [ "publicFeature" ]
+ },
"dialogbuttonbox": {
"label": "QDialogButtonBox",
"purpose": "Presents buttons in a layout that is appropriate for the current widget style.",
"section": "Dialogs",
- "condition": "features.pushbutton",
+ "condition": "features.dialog && features.pushbutton",
"output": [ "publicFeature" ]
},
"messagebox": {
@@ -473,6 +487,7 @@
"section": "Dialogs",
"condition" : [
"features.checkbox",
+ "features.dialog",
"features.dialogbuttonbox",
"features.label",
"features.pushbutton"
@@ -484,6 +499,7 @@
"purpose": "Provides a dialog widget for specifying colors.",
"section": "Dialogs",
"condition": [
+ "features.dialog",
"features.dialogbuttonbox",
"features.label",
"features.pushbutton",
@@ -498,6 +514,7 @@
"condition": [
"features.buttongroup",
"features.combobox",
+ "features.dialog",
"features.dialogbuttonbox",
"features.dirmodel",
"features.label",
@@ -516,6 +533,7 @@
"condition": [
"features.checkbox",
"features.combobox",
+ "features.dialog",
"features.dialogbuttonbox",
"features.groupbox",
"features.label",
@@ -530,6 +548,7 @@
"purpose": "Provides feedback on the progress of a slow operation.",
"section": "Dialogs",
"condition": [
+ "features.dialog",
"features.label",
"features.pushbutton",
"features.progressbar"
@@ -542,6 +561,7 @@
"section": "Dialogs",
"condition": [
"features.combobox",
+ "features.dialog",
"features.dialogbuttonbox",
"features.label",
"features.pushbutton",
@@ -557,6 +577,7 @@
"section": "Dialogs",
"condition": [
"features.checkbox",
+ "features.dialog",
"features.textedit",
"features.label",
"features.pushbutton",
@@ -569,6 +590,7 @@
"purpose": "Provides a framework for multi-page click-through dialogs.",
"section": "Dialogs",
"condition": [
+ "features.dialog",
"features.pushbutton",
"features.properties",
"features.label"
diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri
index 4f4a9b1517..8614d2bcc6 100644
--- a/src/widgets/dialogs/dialogs.pri
+++ b/src/widgets/dialogs/dialogs.pri
@@ -3,8 +3,6 @@
HEADERS += \
dialogs/qcolordialog.h \
dialogs/qfscompleter_p.h \
- dialogs/qdialog.h \
- dialogs/qdialog_p.h \
dialogs/qerrormessage.h \
dialogs/qfiledialog.h \
dialogs/qfiledialog_p.h \
@@ -30,7 +28,6 @@ else: FORMS += dialogs/qfiledialog.ui
INCLUDEPATH += $$PWD
SOURCES += \
dialogs/qcolordialog.cpp \
- dialogs/qdialog.cpp \
dialogs/qerrormessage.cpp \
dialogs/qfiledialog.cpp \
dialogs/qfontdialog.cpp \
@@ -42,4 +39,13 @@ SOURCES += \
dialogs/qfileinfogatherer.cpp \
dialogs/qwizard.cpp \
+qtConfig(dialog) {
+ HEADERS += \
+ dialogs/qdialog.h \
+ dialogs/qdialog_p.h
+
+ SOURCES += \
+ dialogs/qdialog.cpp
+}
+
RESOURCES += dialogs/qmessagebox.qrc
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 3b56f0b5d1..fb5b843ce4 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -41,13 +41,14 @@
#define QCOLORDIALOG_H
#include <QtWidgets/qtwidgetsglobal.h>
+
+#ifndef QT_NO_COLORDIALOG
+
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_COLORDIALOG
-
class QColorDialogPrivate;
class Q_WIDGETS_EXPORT QColorDialog : public QDialog
@@ -124,8 +125,8 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions)
-#endif // QT_NO_COLORDIALOG
-
QT_END_NAMESPACE
+#endif // QT_NO_COLORDIALOG
+
#endif // QCOLORDIALOG_H
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index d88ff4a841..72250172d3 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
+QT_REQUIRE_CONFIG(dialog);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 6723edae38..9ee89863f6 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -61,6 +61,8 @@
#endif
#include <qpa/qplatformdialoghelper.h>
+QT_REQUIRE_CONFIG(dialog);
+
QT_BEGIN_NAMESPACE
class QSizeGrip;
diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index 5ffa568c10..976ba9abd5 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -41,13 +41,14 @@
#define QERRORMESSAGE_H
#include <QtWidgets/qtwidgetsglobal.h>
+
+#ifndef QT_NO_ERRORMESSAGE
+
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ERRORMESSAGE
-
class QErrorMessagePrivate;
class Q_WIDGETS_EXPORT QErrorMessage: public QDialog
@@ -72,8 +73,8 @@ private:
Q_DISABLE_COPY(QErrorMessage)
};
-#endif // QT_NO_ERRORMESSAGE
-
QT_END_NAMESPACE
+#endif // QT_NO_ERRORMESSAGE
+
#endif // QERRORMESSAGE_H
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index 7959eebd7b..733dd03092 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -44,13 +44,14 @@
#include <QtCore/qdir.h>
#include <QtCore/qstring.h>
#include <QtCore/qurl.h>
+
+#ifndef QT_NO_FILEDIALOG
+
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_FILEDIALOG
-
class QModelIndex;
class QItemSelection;
struct QFileDialogArgs;
@@ -313,8 +314,8 @@ inline void QFileDialog::setDirectory(const QDir &adirectory)
Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options)
-#endif // QT_NO_FILEDIALOG
-
QT_END_NAMESPACE
+#endif // QT_NO_FILEDIALOG
+
#endif // QFILEDIALOG_H
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index 276f8f5e83..da13a5ab99 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -42,13 +42,14 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qwindowdefs.h>
-#include <QtWidgets/qdialog.h>
#include <QtGui/qfont.h>
-QT_BEGIN_NAMESPACE
+#ifndef QT_NO_FONTDIALOG
+#include <QtWidgets/qdialog.h>
+
+QT_BEGIN_NAMESPACE
-#ifndef QT_NO_FONTDIALOG
class QFontDialogPrivate;
@@ -117,8 +118,8 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
-#endif // QT_NO_FONTDIALOG
-
QT_END_NAMESPACE
+#endif // QT_NO_FONTDIALOG
+
#endif // QFONTDIALOG_H
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 2fbea908cb..7b43e774a7 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -41,14 +41,15 @@
#define QINPUTDIALOG_H
#include <QtWidgets/qtwidgetsglobal.h>
-#include <QtWidgets/qdialog.h>
#include <QtCore/qstring.h>
#include <QtWidgets/qlineedit.h>
-QT_BEGIN_NAMESPACE
+#ifndef QT_NO_INPUTDIALOG
+#include <QtWidgets/qdialog.h>
+
+QT_BEGIN_NAMESPACE
-#ifndef QT_NO_INPUTDIALOG
class QInputDialogPrivate;
@@ -209,8 +210,8 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions)
-#endif // QT_NO_INPUTDIALOG
-
QT_END_NAMESPACE
+#endif // QT_NO_INPUTDIALOG
+
#endif // QINPUTDIALOG_H
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 3b0a71518d..fe32611ed8 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1834,7 +1834,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
"<p>Qt and the Qt logo are trademarks of The Qt Company Ltd.</p>"
"<p>Qt is The Qt Company Ltd product developed as an open source "
"project. See <a href=\"http://%3/\">%3</a> for more information.</p>"
- ).arg(QStringLiteral("2016"),
+ ).arg(QStringLiteral("2017"),
QStringLiteral("qt.io/licensing"),
QStringLiteral("qt.io"));
QMessageBox *msgBox = new QMessageBox(parent);
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index 3e561a5161..40e5c701fe 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -41,13 +41,14 @@
#define QMESSAGEBOX_H
#include <QtWidgets/qtwidgetsglobal.h>
+
+#ifndef QT_NO_MESSAGEBOX
+
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_MESSAGEBOX
-
class QLabel;
class QMessageBoxPrivate;
class QAbstractButton;
@@ -322,8 +323,8 @@ QString s = QApplication::tr("Executable '%1' requires Qt "\
str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplication::tr(\
"Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal("%s", s.toLatin1().data()); }}
-#endif // QT_NO_MESSAGEBOX
-
QT_END_NAMESPACE
+#endif // QT_NO_MESSAGEBOX
+
#endif // QMESSAGEBOX_H
diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index a5e333259f..f4e63fb088 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -41,13 +41,14 @@
#define QPROGRESSDIALOG_H
#include <QtWidgets/qtwidgetsglobal.h>
+
+#ifndef QT_NO_PROGRESSDIALOG
+
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_PROGRESSDIALOG
-
class QPushButton;
class QLabel;
class QProgressBar;
@@ -127,8 +128,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_disconnectOnClose())
};
-#endif // QT_NO_PROGRESSDIALOG
-
QT_END_NAMESPACE
+#endif // QT_NO_PROGRESSDIALOG
+
#endif // QPROGRESSDIALOG_H
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 5e598ba990..d1abbc85d2 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1089,7 +1089,7 @@ void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info)
// ### hardcoded for now:
titleFont = QFont(QLatin1String("Segoe UI"), 12);
QPalette pal(titleLabel->palette());
- pal.setColor(QPalette::Text, "#003399");
+ pal.setColor(QPalette::Text, QColor(0x00, 0x33, 0x99));
titleLabel->setPalette(pal);
}
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 7915c9e7f8..3236ee90df 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -41,13 +41,14 @@
#define QWIZARD_H
#include <QtWidgets/qtwidgetsglobal.h>
+
+#ifndef QT_NO_WIZARD
+
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_WIZARD
-
class QAbstractButton;
class QWizardPage;
class QWizardPrivate;
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 939e2a3d79..20002b1f82 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1703,6 +1703,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
d->viewportEnteredNeeded = true;
break;
case QEvent::Leave:
+ d->setHoverIndex(QModelIndex()); // If we've left, no hover should be needed anymore
#ifndef QT_NO_STATUSTIP
if (d->shouldClearStatusTip && d->parent) {
QString empty;
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index b213a0859c..99704c7911 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -89,11 +89,11 @@ public:
: model->index(itemPos, currentIdx(), rootIndex);
}
- inline void flipEventFilters(QAbstractItemDelegate *oldDelegate,
- QAbstractItemDelegate *newDelegate)
+ void flipEventFilters(QAbstractItemDelegate *oldDelegate,
+ QAbstractItemDelegate *newDelegate) const
{
- for (QList<WidgetMapper>::const_iterator it = widgetMap.cbegin(), end = widgetMap.cend(); it != end; ++it) {
- QWidget *w = it->widget;
+ for (const WidgetMapper &e : widgetMap) {
+ QWidget *w = e.widget;
if (!w)
continue;
w->removeEventFilter(oldDelegate);
@@ -111,11 +111,6 @@ public:
struct WidgetMapper
{
- inline WidgetMapper(QWidget *w = 0, int c = 0, const QModelIndex &i = QModelIndex())
- : widget(w), section(c), currentIndex(i) {}
- inline WidgetMapper(QWidget *w, int c, const QModelIndex &i, const QByteArray &p)
- : widget(w), section(c), currentIndex(i), property(p) {}
-
QPointer<QWidget> widget;
int section;
QPersistentModelIndex currentIndex;
@@ -127,14 +122,15 @@ public:
bool commit(const WidgetMapper &m);
- QList<WidgetMapper> widgetMap;
+ std::vector<WidgetMapper> widgetMap;
};
+Q_DECLARE_TYPEINFO(QDataWidgetMapperPrivate::WidgetMapper, Q_MOVABLE_TYPE);
int QDataWidgetMapperPrivate::findWidget(QWidget *w) const
{
- for (QList<WidgetMapper>::const_iterator it = widgetMap.cbegin(), end = widgetMap.cend(); it != end; ++it) {
- if (it->widget == w)
- return int(std::distance(widgetMap.cbegin(), it));
+ for (const WidgetMapper &e : widgetMap) {
+ if (e.widget == w)
+ return int(&e - &widgetMap.front());
}
return -1;
}
@@ -171,8 +167,8 @@ void QDataWidgetMapperPrivate::populate(WidgetMapper &m)
void QDataWidgetMapperPrivate::populate()
{
- for (QList<WidgetMapper>::iterator it = widgetMap.begin(), end = widgetMap.end(); it != end; ++it)
- populate(*it);
+ for (WidgetMapper &e : widgetMap)
+ populate(e);
}
static bool qContainsIndex(const QModelIndex &idx, const QModelIndex &topLeft,
@@ -187,9 +183,9 @@ void QDataWidgetMapperPrivate::_q_dataChanged(const QModelIndex &topLeft, const
if (topLeft.parent() != rootIndex)
return; // not in our hierarchy
- for (QList<WidgetMapper>::iterator it = widgetMap.begin(), end = widgetMap.end(); it != end; ++it) {
- if (qContainsIndex(it->currentIndex, topLeft, bottomRight))
- populate(*it);
+ for (WidgetMapper &e : widgetMap) {
+ if (qContainsIndex(e.currentIndex, topLeft, bottomRight))
+ populate(e);
}
}
@@ -202,7 +198,7 @@ void QDataWidgetMapperPrivate::_q_commitData(QWidget *w)
if (idx == -1)
return; // not our widget
- commit(widgetMap.at(idx));
+ commit(widgetMap[idx]);
}
void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate::EndEditHint hint)
@@ -479,7 +475,7 @@ void QDataWidgetMapper::addMapping(QWidget *widget, int section)
Q_D(QDataWidgetMapper);
removeMapping(widget);
- d->widgetMap.append(QDataWidgetMapperPrivate::WidgetMapper(widget, section, d->indexAt(section)));
+ d->widgetMap.push_back({widget, section, d->indexAt(section), QByteArray()});
widget->installEventFilter(d->delegate);
}
@@ -497,7 +493,7 @@ void QDataWidgetMapper::addMapping(QWidget *widget, int section, const QByteArra
Q_D(QDataWidgetMapper);
removeMapping(widget);
- d->widgetMap.append(QDataWidgetMapperPrivate::WidgetMapper(widget, section, d->indexAt(section), propertyName));
+ d->widgetMap.push_back({widget, section, d->indexAt(section), propertyName});
widget->installEventFilter(d->delegate);
}
@@ -514,7 +510,7 @@ void QDataWidgetMapper::removeMapping(QWidget *widget)
if (idx == -1)
return;
- d->widgetMap.removeAt(idx);
+ d->widgetMap.erase(d->widgetMap.begin() + idx);
widget->removeEventFilter(d->delegate);
}
@@ -532,7 +528,7 @@ int QDataWidgetMapper::mappedSection(QWidget *widget) const
if (idx == -1)
return -1;
- return d->widgetMap.at(idx).section;
+ return d->widgetMap[idx].section;
}
/*!
@@ -550,7 +546,7 @@ QByteArray QDataWidgetMapper::mappedPropertyName(QWidget *widget) const
int idx = d->findWidget(widget);
if (idx == -1)
return QByteArray();
- const QDataWidgetMapperPrivate::WidgetMapper &m = d->widgetMap.at(idx);
+ const auto &m = d->widgetMap[idx];
if (m.property.isEmpty())
return m.widget->metaObject()->userProperty().name();
else
@@ -567,9 +563,9 @@ QWidget *QDataWidgetMapper::mappedWidgetAt(int section) const
{
Q_D(const QDataWidgetMapper);
- for (QList<QDataWidgetMapperPrivate::WidgetMapper>::const_iterator it = d->widgetMap.cbegin(), end = d->widgetMap.cend(); it != end; ++it) {
- if (it->section == section)
- return it->widget;
+ for (auto &e : d->widgetMap) {
+ if (e.section == section)
+ return e.widget;
}
return 0;
@@ -606,8 +602,8 @@ bool QDataWidgetMapper::submit()
{
Q_D(QDataWidgetMapper);
- for (QList<QDataWidgetMapperPrivate::WidgetMapper>::const_iterator it = d->widgetMap.cbegin(), end = d->widgetMap.cend(); it != end; ++it) {
- if (!d->commit(*it))
+ for (auto &e : d->widgetMap) {
+ if (!d->commit(e))
return false;
}
@@ -746,9 +742,9 @@ void QDataWidgetMapper::clearMapping()
{
Q_D(QDataWidgetMapper);
- QList<QDataWidgetMapperPrivate::WidgetMapper> copy;
+ decltype(d->widgetMap) copy;
d->widgetMap.swap(copy); // a C++98 move
- for (QList<QDataWidgetMapperPrivate::WidgetMapper>::const_reverse_iterator it = copy.crbegin(), end = copy.crend(); it != end; ++it) {
+ for (auto it = copy.crbegin(), end = copy.crend(); it != end; ++it) {
if (it->widget)
it->widget->removeEventFilter(d->delegate);
}
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index 747d5db782..6a6220cd0a 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -62,7 +62,6 @@
#include <private/qtextengine_p.h>
#include <qdebug.h>
#include <qlocale.h>
-#include <qdialog.h>
#include <qmath.h>
#include <limits.h>
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index e4115c9e60..4149d3ac3a 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -67,7 +67,6 @@
#include <private/qlayoutengine_p.h>
#include <qdebug.h>
#include <qlocale.h>
-#include <qdialog.h>
#include <qtableview.h>
#include <limits.h>
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 7c62edeb2f..ad82e5eb2a 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -5987,7 +5987,7 @@ void QWidgetPrivate::resolveLocale()
Q_Q(const QWidget);
if (!q->testAttribute(Qt::WA_SetLocale)) {
- setLocale_helper(q->isWindow()
+ setLocale_helper(q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)
? QLocale()
: q->parentWidget()->locale());
}
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 2b9f042862..260a660bf9 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -77,7 +77,9 @@
#include <qmainwindow.h>
#include <qdockwidget.h>
#include <qmdisubwindow.h>
+#if QT_CONFIG(dialog)
#include <qdialog.h>
+#endif
#include <private/qwidget_p.h>
#include <QAbstractSpinBox>
#if QT_CONFIG(label)
@@ -2820,7 +2822,10 @@ void QStyleSheetStyle::polish(QWidget *w)
#ifndef QT_NO_MENUBAR
|| qobject_cast<QMenuBar *>(w)
#endif
- || qobject_cast<QDialog *>(w)) {
+#if QT_CONFIG(dialog)
+ || qobject_cast<QDialog *>(w)
+#endif
+ ) {
w->setAttribute(Qt::WA_StyledBackground, true);
}
QWidget *ew = embeddedWidget(w);
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index fe1446660b..27ecc33dba 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -2082,15 +2082,15 @@ void QDockAreaLayoutInfo::reparentWidgets(QWidget *parent)
const QDockAreaLayoutItem &item = item_list.at(i);
if (item.flags & QDockAreaLayoutItem::GapItem)
continue;
- if (item.skip())
- continue;
if (item.subinfo)
item.subinfo->reparentWidgets(parent);
if (item.widgetItem) {
QWidget *w = item.widgetItem->widget();
+ if (qobject_cast<QDockWidgetGroupWindow *>(w))
+ continue;
if (w->parent() != parent) {
bool hidden = w->isHidden();
- w->setParent(parent);
+ w->setParent(parent, w->windowFlags());
if (!hidden)
w->show();
}
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 1d81d1fcb5..68be82c71d 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -534,7 +534,19 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
#endif
}
// If there is a 'before' action, it takes preference
+
+ // There's a bug in GHS compiler that causes internal error on the following code.
+ // The affected GHS compiler versions are 2016.5.4 and 2017.1
+ // This temporary workaround allows to compile with GHS toolchain and should be
+ // removed when GHS provides a patch to fix the compiler issue.
+
+#if defined(Q_CC_GHS)
+ const SideWidgetLocation loc = {position, -1};
+ const auto location = before ? findSideWidget(before) : loc;
+#else
const auto location = before ? findSideWidget(before) : SideWidgetLocation{position, -1};
+#endif
+
SideWidgetEntryList &list = location.position == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets;
list.insert(location.isValid() ? list.begin() + location.index : list.end(),
SideWidgetEntry(w, newAction, flags));
diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h
index f0dd1c0ed4..803623c974 100644
--- a/src/widgets/widgets/qplaintextedit_p.h
+++ b/src/widgets/widgets/qplaintextedit_p.h
@@ -60,11 +60,12 @@
#include "QtWidgets/qmenu.h"
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtCore/qbasictimer.h"
-#include "private/qwidgettextcontrol_p.h"
#include "qplaintextedit.h"
#ifndef QT_NO_TEXTEDIT
+#include "private/qwidgettextcontrol_p.h"
+
QT_BEGIN_NAMESPACE
class QMimeData;
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index 1beea7edc5..a4318681c9 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -40,8 +40,9 @@
#include "qapplication.h"
#include "qbitmap.h"
#include "qdesktopwidget.h"
-#include "qdialog.h"
+#if QT_CONFIG(dialog)
#include <private/qdialog_p.h>
+#endif
#include "qdrawutil.h"
#include "qevent.h"
#include "qfontmetrics.h"
@@ -288,6 +289,7 @@ QPushButton::~QPushButton()
{
}
+#if QT_CONFIG(dialog)
QDialog *QPushButtonPrivate::dialogParent() const
{
Q_Q(const QPushButton);
@@ -299,6 +301,7 @@ QDialog *QPushButtonPrivate::dialogParent() const
}
return 0;
}
+#endif
/*!
Initialize \a option with the values from this QPushButton. This method is useful
@@ -362,10 +365,12 @@ void QPushButton::setDefault(bool enable)
if (d->defaultButton == enable)
return;
d->defaultButton = enable;
+#if QT_CONFIG(dialog)
if (d->defaultButton) {
if (QDialog *dlg = d->dialogParent())
dlg->d_func()->setMainDefault(this);
}
+#endif
update();
#ifndef QT_NO_ACCESSIBILITY
QAccessible::State s;
@@ -474,9 +479,11 @@ void QPushButton::focusInEvent(QFocusEvent *e)
Q_D(QPushButton);
if (e->reason() != Qt::PopupFocusReason && autoDefault() && !d->defaultButton) {
d->defaultButton = true;
+#if QT_CONFIG(dialog)
QDialog *dlg = qobject_cast<QDialog*>(window());
if (dlg)
dlg->d_func()->setDefault(this);
+#endif
}
QAbstractButton::focusInEvent(e);
}
@@ -488,11 +495,13 @@ void QPushButton::focusOutEvent(QFocusEvent *e)
{
Q_D(QPushButton);
if (e->reason() != Qt::PopupFocusReason && autoDefault() && d->defaultButton) {
+#if QT_CONFIG(dialog)
QDialog *dlg = qobject_cast<QDialog*>(window());
if (dlg)
dlg->d_func()->setDefault(0);
else
d->defaultButton = false;
+#endif
}
QAbstractButton::focusOutEvent(e);
@@ -657,10 +666,12 @@ bool QPushButton::event(QEvent *e)
{
Q_D(QPushButton);
if (e->type() == QEvent::ParentChange) {
+#if QT_CONFIG(dialog)
if (QDialog *dialog = d->dialogParent()) {
if (d->defaultButton)
dialog->d_func()->setMainDefault(this);
}
+#endif
} else if (e->type() == QEvent::StyleChange
#ifdef Q_OS_MAC
|| e->type() == QEvent::MacSizeChange
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index 198091503a..a32b599b94 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -81,7 +81,11 @@ public:
#endif
void resetLayoutItemMargins();
void _q_popupPressed();
+#if QT_CONFIG(dialog)
QDialog *dialogParent() const;
+#else
+ QDialog *dialogParent() const { return 0; };
+#endif
QPointer<QMenu> menu;
uint autoDefault : 2;
diff --git a/src/widgets/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h
index cca315ce30..13d0eb323a 100644
--- a/src/widgets/widgets/qtextedit_p.h
+++ b/src/widgets/widgets/qtextedit_p.h
@@ -61,13 +61,14 @@
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtCore/qbasictimer.h"
#include "QtCore/qurl.h"
-#include "private/qwidgettextcontrol_p.h"
#include "qtextedit.h"
-QT_BEGIN_NAMESPACE
-
#ifndef QT_NO_TEXTEDIT
+#include "private/qwidgettextcontrol_p.h"
+
+QT_BEGIN_NAMESPACE
+
class QMimeData;
class QTextEditPrivate : public QAbstractScrollAreaPrivate
{
@@ -135,9 +136,9 @@ public:
QBasicTimer deleteAllTimer;
#endif
};
-#endif // QT_NO_TEXTEDIT
-
QT_END_NAMESPACE
+#endif // QT_NO_TEXTEDIT
+
#endif // QTEXTEDIT_P_H
diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp
index 2c74b5fa9d..8413827e30 100644
--- a/src/widgets/widgets/qtoolbox.cpp
+++ b/src/widgets/widgets/qtoolbox.cpp
@@ -117,7 +117,7 @@ public:
void _q_buttonClicked();
void _q_widgetDestroyed(QObject*);
- const Page *page(QWidget *widget) const;
+ const Page *page(const QObject *widget) const;
const Page *page(int index) const;
Page *page(int index);
@@ -129,7 +129,7 @@ public:
Page *currentPage;
};
-const QToolBoxPrivate::Page *QToolBoxPrivate::page(QWidget *widget) const
+const QToolBoxPrivate::Page *QToolBoxPrivate::page(const QObject *widget) const
{
if (!widget)
return 0;
@@ -449,11 +449,9 @@ void QToolBoxPrivate::relayout()
void QToolBoxPrivate::_q_widgetDestroyed(QObject *object)
{
Q_Q(QToolBox);
- // no verification - vtbl corrupted already
- QWidget *p = (QWidget*)object;
- const QToolBoxPrivate::Page *c = page(p);
- if (!p || !c)
+ const QToolBoxPrivate::Page * const c = page(object);
+ if (!c)
return;
layout->removeWidget(c->sv);
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 9aec94d47f..9e848ca834 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -2055,16 +2055,59 @@ void QWidgetTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
preeditCursor = a.start;
hideCursor = !a.length;
} else if (a.type == QInputMethodEvent::TextFormat) {
- QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();
+ QTextCharFormat f = cursor.charFormat();
+ f.merge(qvariant_cast<QTextFormat>(a.value).toCharFormat());
if (f.isValid()) {
QTextLayout::FormatRange o;
o.start = a.start + cursor.position() - block.position();
o.length = a.length;
o.format = f;
- overrides.append(o);
+
+ // Make sure list is sorted by start index
+ QVector<QTextLayout::FormatRange>::iterator it = overrides.end();
+ while (it != overrides.begin()) {
+ QVector<QTextLayout::FormatRange>::iterator previous = it - 1;
+ if (o.start >= previous->start) {
+ overrides.insert(it, o);
+ break;
+ }
+ it = previous;
+ }
+
+ if (it == overrides.begin())
+ overrides.prepend(o);
}
}
}
+
+ if (cursor.charFormat().isValid()) {
+ int start = cursor.position() - block.position();
+ int end = start + e->preeditString().length();
+
+ QVector<QTextLayout::FormatRange>::iterator it = overrides.begin();
+ while (it != overrides.end()) {
+ QTextLayout::FormatRange range = *it;
+ int rangeStart = range.start;
+ if (rangeStart > start) {
+ QTextLayout::FormatRange o;
+ o.start = start;
+ o.length = rangeStart - start;
+ o.format = cursor.charFormat();
+ it = overrides.insert(it, o) + 1;
+ }
+
+ ++it;
+ start = range.start + range.length;
+ }
+
+ if (start < end) {
+ QTextLayout::FormatRange o;
+ o.start = start;
+ o.length = end - start;
+ o.format = cursor.charFormat();
+ overrides.append(o);
+ }
+ }
layout->setFormats(overrides);
cursor.endEditBlock();
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index f540a3c9ad..e2539a30e7 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -65,6 +65,8 @@
#include <QtCore/qmimedata.h>
#include <QtGui/private/qinputcontrol_p.h>
+QT_REQUIRE_CONFIG(widgettextcontrol);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h
index 35027ff82a..357ffdc6bd 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h
@@ -62,6 +62,8 @@
#include "QtCore/qpointer.h"
#include "private/qobject_p.h"
+QT_REQUIRE_CONFIG(widgettextcontrol);
+
QT_BEGIN_NAMESPACE
class QMimeData;
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index 22e083a3d4..086585f0e6 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -65,8 +65,6 @@ HEADERS += \
widgets/qfocusframe.h \
widgets/qscrollarea.h \
widgets/qwidgetanimator_p.h \
- widgets/qwidgettextcontrol_p.h \
- widgets/qwidgettextcontrol_p_p.h \
widgets/qwidgetlinecontrol_p.h \
widgets/qtoolbararealayout_p.h \
widgets/qplaintextedit.h \
@@ -120,7 +118,6 @@ SOURCES += \
widgets/qfocusframe.cpp \
widgets/qscrollarea.cpp \
widgets/qwidgetanimator.cpp \
- widgets/qwidgettextcontrol.cpp \
widgets/qwidgetlinecontrol.cpp \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp
@@ -194,6 +191,15 @@ qtConfig(dialogbuttonbox) {
widgets/qdialogbuttonbox.cpp
}
+qtConfig(widgettextcontrol) {
+ HEADERS += \
+ widgets/qwidgettextcontrol_p.h \
+ widgets/qwidgettextcontrol_p_p.h
+
+ SOURCES += \
+ widgets/qwidgettextcontrol.cpp
+}
+
macx {
HEADERS += \
widgets/qmacnativewidget_mac.h \