summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-04-17 12:58:41 +0200
committerLars Knoll <lars.knoll@nokia.com>2012-04-17 12:58:52 +0200
commit64255ef6502b1144f7b0aa4b2bf62803e0d4788b (patch)
tree29bf116bfda2ccf61057115690d14f85cc9b085b /src/widgets/kernel
parent4a9fb41a7947d0bb7a47a9625603a436df288b24 (diff)
parent7e0beba891cb963a1d535bd45b0be78b43b8d07f (diff)
Merge remote-tracking branch 'origin/api_changes'
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qaction.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp12
-rw-r--r--src/widgets/kernel/qapplication.h10
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp9
-rw-r--r--src/widgets/kernel/qboxlayout.h4
-rw-r--r--src/widgets/kernel/qgridlayout.cpp10
-rw-r--r--src/widgets/kernel/qgridlayout.h2
-rw-r--r--src/widgets/kernel/qlayout.cpp13
-rw-r--r--src/widgets/kernel/qlayout.h1
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp16
-rw-r--r--src/widgets/kernel/qlayoutitem.h4
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp32
-rw-r--r--src/widgets/kernel/qstackedlayout.h2
-rw-r--r--src/widgets/kernel/qwidget.cpp16
-rw-r--r--src/widgets/kernel/qwidget.h9
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp13
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp29
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp8
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa.cpp17
19 files changed, 98 insertions, 111 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index f450d13a39..c4f7995087 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -879,7 +879,7 @@ QString QAction::statusTip() const
the action. The text may contain rich text. There is no default
"What's This?" text.
- \sa QWhatsThis Q3StyleSheet
+ \sa QWhatsThis
*/
void QAction::setWhatsThis(const QString &whatsthis)
{
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index e82f5c1531..99500998db 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -556,10 +556,6 @@ void QApplicationPrivate::process_cmdline()
\sa arguments()
*/
-QApplication::QApplication(int &argc, char **argv)
- : QGuiApplication(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000))
-{ Q_D(QApplication); d->construct(); }
-
QApplication::QApplication(int &argc, char **argv, int _internal)
: QGuiApplication(*new QApplicationPrivate(argc, argv, GuiClient, _internal))
{ Q_D(QApplication); d->construct(); }
@@ -582,10 +578,6 @@ QApplication::QApplication(int &argc, char **argv, int _internal)
\snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 0
*/
-QApplication::QApplication(int &argc, char **argv, bool GUIenabled )
- : QGuiApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, 0x040000))
-{ Q_D(QApplication); d->construct(); }
-
QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _internal)
: QGuiApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, _internal))
{ Q_D(QApplication); d->construct();}
@@ -601,10 +593,6 @@ QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _intern
be greater than zero and \a argv must contain at least one valid character
string.
*/
-QApplication::QApplication(int &argc, char **argv, Type type)
- : QGuiApplication(*new QApplicationPrivate(argc, argv, type, 0x040000))
-{ Q_D(QApplication); d->construct(); }
-
QApplication::QApplication(int &argc, char **argv, Type type , int _internal)
: QGuiApplication(*new QApplicationPrivate(argc, argv, type, _internal))
{ Q_D(QApplication); d->construct(); }
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index 31d228ddd5..206692e6d4 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -96,11 +96,9 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication
public:
-#ifndef qdoc
QApplication(int &argc, char **argv, int = ApplicationFlags);
QT_DEPRECATED QApplication(int &argc, char **argv, bool GUIenabled, int = ApplicationFlags);
QApplication(int &argc, char **argv, Type, int = ApplicationFlags);
-#endif
virtual ~QApplication();
static Type type();
@@ -223,13 +221,6 @@ protected:
bool event(QEvent *);
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
-
-#if defined(Q_INTERNAL_QAPP_SRC) || defined(qdoc)
- QApplication(int &argc, char **argv);
- QT_DEPRECATED QApplication(int &argc, char **argv, bool GUIenabled);
- QApplication(int &argc, char **argv, Type);
-#endif
-
private:
Q_DISABLE_COPY(QApplication)
Q_DECLARE_PRIVATE(QApplication)
@@ -242,7 +233,6 @@ private:
friend class QWidgetPrivate;
friend class QWidgetWindow;
friend class QETWidget;
- friend class Q3AccelManager;
friend class QTranslator;
friend class QWidgetAnimator;
#ifndef QT_NO_SHORTCUT
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index fa84e86f29..0651d5bf44 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -282,7 +282,6 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton");
setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton");
setPossiblePalette(platformTheme->palette(QPlatformTheme::HeaderPalette), "QHeaderView");
- setPossiblePalette(platformTheme->palette(QPlatformTheme::HeaderPalette), "Q3Header");
setPossiblePalette(platformTheme->palette(QPlatformTheme::ItemViewPalette), "QAbstractItemView");
setPossiblePalette(platformTheme->palette(QPlatformTheme::MessageBoxLabelPelette), "QMessageBoxLabel");
setPossiblePalette(platformTheme->palette(QPlatformTheme::TabBarPalette), "QTabBar");
@@ -317,10 +316,8 @@ void QApplicationPrivate::initializeWidgetFontHash()
fontHash->insert(QByteArrayLiteral("QTitleBar"), *font);
if (const QFont *font = theme->font(QPlatformTheme::StatusBarFont))
fontHash->insert(QByteArrayLiteral("QStatusBar"), *font);
- if (const QFont *font = theme->font(QPlatformTheme::MdiSubWindowTitleFont)) {
- fontHash->insert(QByteArrayLiteral("QWorkspaceTitleBar"), *font);
+ if (const QFont *font = theme->font(QPlatformTheme::MdiSubWindowTitleFont))
fontHash->insert(QByteArrayLiteral("QMdiSubWindowTitleBar"), *font);
- }
if (const QFont *font = theme->font(QPlatformTheme::DockWidgetTitleFont))
fontHash->insert(QByteArrayLiteral("QDockWidgetTitle"), *font);
if (const QFont *font = theme->font(QPlatformTheme::PushButtonFont))
@@ -331,10 +328,8 @@ void QApplicationPrivate::initializeWidgetFontHash()
fontHash->insert(QByteArrayLiteral("QAbstractItemView"), *font);
if (const QFont *font = theme->font(QPlatformTheme::ListViewFont))
fontHash->insert(QByteArrayLiteral("QListViewFont"), *font);
- if (const QFont *font = theme->font(QPlatformTheme::HeaderViewFont)) {
+ if (const QFont *font = theme->font(QPlatformTheme::HeaderViewFont))
fontHash->insert(QByteArrayLiteral("QHeaderViewFont"), *font);
- fontHash->insert(QByteArrayLiteral("Q3Header"), *font);
- }
if (const QFont *font = theme->font(QPlatformTheme::ListBoxFont))
fontHash->insert(QByteArrayLiteral("QListBox"), *font);
if (const QFont *font = theme->font(QPlatformTheme::ComboMenuItemFont))
diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h
index aac46ef1ec..9b1dace5ed 100644
--- a/src/widgets/kernel/qboxlayout.h
+++ b/src/widgets/kernel/qboxlayout.h
@@ -84,6 +84,7 @@ public:
void insertSpacerItem(int index, QSpacerItem *spacerItem);
void insertWidget(int index, QWidget *widget, int stretch = 0, Qt::Alignment alignment = 0);
void insertLayout(int index, QLayout *layout, int stretch = 0);
+ void insertItem(int index, QLayoutItem *);
int spacing() const;
void setSpacing(int spacing);
@@ -107,9 +108,6 @@ public:
QLayoutItem *takeAt(int);
int count() const;
void setGeometry(const QRect&);
-protected:
- // ### Qt 5: make public
- void insertItem(int index, QLayoutItem *);
private:
Q_DISABLE_COPY(QBoxLayout)
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index 3607d88d9e..c81158e0cd 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -167,9 +167,9 @@ public:
return item;
}
- void getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) {
+ void getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const {
if (index < things.count()) {
- QGridBox *b = things.at(index);
+ const QGridBox *b = things.at(index);
int toRow = b->toRow(rr);
int toCol = b->toCol(cc);
*row = b->row;
@@ -779,7 +779,7 @@ void QGridLayoutPrivate::setupLayoutData(int hSpacing, int vSpacing)
adjacent to which and compute the spacings correctly.
*/
QVarLengthArray<QGridBox *> grid(rr * cc);
- qMemSet(grid.data(), 0, rr * cc * sizeof(QGridBox *));
+ memset(grid.data(), 0, rr * cc * sizeof(QGridBox *));
/*
Initialize 'sizes' and 'grid' data structures, and insert
@@ -1347,9 +1347,9 @@ QLayoutItem *QGridLayout::takeAt(int index)
\sa itemAtPosition(), itemAt()
*/
-void QGridLayout::getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan)
+void QGridLayout::getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const
{
- Q_D(QGridLayout);
+ Q_D(const QGridLayout);
d->getItemPosition(index, row, column, rowSpan, columnSpan);
}
diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h
index 02789b7794..930fdf4511 100644
--- a/src/widgets/kernel/qgridlayout.h
+++ b/src/widgets/kernel/qgridlayout.h
@@ -120,7 +120,7 @@ public:
void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = 0);
void setDefaultPositioning(int n, Qt::Orientation orient);
- void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan);
+ void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const;
protected:
void addItem(QLayoutItem *);
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 541350c35c..8c4e988411 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -527,6 +527,19 @@ bool QLayout::isEmpty() const
/*!
\reimp
*/
+QSizePolicy::ControlTypes QLayout::controlTypes() const
+{
+ if (count() == 0)
+ return QSizePolicy::DefaultType;
+ QSizePolicy::ControlTypes types;
+ for (int i = count() - 1; i >= 0; --i)
+ types |= itemAt(i)->controlTypes();
+ return types;
+}
+
+/*!
+ \reimp
+*/
void QLayout::setGeometry(const QRect &r)
{
Q_D(QLayout);
diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h
index 5524443ab1..9a13922cb1 100644
--- a/src/widgets/kernel/qlayout.h
+++ b/src/widgets/kernel/qlayout.h
@@ -131,6 +131,7 @@ public:
virtual int indexOf(QWidget *) const;
virtual int count() const = 0;
bool isEmpty() const;
+ QSizePolicy::ControlTypes controlTypes() const;
int totalHeightForWidth(int w) const;
QSize totalMinimumSize() const;
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 814b807b82..8e08f5f39f 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -414,17 +414,6 @@ int QLayoutItem::heightForWidth(int /* w */) const
*/
QSizePolicy::ControlTypes QLayoutItem::controlTypes() const
{
- // ### Qt 5: This function should probably be virtual instead
- if (const QWidget *widget = const_cast<QLayoutItem*>(this)->widget()) {
- return widget->sizePolicy().controlType();
- } else if (const QLayout *layout = const_cast<QLayoutItem*>(this)->layout()) {
- if (layout->count() == 0)
- return QSizePolicy::DefaultType;
- QSizePolicy::ControlTypes types;
- for (int i = layout->count() - 1; i >= 0; --i)
- types |= layout->itemAt(i)->controlTypes();
- return types;
- }
return QSizePolicy::DefaultType;
}
@@ -688,6 +677,11 @@ bool QWidgetItem::isEmpty() const
return wid->isHidden() || wid->isWindow();
}
+QSizePolicy::ControlTypes QWidgetItem::controlTypes() const
+{
+ return wid->sizePolicy().controlType();
+}
+
/*!
\class QWidgetItemV2
\internal
diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h
index 76aae6f794..dacbf1ea68 100644
--- a/src/widgets/kernel/qlayoutitem.h
+++ b/src/widgets/kernel/qlayoutitem.h
@@ -83,7 +83,7 @@ public:
Qt::Alignment alignment() const { return align; }
void setAlignment(Qt::Alignment a);
- QSizePolicy::ControlTypes controlTypes() const;
+ virtual QSizePolicy::ControlTypes controlTypes() const;
protected:
Qt::Alignment align;
@@ -135,7 +135,7 @@ public:
bool hasHeightForWidth() const;
int heightForWidth(int) const;
-
+ QSizePolicy::ControlTypes controlTypes() const;
protected:
QWidget *wid;
};
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index 9b40063e65..0d2e7716e5 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -477,6 +477,38 @@ void QStackedLayout::setGeometry(const QRect &rect)
}
/*!
+ \reimp
+*/
+bool QStackedLayout::hasHeightForWidth() const
+{
+ const int n = count();
+
+ for (int i = 0; i < n; ++i) {
+ if (QLayoutItem *item = itemAt(i)) {
+ if (item->hasHeightForWidth())
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ \reimp
+*/
+int QStackedLayout::heightForWidth(int width) const
+{
+ const int n = count();
+
+ int hfw = 0;
+ for (int i = 0; i < n; ++i) {
+ if (QLayoutItem *item = itemAt(i)) {
+ hfw = qMax(hfw, item->heightForWidth(width));
+ }
+ }
+ return hfw;
+}
+
+/*!
\enum QStackedLayout::StackingMode
\since 4.4
diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h
index e54efa886e..fa77341c52 100644
--- a/src/widgets/kernel/qstackedlayout.h
+++ b/src/widgets/kernel/qstackedlayout.h
@@ -94,6 +94,8 @@ public:
QLayoutItem *itemAt(int) const;
QLayoutItem *takeAt(int);
void setGeometry(const QRect &rect);
+ bool hasHeightForWidth() const;
+ int heightForWidth(int width) const;
Q_SIGNALS:
void widgetRemoved(int index);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index ddab66944e..9abba54390 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -2892,7 +2892,7 @@ void QWidget::showNormal()
\sa setEnabled() enabled
*/
-bool QWidget::isEnabledTo(QWidget* ancestor) const
+bool QWidget::isEnabledTo(const QWidget *ancestor) const
{
const QWidget * w = this;
while (!w->testAttribute(Qt::WA_ForceDisabled)
@@ -3868,13 +3868,13 @@ void QWidget::setFixedHeight(int h)
\sa mapFrom() mapToParent() mapToGlobal() underMouse()
*/
-QPoint QWidget::mapTo(QWidget * parent, const QPoint & pos) const
+QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const
{
QPoint p = pos;
if (parent) {
const QWidget * w = this;
while (w != parent) {
- Q_ASSERT_X(w, "QWidget::mapTo(QWidget *parent, const QPoint &pos)",
+ Q_ASSERT_X(w, "QWidget::mapTo(const QWidget *parent, const QPoint &pos)",
"parent must be in parent hierarchy");
p = w->mapToParent(p);
w = w->parentWidget();
@@ -3892,13 +3892,13 @@ QPoint QWidget::mapTo(QWidget * parent, const QPoint & pos) const
\sa mapTo() mapFromParent() mapFromGlobal() underMouse()
*/
-QPoint QWidget::mapFrom(QWidget * parent, const QPoint & pos) const
+QPoint QWidget::mapFrom(const QWidget * parent, const QPoint & pos) const
{
QPoint p(pos);
if (parent) {
const QWidget * w = this;
while (w != parent) {
- Q_ASSERT_X(w, "QWidget::mapFrom(QWidget *parent, const QPoint &pos)",
+ Q_ASSERT_X(w, "QWidget::mapFrom(const QWidget *parent, const QPoint &pos)",
"parent must be in parent hierarchy");
p = w->mapFromParent(p);
@@ -5136,7 +5136,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
paintEngine->d_func()->systemClip = QRegion();
}
q->setAttribute(Qt::WA_WState_InPaintEvent, false);
- if (q->paintingActive() && !q->testAttribute(Qt::WA_PaintOutsidePaintEvent))
+ if (q->paintingActive())
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
if (paintEngine && paintEngine->autoDestruct()) {
@@ -7571,7 +7571,7 @@ bool QWidget::close()
\sa show() hide() isVisible()
*/
-bool QWidget::isVisibleTo(QWidget* ancestor) const
+bool QWidget::isVisibleTo(const QWidget *ancestor) const
{
if (!ancestor)
return isVisible();
@@ -8438,7 +8438,7 @@ void QWidget::mouseReleaseEvent(QMouseEvent *event)
void QWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
- Q_UNUSED(event)
+ Q_UNUSED(event);
}
#ifndef QT_NO_WHEELEVENT
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 64042ccc36..b7a5e26690 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -243,7 +243,7 @@ public:
void setWindowModality(Qt::WindowModality windowModality);
bool isEnabled() const;
- bool isEnabledTo(QWidget*) const;
+ bool isEnabledTo(const QWidget *) const;
bool isEnabledToTLW() const;
public Q_SLOTS:
@@ -306,8 +306,8 @@ public:
QPoint mapFromGlobal(const QPoint &) const;
QPoint mapToParent(const QPoint &) const;
QPoint mapFromParent(const QPoint &) const;
- QPoint mapTo(QWidget *, const QPoint &) const;
- QPoint mapFrom(QWidget *, const QPoint &) const;
+ QPoint mapTo(const QWidget *, const QPoint &) const;
+ QPoint mapFrom(const QWidget *, const QPoint &) const;
QWidget *window() const;
QWidget *nativeParentWidget() const;
@@ -505,8 +505,7 @@ public:
bool restoreGeometry(const QByteArray &geometry);
void adjustSize();
bool isVisible() const;
- bool isVisibleTo(QWidget*) const;
- // ### Qt 5: bool isVisibleTo(_const_ QWidget *) const
+ bool isVisibleTo(const QWidget *) const;
inline bool isHidden() const;
bool isMinimized() const;
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 6b6dd12703..a8175455b2 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -441,12 +441,12 @@ static inline QRect positionTopLevelWindow(QRect geometry, const QScreen *screen
void QWidgetPrivate::show_sys()
{
Q_Q(QWidget);
- q->setAttribute(Qt::WA_Mapped);
QWindow *window = q->windowHandle();
if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
invalidateBuffer(q->rect());
+ q->setAttribute(Qt::WA_Mapped);
if (q->isWindow() && q->windowModality() != Qt::NonModal && window) {
// add our window to the modal window list
QGuiApplicationPrivate::showModalWindow(window);
@@ -488,7 +488,6 @@ void QWidgetPrivate::show_sys()
void QWidgetPrivate::hide_sys()
{
Q_Q(QWidget);
- q->setAttribute(Qt::WA_Mapped, false);
QWindow *window = q->windowHandle();
@@ -501,6 +500,7 @@ void QWidgetPrivate::hide_sys()
}
deactivateWidgetCleanup();
+
if (!q->isWindow()) {
QWidget *p = q->parentWidget();
if (p &&p->isVisible()) {
@@ -509,8 +509,13 @@ void QWidgetPrivate::hide_sys()
return;
}
- if (window)
- window->setVisible(false);
+ invalidateBuffer(q->rect());
+
+ if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
+ q->setAttribute(Qt::WA_Mapped, false);
+ } else if (window) {
+ window->setVisible(false);
+ }
}
void QWidgetPrivate::setMaxWindowState_helper()
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index f9361cc357..2c9ad14bcf 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -869,29 +869,7 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy)
static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra)
{
- if (!tlw || !tlwExtra)
- return true;
-
-#ifdef Q_WS_X11
- // Delay the sync until we get an Expose event from X11 (initial show).
- // Qt::WA_Mapped is set to true, but the actual mapping has not yet occurred.
- // However, we must repaint immediately regardless of the state if someone calls repaint().
- if (tlwExtra->waitingForMapNotify && !tlwExtra->inRepaint)
- return true;
-#endif
-
- if (!tlw->testAttribute(Qt::WA_Mapped))
- return true;
-
- if (!tlw->isVisible()
-#ifndef Q_WS_X11
- // If we're minimized on X11, WA_Mapped will be false and we
- // will return in the case above. Some window managers on X11
- // sends us the PropertyNotify to change the minimized state
- // *AFTER* we've received the expose event, which is baaad.
- || tlw->isMinimized()
-#endif
- )
+ if (!tlw || !tlwExtra || !tlw->testAttribute(Qt::WA_Mapped) || !tlw->isVisible())
return true;
return false;
@@ -1297,6 +1275,9 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn)
return;
Q_Q(QWidget);
+ if (discardSyncRequest(q, maybeTopData()))
+ return;
+
if (q->testAttribute(Qt::WA_StaticContents)) {
if (!extra)
createExtra();
@@ -1335,7 +1316,7 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn)
QWidgetBackingStore::unflushPaint(q, toBePainted);
#endif
- if (!q->testAttribute(Qt::WA_PaintOutsidePaintEvent) && q->paintingActive())
+ if (q->paintingActive())
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
}
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index 81847681e4..f6817cec8a 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -184,12 +184,4 @@ void qRegisterWidgetsVariant()
}
Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant)
-void qUnregisterWidgetsVariant()
-{
- QVariantPrivate::unregisterHandler(QModulesPrivate::Widgets);
- qMetaTypeWidgetsHelper = 0;
-}
-Q_DESTRUCTOR_FUNCTION(qUnregisterWidgetsVariant)
-
-
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp
index 3cccc52311..d124ec768a 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa.cpp
+++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp
@@ -152,15 +152,6 @@ bool QWidgetWindow::event(QEvent *event)
handleDragEvent(event);
break;
- case QEvent::Map:
- m_widget->setAttribute(Qt::WA_Mapped);
- m_widget->d_func()->syncBackingStore();
- return true;
-
- case QEvent::Unmap:
- m_widget->setAttribute(Qt::WA_Mapped, false);
- return true;
-
case QEvent::Expose:
handleExposeEvent(static_cast<QExposeEvent *>(event));
return true;
@@ -447,7 +438,13 @@ void QWidgetWindow::handleDragEvent(QEvent *event)
void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
{
- m_widget->d_func()->syncBackingStore(event->region());
+ if (isExposed()) {
+ m_widget->setAttribute(Qt::WA_Mapped);
+ if (!event->region().isNull())
+ m_widget->d_func()->syncBackingStore(event->region());
+ } else {
+ m_widget->setAttribute(Qt::WA_Mapped, false);
+ }
}
void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event)