From 225dcf355a95f272aaa7ac236c7274e254dca41c Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 5 Jun 2018 14:40:36 +0200 Subject: Don't set the wasDeleted flag in ~QWidget Setting it too early can cause issues, as we are still doing lots of work here as e.g. calling hide() on children. But the flag is required when we delete the declarative data, so set and reset it when destroying that data. Amends c579f49e2a80a55a4004ff8e5b2ee76bda146387 Task-number: QTBUG-68637 Change-Id: I7ed35828c26912aa6d703ba6025e46b7911353fa Reviewed-by: Simon Hausmann Reviewed-by: Christian Stenger Reviewed-by: Friedemann Kleint --- src/widgets/graphicsview/qgraphicsitem.cpp | 2 ++ src/widgets/kernel/qwidget.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index cef1d1b6da..fdf21fb499 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1579,6 +1579,7 @@ QGraphicsItem::~QGraphicsItem() QObjectPrivate *p = QObjectPrivate::get(o); p->wasDeleted = true; if (p->declarativeData) { + p->wasDeleted = true; // needed, so that destroying the declarative data does the right thing if (static_cast(p->declarativeData)->ownedByQml1) { if (QAbstractDeclarativeData::destroyed_qml1) QAbstractDeclarativeData::destroyed_qml1(p->declarativeData, o); @@ -1587,6 +1588,7 @@ QGraphicsItem::~QGraphicsItem() QAbstractDeclarativeData::destroyed(p->declarativeData, o); } p->declarativeData = 0; + p->wasDeleted = false; } } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 41f9d69c12..5f1f6d880a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1677,8 +1677,8 @@ QWidget::~QWidget() } } - d->wasDeleted = true; if (d->declarativeData) { + d->wasDeleted = true; // needed, so that destroying the declarative data does the right thing if (static_cast(d->declarativeData)->ownedByQml1) { if (QAbstractDeclarativeData::destroyed_qml1) QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); @@ -1687,6 +1687,7 @@ QWidget::~QWidget() QAbstractDeclarativeData::destroyed(d->declarativeData, this); } d->declarativeData = 0; // don't activate again in ~QObject + d->wasDeleted = false; } d->blockSig = blocked; -- cgit v1.2.3 From f9b11bcf786eb3ab189f0402fd1b0f023910c2df Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 4 Jun 2018 15:57:05 +0200 Subject: QHeaderView: Send the StatusTip events to itself if there is no parent If there is a parent (typically an itemview) then StatusTip events should be sent to that. However in the case of there not being a parent then the event should be sent to the QHeaderView itself. Task-number: QTBUG-68458 Change-Id: I2a8c11c973210c7adf1bf29443f224f968a357a9 Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qheaderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 00e9ff7400..9a8206de45 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2725,7 +2725,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e) statusTip = d->model->headerData(logical, d->orientation, Qt::StatusTipRole).toString(); if (d->shouldClearStatusTip || !statusTip.isEmpty()) { QStatusTipEvent tip(statusTip); - QCoreApplication::sendEvent(d->parent, &tip); + QCoreApplication::sendEvent(d->parent ? d->parent : this, &tip); d->shouldClearStatusTip = !statusTip.isEmpty(); } #endif // !QT_NO_STATUSTIP -- cgit v1.2.3 From 8bd73ad989e5850b48941c7d286181c6b394b05a Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Mon, 18 Jun 2018 13:11:18 +0200 Subject: Doc: Add missing full stops in briefs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-68933 Change-Id: I3f2a9f8c562f9a44bb32bddd31d75abbfe6de04d Reviewed-by: Topi Reiniƶ --- src/widgets/widgets/qplaintextedit.cpp | 2 +- src/widgets/widgets/qtextedit.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 903a9349ec..a4c463fb5b 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -109,7 +109,7 @@ public: /*! \class QPlainTextDocumentLayout \since 4.4 - \brief The QPlainTextDocumentLayout class implements a plain text layout for QTextDocument + \brief The QPlainTextDocumentLayout class implements a plain text layout for QTextDocument. \ingroup richtext-processing \inmodule QtWidgets diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index 8a9a0eaf96..5790b1e32e 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -2049,7 +2049,7 @@ void QTextEdit::setAcceptRichText(bool accept) \inmodule QtWidgets \brief The QTextEdit::ExtraSelection structure provides a way of specifying a - character format for a given selection in a document + character format for a given selection in a document. */ /*! -- cgit v1.2.3 From c5307203f5c0b0e588cc93e70764c090dd4c2ce0 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 10 Jun 2015 16:56:27 +0300 Subject: Fix interaction with the menu bar on touchscreens Ignore synthesized mouse move events whithout the left mouse button pressed. We receive such mouse move event on touch before the mouse press event, it causes the menu to show and then the subsequent mouse press event closes the menu. Also don't propagate mouse events after closing a popup to another popup, because they may close the latter one. Change-Id: I50a2d9b57da63d33ffe416161a09f1696d65c88f Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge --- src/widgets/widgets/qmenubar.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 4758f64c8c..7c4dd896a4 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1209,8 +1209,15 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) void QMenuBar::mouseMoveEvent(QMouseEvent *e) { Q_D(QMenuBar); - if (!(e->buttons() & Qt::LeftButton)) + if (!(e->buttons() & Qt::LeftButton)) { d->mouseDown = false; + // We receive mouse move and mouse press on touch. + // Mouse move will open the menu and mouse press + // will close it, so ignore mouse move. + if (e->source() != Qt::MouseEventNotSynthesized) + return; + } + bool popupState = d->popupState || d->mouseDown; QAction *action = d->actionAt(e->pos()); if ((action && d->isVisible(action)) || !popupState) -- cgit v1.2.3 From 4d73ab73c81fff83e4423f0d3c918781587f14bf Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 23 Apr 2018 14:10:01 +0300 Subject: Return a correct filter from QFileDialog::selectedMimeTypeFilter() QFileDialog::selectedMimeTypeFilter() returns either an empty filter in the case when a platform file dialog doesn't implement mime type filters, or initiallySelectedMimeTypeFilter() in the case of Qt's file dialog. In both cases the result is incorrect. Make it return a mime type filter corresponding to a selected name filter. As a result, tst_QFiledialog::setMimeTypeFilters() has to be fixed: QFileDialog::selectMimeTypeFilter() can't select a name filter for an invalid mime type, and "application/json" is not supported by RHEL 6.6, so replace it by "application/pdf". Change-Id: I58d3be860a9b5e8a72cba86d74b520178115a812 Reviewed-by: David Faure --- src/widgets/dialogs/qfiledialog.cpp | 43 ++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 5d8ca458c2..ecd2ab6776 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -1462,19 +1462,6 @@ void QFileDialog::selectNameFilter(const QString &filter) } } -/*! - * \since 5.9 - * \return The mimetype of the file that the user selected in the file dialog. - */ -QString QFileDialog::selectedMimeTypeFilter() const -{ - Q_D(const QFileDialog); - if (!d->usingWidgets()) - return d->selectedMimeTypeFilter_sys(); - - return d->options->initiallySelectedMimeTypeFilter(); -} - /*! \since 4.4 @@ -1611,6 +1598,36 @@ void QFileDialog::selectMimeTypeFilter(const QString &filter) #endif // QT_NO_MIMETYPE +/*! + * \since 5.9 + * \return The mimetype of the file that the user selected in the file dialog. + */ +QString QFileDialog::selectedMimeTypeFilter() const +{ + Q_D(const QFileDialog); + QString mimeTypeFilter; + if (!d->usingWidgets()) + mimeTypeFilter = d->selectedMimeTypeFilter_sys(); + +#ifndef QT_NO_MIMETYPE + if (mimeTypeFilter.isNull() && !d->options->mimeTypeFilters().isEmpty()) { + const auto nameFilter = selectedNameFilter(); + const auto mimeTypes = d->options->mimeTypeFilters(); + for (const auto &mimeType: mimeTypes) { + QString filter = nameFilterForMime(mimeType); + if (testOption(HideNameFilterDetails)) + filter = qt_strip_filters({ filter }).first(); + if (filter == nameFilter) { + mimeTypeFilter = mimeType; + break; + } + } + } +#endif + + return mimeTypeFilter; +} + /*! \property QFileDialog::viewMode \brief the way files and directories are displayed in the dialog -- cgit v1.2.3 From 34d212cb02f168e59c2a5c8e95a12377a57bfb7e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 6 Jun 2018 09:08:33 +0200 Subject: QMenuBar: Account for displays that are above 0x0 If a display is placed above a primary screen which has the top left set to be 0x0, then menus that are defaulting to go up can still be displayed on that screen when the menubar is placed on the bottom of it. This ensures that this is the case and also adds a manual test to aid verification of it in the future. Change-Id: Ib657ccdc1aabfe1586c72585c087ac80a6c632c2 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmenubar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 7c4dd896a4..6df53dc4e4 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -327,7 +327,7 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) QRect screenRect = QDesktopWidgetPrivate::screenGeometry(pos + QPoint(adjustedActionRect.width() / 2, 0)); pos = QPoint(qMax(pos.x(), screenRect.x()), qMax(pos.y(), screenRect.y())); - const bool fitUp = (q->mapToGlobal(adjustedActionRect.topLeft()).y() >= popup_size.height()); + const bool fitUp = (pos.y() - popup_size.height() >= screenRect.top()); const bool fitDown = (pos.y() + popup_size.height() <= screenRect.bottom()); const bool rtl = q->isRightToLeft(); const int actionWidth = adjustedActionRect.width(); -- cgit v1.2.3