summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qaction.cpp17
-rw-r--r--src/widgets/kernel/qapplication.cpp56
-rw-r--r--src/widgets/kernel/qapplication.h13
-rw-r--r--src/widgets/kernel/qapplication_p.h9
-rw-r--r--src/widgets/kernel/qformlayout.cpp323
-rw-r--r--src/widgets/kernel/qformlayout.h15
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp2
-rw-r--r--src/widgets/kernel/qgridlayout.cpp10
-rw-r--r--src/widgets/kernel/qlayout.cpp5
-rw-r--r--src/widgets/kernel/qshortcut.cpp3
-rw-r--r--src/widgets/kernel/qwidget.cpp27
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp7
-rw-r--r--src/widgets/kernel/qwidgetsfunctions_wince.cpp120
-rw-r--r--src/widgets/kernel/qwidgetsfunctions_wince.h60
-rw-r--r--src/widgets/kernel/win.pri6
15 files changed, 366 insertions, 307 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 718ecffcc9..88b29e9147 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -279,12 +279,8 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
group the action will be automatically inserted into the group.
*/
QAction::QAction(QObject* parent)
- : QObject(*(new QActionPrivate), parent)
+ : QAction(*new QActionPrivate, parent)
{
- Q_D(QAction);
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
}
@@ -302,13 +298,10 @@ QAction::QAction(QObject* parent)
*/
QAction::QAction(const QString &text, QObject* parent)
- : QObject(*(new QActionPrivate), parent)
+ : QAction(parent)
{
Q_D(QAction);
d->text = text;
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
}
/*!
@@ -324,14 +317,10 @@ QAction::QAction(const QString &text, QObject* parent)
setToolTip().
*/
QAction::QAction(const QIcon &icon, const QString &text, QObject* parent)
- : QObject(*(new QActionPrivate), parent)
+ : QAction(text, parent)
{
Q_D(QAction);
d->icon = icon;
- d->text = text;
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
}
/*!
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 86b3282124..5007969c96 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -101,23 +101,13 @@
#include "qdatetime.h"
-#ifdef Q_OS_WINCE
-extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp
-extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp
-extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
-#endif
-
#include <qpa/qplatformwindow.h>
//#define ALIEN_DEBUG
static void initResources()
{
-#if defined(Q_OS_WINCE)
- Q_INIT_RESOURCE(qstyle_wince);
-#else
Q_INIT_RESOURCE(qstyle);
-#endif
Q_INIT_RESOURCE(qmessagebox);
}
@@ -171,12 +161,7 @@ static QByteArray nativeStyleClassName()
return name;
}
-#ifdef Q_OS_WINCE
-int QApplicationPrivate::autoMaximizeThreshold = -1;
-bool QApplicationPrivate::autoSipEnabled = false;
-#else
bool QApplicationPrivate::autoSipEnabled = true;
-#endif
QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)
: QApplicationPrivateBase(argc, argv, flags)
@@ -352,8 +337,10 @@ void QApplicationPrivate::createEventDispatcher()
\sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings
*/
+// ### fixme: Qt 6: Remove ColorSpec and accessors.
/*!
\enum QApplication::ColorSpec
+ \obsolete
\value NormalColor the default color allocation policy
\value CustomColor the same as NormalColor for X11; allocates colors
@@ -410,8 +397,6 @@ QString QApplicationPrivate::styleSheet; // default application styles
#endif
QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
-int QApplicationPrivate::app_cspec = QApplication::NormalColor;
-
QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
@@ -657,17 +642,6 @@ void QApplicationPrivate::initialize()
if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0)
QCoreApplication::setAttribute(Qt::AA_NativeWindows);
-#ifdef Q_OS_WINCE
-#ifdef QT_AUTO_MAXIMIZE_THRESHOLD
- autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD;
-#else
- if (qt_wince_is_mobile())
- autoMaximizeThreshold = 50;
- else
- autoMaximizeThreshold = -1;
-#endif //QT_AUTO_MAXIMIZE_THRESHOLD
-#endif //Q_OS_WINCE
-
#ifndef QT_NO_WHEELEVENT
QApplicationPrivate::wheel_scroll_lines = 3;
#endif
@@ -1061,19 +1035,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
The default is platform dependent.
*/
-
-#ifdef Q_OS_WINCE
-void QApplication::setAutoMaximizeThreshold(const int threshold)
-{
- QApplicationPrivate::autoMaximizeThreshold = threshold;
-}
-
-int QApplication::autoMaximizeThreshold() const
-{
- return QApplicationPrivate::autoMaximizeThreshold;
-}
-#endif
-
void QApplication::setAutoSipEnabled(const bool enabled)
{
QApplicationPrivate::autoSipEnabled = enabled;
@@ -1314,17 +1275,21 @@ QStyle* QApplication::setStyle(const QString& style)
/*!
Returns the color specification.
+ \obsolete
\sa QApplication::setColorSpec()
*/
int QApplication::colorSpec()
{
- return QApplicationPrivate::app_cspec;
+ return QApplication::NormalColor;
}
/*!
Sets the color specification for the application to \a spec.
+ \obsolete
+
+ This call has no effect.
The color specification controls how the application allocates colors when
run on a display with a limited amount of colors, e.g. 8 bit / 256 color
@@ -1380,10 +1345,7 @@ int QApplication::colorSpec()
void QApplication::setColorSpec(int spec)
{
- if (Q_UNLIKELY(qApp))
- qWarning("QApplication::setColorSpec: This function must be "
- "called before the QApplication object is created");
- QApplicationPrivate::app_cspec = spec;
+ Q_UNUSED(spec)
}
/*!
@@ -3777,7 +3739,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
if (receiver->isWidgetType()) {
QWidget *widget = static_cast<QWidget *>(receiver);
-#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))
+#if !defined(QT_NO_CURSOR)
// toggle HasMouse widget state on enter and leave
if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) &&
(!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window()))
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index b27fba620e..52f44759f4 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -84,9 +84,6 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication
#ifndef QT_NO_STYLE_STYLESHEET
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
#endif
-#ifdef Q_OS_WINCE
- Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold)
-#endif
Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
public:
@@ -101,8 +98,10 @@ public:
static void setStyle(QStyle*);
static QStyle *setStyle(const QString&);
enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 };
- static int colorSpec();
- static void setColorSpec(int);
+#if QT_DEPRECATED_SINCE(5, 8)
+ QT_DEPRECATED static int colorSpec();
+ QT_DEPRECATED static void setColorSpec(int);
+#endif // QT_DEPRECATED_SINCE(5, 8)
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {}
#endif
@@ -195,10 +194,6 @@ public Q_SLOTS:
#ifndef QT_NO_STYLE_STYLESHEET
void setStyleSheet(const QString& sheet);
#endif
-#ifdef Q_OS_WINCE
- void setAutoMaximizeThreshold(const int threshold);
- int autoMaximizeThreshold() const;
-#endif
void setAutoSipEnabled(const bool enabled);
bool autoSipEnabled() const;
static void closeAllWindows();
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 3358cce744..8aab3bfae4 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -90,11 +90,8 @@ extern Q_GUI_EXPORT bool qt_is_gui_used;
extern QClipboard *qt_clipboard;
#endif
-#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE)
+#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN)
extern QSysInfo::WinVersion qt_winver;
-# ifdef Q_OS_WINCE
- extern DWORD qt_cever;
-# endif
#elif defined (Q_OS_MAC)
extern QSysInfo::MacVersion qt_macver;
#endif
@@ -126,9 +123,6 @@ public:
#endif
static void reset_instance_pointer();
#endif
-#ifdef Q_OS_WINCE
- static int autoMaximizeThreshold;
-#endif
static bool autoSipEnabled;
static QString desktopStyleKey();
@@ -189,7 +183,6 @@ public:
static QWidgetList *popupWidgets;
static QStyle *app_style;
static bool overrides_native_style;
- static int app_cspec;
static QPalette *sys_pal;
static QPalette *set_pal;
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 9b346a2c50..ce5e58642c 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -185,6 +185,7 @@ public:
int insertRow(int row);
void insertRows(int row, int count);
+ void removeRow(int row);
void setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item);
void setLayout(int row, QFormLayout::ItemRole role, QLayout *layout);
void setWidget(int row, QFormLayout::ItemRole role, QWidget *widget);
@@ -947,6 +948,12 @@ void QFormLayoutPrivate::insertRows(int row, int count)
}
}
+void QFormLayoutPrivate::removeRow(int row)
+{
+ if (uint(row) < uint(m_matrix.rowCount()))
+ m_matrix.removeRow(row);
+}
+
void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item)
{
const bool fullRow = role == QFormLayout::SpanningRole;
@@ -1178,6 +1185,28 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
*/
/*!
+ \since 5.8
+
+ \struct QFormLayout::TakeRowResult
+
+ \brief Contains the result of a QFormLayout::takeRow() call.
+
+ \sa QFormLayout::takeRow()
+*/
+
+/*!
+ \variable QFormLayout::TakeRowResult::labelItem
+
+ Contains the layout item corresponding to the label of the row.
+*/
+
+/*!
+ \variable QFormLayout::TakeRowResult::fieldItem
+
+ Contains the layout item corresponding to the field of the row.
+*/
+
+/*!
Constructs a new form layout with the given \a parent widget.
\sa QWidget::setLayout()
@@ -1380,6 +1409,287 @@ void QFormLayout::insertRow(int row, QLayout *layout)
invalidate();
}
+static QLayoutItem *ownershipCleanedItem(QFormLayoutItem *item, QFormLayout *layout)
+{
+ if (!item)
+ return nullptr;
+
+ // grab ownership back from the QFormLayoutItem
+ QLayoutItem *i = item->item;
+ item->item = nullptr;
+ delete item;
+
+ if (QLayout *l = i->layout()) {
+ // sanity check in case the user passed something weird to QObject::setParent()
+ if (l->parent() == layout)
+ l->setParent(nullptr);
+ }
+
+ return i;
+}
+
+static void clearQLayoutItem(QLayoutItem *item)
+{
+ if (Q_LIKELY(item)) {
+ if (QLayout *layout = item->layout()) {
+ while (QLayoutItem *child = layout->takeAt(0)) {
+ clearQLayoutItem(child);
+ delete child;
+ }
+ delete layout;
+ }
+ delete item->widget();
+ delete item->spacerItem();
+ }
+}
+
+/*!
+ \since 5.8
+
+ Deletes row \a row from this form layout.
+
+ \a row must be non-negative and less than rowCount().
+
+ After this call, rowCount() is decremented by one. All widgets and
+ nested layouts that occupied this row are deleted. That includes both
+ the field widget(s) and the label, if any. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ You can use this function to undo a previous addRow() or insertRow():
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QLineEdit> le = new QLineEdit;
+ flay->insertRow(2, "User:", le);
+ // later:
+ flay->removeRow(2); // le == nullptr at this point
+ \endcode
+
+ If you want to remove the row from the layout without deleting the widgets, use takeRow() instead.
+
+ \sa takeRow()
+*/
+void QFormLayout::removeRow(int row)
+{
+ TakeRowResult result = takeRow(row);
+ clearQLayoutItem(result.labelItem);
+ clearQLayoutItem(result.fieldItem);
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Deletes the row corresponding to \a widget from this form layout.
+
+ After this call, rowCount() is decremented by one. All widgets and
+ nested layouts that occupied this row are deleted. That includes both
+ the field widget(s) and the label, if any. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ You can use this function to undo a previous addRow() or insertRow():
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QLineEdit> le = new QLineEdit;
+ flay->insertRow(2, "User:", le);
+ // later:
+ flay->removeRow(le); // le == nullptr at this point
+ \endcode
+
+ If you want to remove the row from the layout without deleting the widgets, use takeRow() instead.
+
+ \sa takeRow()
+*/
+void QFormLayout::removeRow(QWidget *widget)
+{
+ TakeRowResult result = takeRow(widget);
+ clearQLayoutItem(result.labelItem);
+ clearQLayoutItem(result.fieldItem);
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Deletes the row corresponding to \a layout from this form layout.
+
+ After this call, rowCount() is decremented by one. All widgets and
+ nested layouts that occupied this row are deleted. That includes both
+ the field widget(s) and the label, if any. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ You can use this function to undo a previous addRow() or insertRow():
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QVBoxLayout> vbl = new QVBoxLayout;
+ flay->insertRow(2, "User:", vbl);
+ // later:
+ flay->removeRow(layout); // vbl == nullptr at this point
+ \endcode
+
+ If you want to remove the row from the form layout without deleting the inserted layout,
+ use takeRow() instead.
+
+ \sa takeRow()
+*/
+void QFormLayout::removeRow(QLayout *layout)
+{
+ TakeRowResult result = takeRow(layout);
+ clearQLayoutItem(result.labelItem);
+ clearQLayoutItem(result.fieldItem);
+}
+
+/*!
+ \since 5.8
+
+ Removes the specified \a row from this form layout.
+
+ \a row must be non-negative and less than rowCount().
+
+ \note This function doesn't delete anything.
+
+ After this call, rowCount() is decremented by one. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ You can use this function to undo a previous addRow() or insertRow():
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QLineEdit> le = new QLineEdit;
+ flay->insertRow(2, "User:", le);
+ // later:
+ QFormLayout::TakeRowResult result = flay->takeRow(2);
+ \endcode
+
+ If you want to remove the row from the layout and delete the widgets, use removeRow() instead.
+
+ \return A structure containing both the widget and
+ corresponding label layout items
+
+ \sa removeRow()
+*/
+QFormLayout::TakeRowResult QFormLayout::takeRow(int row)
+{
+ Q_D(QFormLayout);
+
+ const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(row));
+ if (Q_UNLIKELY(storageIndex == -1)) {
+ qWarning("QFormLayout::takeRow: Invalid row %d", row);
+ return TakeRowResult();
+ }
+
+ int storageRow, dummy;
+ QFormLayoutPrivate::ItemMatrix::storageIndexToPosition(storageIndex, &storageRow, &dummy);
+ Q_ASSERT(d->m_matrix(storageRow, dummy));
+
+ QFormLayoutItem *label = d->m_matrix(storageRow, 0);
+ QFormLayoutItem *field = d->m_matrix(storageRow, 1);
+
+ Q_ASSERT(field);
+
+ d->m_things.removeOne(label);
+ d->m_things.removeOne(field);
+ d->m_matrix.removeRow(storageRow);
+
+ invalidate();
+
+ TakeRowResult result;
+ result.labelItem = ownershipCleanedItem(label, this);
+ result.fieldItem = ownershipCleanedItem(field, this);
+ return result;
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Removes the specified \a widget from this form layout.
+
+ \note This function doesn't delete anything.
+
+ After this call, rowCount() is decremented by one. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QLineEdit> le = new QLineEdit;
+ flay->insertRow(2, "User:", le);
+ // later:
+ QFormLayout::TakeRowResult result = flay->takeRow(widget);
+ \endcode
+
+ If you want to remove the row from the layout and delete the widgets, use removeRow() instead.
+
+ \return A structure containing both the widget and
+ corresponding label layout items
+
+ \sa removeRow()
+*/
+QFormLayout::TakeRowResult QFormLayout::takeRow(QWidget *widget)
+{
+ Q_D(QFormLayout);
+ if (Q_UNLIKELY(!d->checkWidget(widget)))
+ return TakeRowResult();
+
+ int row;
+ ItemRole role;
+ getWidgetPosition(widget, &row, &role);
+
+ if (Q_UNLIKELY(row < 0)) {
+ qWarning("QFormLayout::takeRow: Invalid widget");
+ return TakeRowResult();
+ }
+
+ return takeRow(row);
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Removes the specified \a layout from this form layout.
+
+ \note This function doesn't delete anything.
+
+ After this call, rowCount() is decremented by one. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QVBoxLayout> vbl = new QVBoxLayout;
+ flay->insertRow(2, "User:", vbl);
+ // later:
+ QFormLayout::TakeRowResult result = flay->takeRow(widget);
+ \endcode
+
+ If you want to remove the row from the form layout and delete the inserted layout,
+ use removeRow() instead.
+
+ \return A structure containing both the widget and
+ corresponding label layout items
+
+ \sa removeRow()
+*/
+QFormLayout::TakeRowResult QFormLayout::takeRow(QLayout *layout)
+{
+ Q_D(QFormLayout);
+ if (Q_UNLIKELY(!d->checkLayout(layout)))
+ return TakeRowResult();
+
+ int row;
+ ItemRole role;
+ getLayoutPosition(layout, &row, &role);
+
+ if (Q_UNLIKELY(row < 0)) {
+ qWarning("QFormLayout::takeRow: Invalid layout");
+ return TakeRowResult();
+ }
+
+ return takeRow(row);
+}
+
/*!
\reimp
*/
@@ -1436,18 +1746,7 @@ QLayoutItem *QFormLayout::takeAt(int index)
invalidate();
- // grab ownership back from the QFormLayoutItem
- QLayoutItem *i = item->item;
- item->item = 0;
- delete item;
-
- if (QLayout *l = i->layout()) {
- // sanity check in case the user passed something weird to QObject::setParent()
- if (l->parent() == this)
- l->setParent(0);
- }
-
- return i;
+ return ownershipCleanedItem(item, this);
}
/*!
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index 8e4f7b7309..ca15ec6f9a 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -80,6 +80,11 @@ public:
};
Q_ENUM(ItemRole)
+ struct TakeRowResult {
+ QLayoutItem *labelItem;
+ QLayoutItem *fieldItem;
+ };
+
explicit QFormLayout(QWidget *parent = Q_NULLPTR);
~QFormLayout();
@@ -114,6 +119,14 @@ public:
void insertRow(int row, QWidget *widget);
void insertRow(int row, QLayout *layout);
+ void removeRow(int row);
+ void removeRow(QWidget *widget);
+ void removeRow(QLayout *layout);
+
+ TakeRowResult takeRow(int row);
+ TakeRowResult takeRow(QWidget *widget);
+ TakeRowResult takeRow(QLayout *layout);
+
void setItem(int row, ItemRole role, QLayoutItem *item);
void setWidget(int row, ItemRole role, QWidget *widget);
void setLayout(int row, ItemRole role, QLayout *layout);
@@ -153,6 +166,8 @@ private:
void resetFormAlignment();
};
+Q_DECLARE_TYPEINFO(QFormLayout::TakeRowResult, Q_PRIMITIVE_TYPE);
+
QT_END_NAMESPACE
#endif
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index df72c6c4d2..c901285d1a 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -75,7 +75,7 @@ static inline int panTouchPoints()
const int result = qEnvironmentVariableIntValue(panTouchPointVariable, &ok);
if (ok && result >= 1)
return result;
- qWarning() << "Ignoring invalid value of " << panTouchPointVariable;
+ qWarning("Ignoring invalid value of %s", panTouchPointVariable);
}
// Pan should use 1 finger on a touch screen and 2 fingers on touch pads etc.
// where 1 finger movements are used for mouse event synthetization. For now,
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index b58e7fdc9e..29df38f19c 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -746,9 +746,13 @@ void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain,
if (orientation == Qt::Vertical) {
QGridBox *sibling = vReversed ? previousBox : box;
if (sibling) {
- QWidget *wid = sibling->item()->widget();
- if (wid)
- spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() );
+ if (sibling->item()->isEmpty()) {
+ spacing = 0;
+ } else {
+ QWidget *wid = sibling->item()->widget();
+ if (wid)
+ spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top());
+ }
}
}
}
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 240f525722..86c1628e22 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -945,12 +945,7 @@ void QLayout::addChildWidget(QWidget *w)
void QLayout::setMenuBar(QWidget *widget)
{
Q_D(QLayout);
-
-#ifdef Q_OS_WINCE_WM
- if (widget && widget->size().height() > 0)
-#else
if (widget)
-#endif
addChildWidget(widget);
d->menubar = widget;
}
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index bf162249d0..7bd9e74924 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -456,12 +456,11 @@ QShortcut::QShortcut(QWidget *parent)
QShortcut::QShortcut(const QKeySequence &key, QWidget *parent,
const char *member, const char *ambiguousMember,
Qt::ShortcutContext context)
- : QObject(*new QShortcutPrivate, parent)
+ : QShortcut(parent)
{
QAPP_CHECK("QShortcut");
Q_D(QShortcut);
- Q_ASSERT(parent != 0);
d->sc_context = context;
d->sc_sequence = key;
d->redoGrab(qApp->d_func()->shortcutMap);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 3544382944..6fa74b7cc6 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1108,11 +1108,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
if (customize)
; // don't modify window flags if the user explicitly set them.
else if (type == Qt::Dialog || type == Qt::Sheet)
-#ifndef Q_OS_WINCE
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;
-#else
- flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
-#endif
else if (type == Qt::Tool)
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
else
@@ -2405,9 +2401,8 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush);
painter->restore();
} else {
- const QVector<QRect> &rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i)
- painter->fillRect(rects.at(i), brush);
+ for (const QRect &rect : rgn)
+ painter->fillRect(rect, brush);
}
}
@@ -4553,7 +4548,7 @@ const QPalette &QWidget::palette() const
if (!isEnabled()) {
data->pal.setCurrentColorGroup(QPalette::Disabled);
} else if ((!isVisible() || isActiveWindow())
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
&& !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this))
#endif
) {
@@ -8556,13 +8551,9 @@ QSize QWidgetPrivate::adjustedSize() const
#else // all others
QRect screen = QApplication::desktop()->screenGeometry(q->pos());
#endif
-#if defined (Q_OS_WINCE)
- s.setWidth(qMin(s.width(), screen.width()));
- s.setHeight(qMin(s.height(), screen.height()));
-#else
s.setWidth(qMin(s.width(), screen.width()*2/3));
s.setHeight(qMin(s.height(), screen.height()*2/3));
-#endif
+
if (QTLWExtra *extra = maybeTopData())
extra->sizeAdjusted = true;
}
@@ -9534,7 +9525,7 @@ void QWidget::focusOutEvent(QFocusEvent *)
if (focusPolicy() != Qt::NoFocus || !isWindow())
update();
-#ifndef Q_OS_IOS
+#if !defined(QT_PLATFORM_UIKIT)
// FIXME: revisit autoSIP logic, QTBUG-42906
if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled))
QGuiApplication::inputMethod()->hide();
@@ -10750,10 +10741,8 @@ void QWidget::scroll(int dx, int dy)
// Graphics View maintains its own dirty region as a list of rects;
// until we can connect item updates directly to the view, we must
// separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
- proxy->update(rect);
- }
+ for (const QRect &rect : d->dirty)
+ proxy->update(rect.translated(dx, dy));
proxy->scroll(dx, dy, proxy->subWidgetRect(this));
return;
}
@@ -10793,7 +10782,7 @@ void QWidget::scroll(int dx, int dy, const QRect &r)
// until we can connect item updates directly to the view, we must
// separately add a translated dirty region.
if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
+ for (const QRect &rect : d->dirty.translated(dx, dy) & r)
proxy->update(rect);
}
proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 9025160e5c..7a4a6d862d 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -158,7 +158,7 @@ static void showYellowThing_win(QWidget *widget, const QRegion &region, int msec
}
i = (i + 1) & 3;
- foreach (const QRect &rect, region.rects()) {
+ for (const QRect &rect : region) {
RECT winRect;
SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom());
FillRect(hdc, &winRect, brush);
@@ -1311,9 +1311,8 @@ void QWidgetBackingStore::doSync()
updateStaticContentsSize();
dirty = QRegion();
updateRequestSent = false;
- const QVector<QRect> rects(toClean.rects());
- for (int i = 0; i < rects.size(); ++i)
- tlw->d_func()->extra->proxyWidget->update(rects.at(i));
+ for (const QRect &rect : toClean)
+ tlw->d_func()->extra->proxyWidget->update(rect);
return;
}
#endif
diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.cpp b/src/widgets/kernel/qwidgetsfunctions_wince.cpp
deleted file mode 100644
index 2bf8c6563b..0000000000
--- a/src/widgets/kernel/qwidgetsfunctions_wince.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwidgetsfunctions_wince.h"
-#include <shellapi.h>
-
-QT_USE_NAMESPACE
-
-#ifndef ShellExecute
-HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd)
-{
- SHELLEXECUTEINFO info;
- info.hwnd = hwnd;
- info.lpVerb = L"Open";
- info.lpFile = file;
- info.lpParameters = params;
- info.lpDirectory = dir;
- info.nShow = showCmd;
- info.cbSize = sizeof(info);
- ShellExecuteEx(&info);
- return info.hInstApp;
-}
-#endif
-
-// Internal Qt -----------------------------------------------------
-bool qt_wince_is_platform(const QString &platformString) {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMNAME, sizeof(tszPlatform) / sizeof(wchar_t), tszPlatform, 0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
- return true;
- return false;
-}
-
-int qt_wince_get_build()
-{
- OSVERSIONINFO osvi;
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- if (GetVersionEx(&osvi))
- return osvi.dwBuildNumber;
- return 0;
-}
-
-int qt_wince_get_version()
-{
- OSVERSIONINFO osvi;
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- if (GetVersionEx(&osvi))
- return (osvi.dwMajorVersion * 10 + osvi.dwMinorVersion);
- return 0;
-}
-
-bool qt_wince_is_windows_mobile_65()
-{
- const DWORD dwFirstWM65BuildNumber = 21139;
- OSVERSIONINFO osvi;
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- if (!GetVersionEx(&osvi))
- return false;
- return osvi.dwMajorVersion > 5
- || (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion > 2 ||
- (osvi.dwMinorVersion == 2 && osvi.dwBuildNumber >= dwFirstWM65BuildNumber)));
-}
-
-bool qt_wince_is_pocket_pc() {
- return qt_wince_is_platform(QString::fromLatin1("PocketPC"));
-}
-
-bool qt_wince_is_smartphone() {
- return qt_wince_is_platform(QString::fromLatin1("Smartphone"));
-}
-bool qt_wince_is_mobile() {
- return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc());
-}
-
-bool qt_wince_is_high_dpi() {
- if (!qt_wince_is_pocket_pc())
- return false;
- HDC deviceContext = GetDC(0);
- int dpi = GetDeviceCaps(deviceContext, LOGPIXELSX);
- ReleaseDC(0, deviceContext);
- if ((dpi < 1000) && (dpi > 0))
- return dpi > 96;
- else
- return false;
-}
diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.h b/src/widgets/kernel/qwidgetsfunctions_wince.h
deleted file mode 100644
index f2c620a966..0000000000
--- a/src/widgets/kernel/qwidgetsfunctions_wince.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWIDGETSFUNCTIONS_WCE_H
-#define QWIDGETSFUNCTIONS_WCE_H
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_WINCE
-#include <QtCore/qfunctions_wince.h>
-
-#ifdef QT_BUILD_GUI_LIB
-QT_BEGIN_NAMESPACE
-QT_END_NAMESPACE
-#endif
-
-
-//WinCe 7 has shell support
-#ifndef ShellExecute
-HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd);
-#define ShellExecute(a,b,c,d,e,f) qt_wince_ShellExecute(a,b,c,d,e,f)
-#endif
-
-#endif // Q_OS_WINCE
-#endif // QWIDGETSFUNCTIONS_WCE_H
diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri
index e2d5afdeec..7cef2d14a8 100644
--- a/src/widgets/kernel/win.pri
+++ b/src/widgets/kernel/win.pri
@@ -2,6 +2,6 @@
# --------------------------------------------------------------------
INCLUDEPATH += ../3rdparty/wintab
-!wince:!winrt {
- LIBS_PRIVATE *= -lshell32
-}
+!winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi
+# Override MinGW's definition in _mingw.h
+mingw: DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600