diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qfiledialog.cpp | 4 | ||||
-rw-r--r-- | src/widgets/itemviews/qtreeview.cpp | 10 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 59 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore.cpp | 26 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 2 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 6 | ||||
-rw-r--r-- | src/widgets/widgets/qfocusframe.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qmainwindowlayout.cpp | 23 |
9 files changed, 82 insertions, 56 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index cdb22d71e0..7b59f96f30 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2828,7 +2828,9 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter, qFileDialogUi->sidebar->hide(); #endif - q->resize(q->sizeHint()); + const QSize sizeHint = q->sizeHint(); + if (sizeHint.isValid()) + q->resize(sizeHint); } /*! diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index fdd2be69eb..ccc7c34602 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2836,10 +2836,14 @@ void QTreeView::updateGeometries() if (d->geometryRecursionBlock) return; d->geometryRecursionBlock = true; - QSize hint = d->header->isHidden() ? QSize(0, 0) : d->header->sizeHint(); - setViewportMargins(0, hint.height(), 0, 0); + int height = 0; + if (!d->header->isHidden()) { + height = qMax(d->header->minimumHeight(), d->header->sizeHint().height()); + height = qMin(height, d->header->maximumHeight()); + } + setViewportMargins(0, height, 0, 0); QRect vg = d->viewport->geometry(); - QRect geometryRect(vg.left(), vg.top() - hint.height(), vg.width(), hint.height()); + QRect geometryRect(vg.left(), vg.top() - height, vg.width(), height); d->header->setGeometry(geometryRect); QMetaObject::invokeMethod(d->header, "updateGeometries"); d->updateScrollBars(); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 307be098ba..23ec44fec6 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1493,9 +1493,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (extra && !extra->mask.isEmpty()) setMask_sys(extra->mask); - // If widget is already shown, set window visible, too - if (q->isVisible()) + if (data.crect.width() == 0 || data.crect.height() == 0) { + q->setAttribute(Qt::WA_OutsideWSRange, true); + } else if (q->isVisible()) { + // If widget is already shown, set window visible, too win->setVisible(true); + } } #ifdef Q_OS_WIN @@ -7237,7 +7240,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (q->isWindow() || q->windowHandle()) { if (!(data.window_state & Qt::WindowFullScreen) && (w == 0 || h == 0)) { q->setAttribute(Qt::WA_OutsideWSRange, true); - if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) + if (q->isVisible()) hide_sys(); data.crect = QRect(x, y, w, h); } else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) { @@ -7954,8 +7957,10 @@ void QWidgetPrivate::show_sys() else QApplication::postEvent(q, new QUpdateLaterEvent(q->rect())); - if (!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow)) + if ((!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow)) + || q->testAttribute(Qt::WA_OutsideWSRange)) { return; + } if (window) { if (q->isWindow()) @@ -12376,21 +12381,20 @@ static inline bool canMapPosition(QWindow *window) */ QPoint QWidget::mapToGlobal(const QPoint &pos) const { - int x = pos.x(), y = pos.y(); - const QWidget *w = this; - while (w) { #ifndef QT_NO_GRAPHICSVIEW - const QWidgetPrivate *d = w->d_func(); - if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) { - const QList <QGraphicsView *> views = d->extra->proxyWidget->scene()->views(); - if (!views.isEmpty()) { - const QPointF scenePos = d->extra->proxyWidget->mapToScene(QPoint(x, y)); - const QPoint viewPortPos = views.first()->mapFromScene(scenePos); - return views.first()->viewport()->mapToGlobal(viewPortPos); - } + Q_D(const QWidget); + if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) { + const QList <QGraphicsView *> views = d->extra->proxyWidget->scene()->views(); + if (!views.isEmpty()) { + const QPointF scenePos = d->extra->proxyWidget->mapToScene(pos); + const QPoint viewPortPos = views.first()->mapFromScene(scenePos); + return views.first()->viewport()->mapToGlobal(viewPortPos); } + } #endif // !QT_NO_GRAPHICSVIEW - + int x = pos.x(), y = pos.y(); + const QWidget *w = this; + while (w) { QWindow *window = w->windowHandle(); if (window && canMapPosition(window)) return window->mapToGlobal(QPoint(x, y)); @@ -12412,21 +12416,20 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const */ QPoint QWidget::mapFromGlobal(const QPoint &pos) const { - int x = pos.x(), y = pos.y(); - const QWidget *w = this; - while (w) { #ifndef QT_NO_GRAPHICSVIEW - const QWidgetPrivate *d = w->d_func(); - if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) { - const QList <QGraphicsView *> views = d->extra->proxyWidget->scene()->views(); - if (!views.isEmpty()) { - const QPoint viewPortPos = views.first()->viewport()->mapFromGlobal(QPoint(x, y)); - const QPointF scenePos = views.first()->mapToScene(viewPortPos); - return d->extra->proxyWidget->mapFromScene(scenePos).toPoint(); - } + Q_D(const QWidget); + if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) { + const QList <QGraphicsView *> views = d->extra->proxyWidget->scene()->views(); + if (!views.isEmpty()) { + const QPoint viewPortPos = views.first()->viewport()->mapFromGlobal(pos); + const QPointF scenePos = views.first()->mapToScene(viewPortPos); + return d->extra->proxyWidget->mapFromScene(scenePos).toPoint(); } + } #endif // !QT_NO_GRAPHICSVIEW - + int x = pos.x(), y = pos.y(); + const QWidget *w = this; + while (w) { QWindow *window = w->windowHandle(); if (window && canMapPosition(window)) return window->mapFromGlobal(QPoint(x, y)); diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 98e3d32996..e6dc579f67 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -1085,7 +1085,8 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg // Nothing to repaint. if (!isDirty() && store->size().isValid()) { - qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset, widgetTexturesFor(tlw, tlw), this); + QPlatformTextureList *tl = widgetTexturesFor(tlw, exposedWidget); + qt_flush(exposedWidget, tl ? QRegion() : exposedRegion, store, tlw, tlwOffset, tl, this); return; } @@ -1256,9 +1257,17 @@ void QWidgetBackingStore::doSync() for (int i = 0; i < paintPending.count(); ++i) { QWidget *w = paintPending[i]; w->d_func()->sendPaintEvent(w->rect()); - QWidget *npw = w->nativeParentWidget(); - if (w->internalWinId() || (npw && npw != tlw)) - markDirtyOnScreen(w->rect(), w, w->mapTo(tlw, QPoint())); + if (w != tlw) { + QWidget *npw = w->nativeParentWidget(); + if (w->internalWinId() || (npw && npw != tlw)) { + if (!w->internalWinId()) + w = npw; + QWidgetPrivate *wPrivate = w->d_func(); + if (!wPrivate->needsFlush) + wPrivate->needsFlush = new QRegion; + appendDirtyOnScreenWidget(w); + } + } } // We might have newly exposed areas on the screen if this function was @@ -1283,13 +1292,8 @@ void QWidgetBackingStore::doSync() } } } - for (int i = 0; i < dirtyRenderToTextureWidgets.count(); ++i) { - QWidget *w = dirtyRenderToTextureWidgets.at(i); - resetWidget(w); - QWidget *npw = w->nativeParentWidget(); - if (w->internalWinId() || (npw && npw != tlw)) - markDirtyOnScreen(w->rect(), w, w->mapTo(tlw, QPoint())); - } + for (int i = 0; i < dirtyRenderToTextureWidgets.count(); ++i) + resetWidget(dirtyRenderToTextureWidgets.at(i)); dirtyRenderToTextureWidgets.clear(); #endif diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 3dc19133ea..6b6ca2e9cc 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -451,7 +451,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) receiver = popupChild; if (receiver != popup) widgetPos = receiver->mapFromGlobal(event->globalPos()); - QWidget *alien = receiver->childAt(receiver->mapFromGlobal(event->globalPos())); + QWidget *alien = m_widget->childAt(m_widget->mapFromGlobal(event->globalPos())); QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers(), event->source()); e.setTimestamp(event->timestamp()); diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 9cca786573..59f7fae28e 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -693,6 +693,10 @@ void QSystemTrayIconPrivate::install_sys_qpa() void QSystemTrayIconPrivate::remove_sys_qpa() { + QObject::disconnect(qpa_sys, SIGNAL(activated(QPlatformSystemTrayIcon::ActivationReason)), + q_func(), SLOT(_q_emitActivated(QPlatformSystemTrayIcon::ActivationReason))); + QObject::disconnect(qpa_sys, &QPlatformSystemTrayIcon::messageClicked, + q_func(), &QSystemTrayIcon::messageClicked); qpa_sys->cleanup(); } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index a40328f19f..2c32acf701 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2440,7 +2440,11 @@ struct IndexSetter { int index; QComboBox *cb; - void operator()(void) { cb->setCurrentIndex(index); } + void operator()(void) + { + cb->setCurrentIndex(index); + emit cb->activated(index); + } }; } diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp index c196beb738..6704631afc 100644 --- a/src/widgets/widgets/qfocusframe.cpp +++ b/src/widgets/widgets/qfocusframe.cpp @@ -256,6 +256,10 @@ void QFocusFrame::paintEvent(QPaintEvent *) { Q_D(QFocusFrame); + + if (!d->widget) + return; + QStylePainter p(this); QStyleOption option; initStyleOption(&option); diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 908aedff84..b695918406 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2258,17 +2258,18 @@ void QMainWindowLayout::setCentralWidget(QWidget *widget) QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) { #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR) - QDockWidgetGroupWindow *floatingParent = qobject_cast<QDockWidgetGroupWindow *>(widget->parentWidget()); - if (group && floatingParent && !widget->isWindow()) { - // We are just dragging a floating window as it, not need to do anything, we just have to - // look up the corresponding QWidgetItem* if it exists - QList<int> tabbedWindowPath = layoutState.indexOf(widget->parentWidget()); - return tabbedWindowPath.isEmpty() ? 0 : layoutState.item(tabbedWindowPath); - } else if (floatingParent) { - // We are unplugging a dock widget from a floating window. - if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) { - dw->d_func()->unplug(widget->geometry()); - return 0; + if (!widget->isWindow() && qobject_cast<const QDockWidgetGroupWindow *>(widget->parentWidget())) { + if (group) { + // We are just dragging a floating window as it, not need to do anything, we just have to + // look up the corresponding QWidgetItem* if it exists + QList<int> tabbedWindowPath = layoutState.indexOf(widget->parentWidget()); + return tabbedWindowPath.isEmpty() ? 0 : layoutState.item(tabbedWindowPath); + } else { + // We are unplugging a dock widget from a floating window. + if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) { + dw->d_func()->unplug(widget->geometry()); + return 0; + } } } #endif |