From c5e972eb87c5dbdbc0fc2ff15759ff0adaea8dfa Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 7 Dec 2015 18:15:07 +0100 Subject: QFileDialog: Call reject() on Key_Escape even when itemview has focus Replace hide() call (present in itemViewKeyboardEvent since Qt 4.5) by reject(). Add signal spy to existing test function. QDialog doc states that reject() will always be called on Key_Escape. hide() is not enough: it makes exec() terminate and return the proper value, but the signals finished(int) and rejected() will not be sent. Task-number: QTBUG-7690 Change-Id: Ica4ae2843574478c5b9a7672f871f3ef3f16f3c9 Done-with: Jan Blumschein Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qfiledialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index e62fab6f08..bdfa27282f 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -3793,7 +3793,7 @@ bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) { Q_Q(QFileDialog); if (event->matches(QKeySequence::Cancel)) { - q->hide(); + q->reject(); return true; } -- cgit v1.2.3 From b1f553b68e153ee7a5ca2b4fb9e5122e02525404 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 8 Dec 2015 09:51:33 +0100 Subject: doc: fix the shortcut for QListWidget::itemActivated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-49805 Change-Id: Ia7317e9c6ad5b5f6c17ff1e197ec690ebc20da3d Reviewed-by: Topi Reiniö --- src/widgets/itemviews/qlistwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 0e1e56e966..d4d22c8bef 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -1262,7 +1262,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, activated when the user clicks or double clicks on it, depending on the system configuration. It is also activated when the user presses the activation key (on Windows and X11 this is the \uicontrol Return key, on Mac OS - X it is \uicontrol{Ctrl+0}). + X it is \uicontrol{Command+O}). */ /*! -- cgit v1.2.3 From 1b61390856ce336c82f7b99def574775893bf4f2 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 1 Dec 2015 12:31:14 +0100 Subject: Reduce flushes with repaint() when GL-based compositing is active Task-number: QTBUG-49655 Change-Id: I7a5d08f681a7d87709aac745154730764040e922 Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qwidgetbackingstore.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index b86c376385..17187002ca 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -448,6 +448,26 @@ void QWidgetBackingStore::sendUpdateRequest(QWidget *widget, UpdateTime updateTi if (!widget) return; +#ifndef QT_NO_OPENGL + // Having every repaint() leading to a sync/flush is bad as it causes + // compositing and waiting for vsync each and every time. Change to + // UpdateLater, except for approx. once per frame to prevent starvation in + // case the control does not get back to the event loop. + QWidget *w = widget->window(); + if (updateTime == UpdateNow && w && w->windowHandle() && QWindowPrivate::get(w->windowHandle())->compositing) { + int refresh = 60; + QScreen *ws = w->windowHandle()->screen(); + if (ws) + refresh = ws->refreshRate(); + QWindowPrivate *wd = QWindowPrivate::get(w->windowHandle()); + if (wd->lastComposeTime.isValid()) { + const qint64 elapsed = wd->lastComposeTime.elapsed(); + if (elapsed <= qint64(1000.0f / refresh)) + updateTime = UpdateLater; + } + } +#endif + switch (updateTime) { case UpdateLater: updateRequestSent = true; -- cgit v1.2.3 From 01fe8906f3733622f469c3ee56b78befba3d9d61 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 7 Dec 2015 12:18:20 +0100 Subject: Fix QAction MenuRole documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib5e5353480b640f5bcc0e21682de168fadde78fc Reviewed-by: Topi Reiniö --- src/widgets/kernel/qaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 1563d020b6..31cb1915e4 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -255,7 +255,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) \value TextHeuristicRole This action should be put in the application menu based on the action's text as described in the QMenuBar documentation. \value ApplicationSpecificRole This action should be put in the application menu with an application specific role - \value AboutQtRole This action matches handles the "About Qt" menu item. + \value AboutQtRole This action handles the "About Qt" menu item. \value AboutRole This action should be placed where the "About" menu item is in the application menu. The text of the menu item will be set to "About ". The application name is fetched from the \c{Info.plist} file in the application's bundle (See \l{Qt for OS X - Deployment}). -- cgit v1.2.3 From 3414be909df60fa8a726c692b2a93f6b36a9c474 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 8 Dec 2015 10:32:39 +0100 Subject: Fix QAction::menuRole() documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9299948ba99634ea92f8b5cd4405e814e86f6aa6 Reviewed-by: Topi Reiniö --- src/widgets/kernel/qaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 31cb1915e4..2c4e4d3125 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -1231,7 +1231,7 @@ void QAction::activate(ActionEvent event) \since 4.2 This indicates what role the action serves in the application menu on Mac - OS X. By default all action have the TextHeuristicRole, which means that + OS X. By default all actions have the TextHeuristicRole, which means that the action is added based on its text (see QMenuBar for more information). The menu role can only be changed before the actions are put into the menu -- cgit v1.2.3 From 5ac2b391333d0b3047b64dd840a8109274b0fe88 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 7 Dec 2015 17:00:56 +0100 Subject: Fix URL to "The Microsoft Windows User Experience". MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-49799 Change-Id: Ie03ac06966ed97888c0a348a3f2195fd7cbd299a Reviewed-by: Leena Miettinen Reviewed-by: Topi Reiniö --- src/widgets/doc/src/guibooks.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/src/guibooks.qdoc b/src/widgets/doc/src/guibooks.qdoc index 8a1198c328..b3afe06961 100644 --- a/src/widgets/doc/src/guibooks.qdoc +++ b/src/widgets/doc/src/guibooks.qdoc @@ -76,7 +76,7 @@ advises against will produce more easily comprehensible software. Doing what it tells you to do may also help. - \b{\l{http://www.amazon.com/exec/obidos/ASIN/047159900X/trolltech/t}{The + \b{\l{http://www.amazon.com/New-Windows-Interface-Microsoft-Press/dp/1556156790/}{The Microsoft Windows User Experience}}, ISBN 1-55615-679-0, is Microsoft's look and feel bible. Indispensable for everyone who has customers that worship Microsoft, and it's quite good, too. -- cgit v1.2.3 From 0d54b0f4ddb3ec3e14f39d954eb43b10100bbce9 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 10 Dec 2015 14:58:12 +0100 Subject: QFileSystemModel: do not unwatch directories if removal fails ... otherwise we would not detect subsequent file/directories added into the non-removed one. Change-Id: I43018dfb9a9c6c0399190800da3f0d572ec5d8d8 Task-number: QTBUG-49307 Reviewed-by: David Faure --- src/widgets/dialogs/qfilesystemmodel.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 5dd8c05734..995d0c7700 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -198,13 +198,14 @@ QFileInfo QFileSystemModel::fileInfo(const QModelIndex &index) const bool QFileSystemModel::remove(const QModelIndex &aindex) { const QString path = filePath(aindex); + const bool success = QFileInfo(path).isFile() ? QFile::remove(path) : QDir(path).removeRecursively(); #ifndef QT_NO_FILESYSTEMWATCHER - QFileSystemModelPrivate * d = const_cast(d_func()); - d->fileInfoGatherer.removePath(path); + if (success) { + QFileSystemModelPrivate * d = const_cast(d_func()); + d->fileInfoGatherer.removePath(path); + } #endif - if (QFileInfo(path).isFile()) - return QFile::remove(path); - return QDir(path).removeRecursively(); + return success; } /*! @@ -1607,11 +1608,14 @@ bool QFileSystemModel::event(QEvent *event) bool QFileSystemModel::rmdir(const QModelIndex &aindex) { QString path = filePath(aindex); + const bool success = QDir().rmdir(path); #ifndef QT_NO_FILESYSTEMWATCHER - QFileSystemModelPrivate * d = const_cast(d_func()); - d->fileInfoGatherer.removePath(path); + if (success) { + QFileSystemModelPrivate * d = const_cast(d_func()); + d->fileInfoGatherer.removePath(path); + } #endif - return QDir().rmdir(path); + return success; } /*! -- cgit v1.2.3 From b6503d17955520fc4d4c598993ffe8a94b7fa20f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 9 Dec 2015 10:50:40 +0100 Subject: QWidgetBackingStore::markDirty(): Clamp dirty region to window size. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Graphics effects may exceed the window size, causing platform backing store operations to fail (see QWidgetPrivate::effectiveRectFor()). Task-number: QTBUG-49785 Change-Id: Iff16da599397d19acb86010fe7023f3ce15b6d6f Reviewed-by: Morten Johan Sørvig --- src/widgets/kernel/qwidgetbackingstore.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 17187002ca..3f7f9291b6 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -641,7 +641,11 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, const QRect widgetRect = widget->d_func()->effectiveRectFor(rect); - const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint()))); + QRect translatedRect = widgetRect; + if (widget != tlw) + translatedRect.translate(widget->mapTo(tlw, QPoint())); + // Graphics effects may exceed window size, clamp. + translatedRect = translatedRect.intersected(QRect(QPoint(), tlw->size())); if (qt_region_strictContains(dirty, translatedRect)) { if (updateTime == UpdateNow) sendUpdateRequest(tlw, updateTime); -- cgit v1.2.3 From 3b093034b638a69b4dc91212d1743638864a1337 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 10 Dec 2015 20:29:24 +0100 Subject: QFileSystemModel: report special files which are not symlinks Since special files have file size == -1, they were always filtered out by QFileSystemModel, even when passing QDir::System as filtering option. Keep them instead. The testcase is more convoluted than it should be because QFSM is so broken that it returns valid indexes for invisible elements in the model (such as filtered out elements). Change-Id: I023a9813dbfeed7be99dded42c66b1191afdc17e Task-number: QTBUG-20968 Reviewed-by: Marc Mutz --- src/widgets/dialogs/qfilesystemmodel.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 995d0c7700..d23737f130 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -1791,10 +1791,6 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QV node->fileName = fileName; } - if (info.size() == -1 && !info.isSymLink()) { - removeNode(parentNode, fileName); - continue; - } if (*node != info ) { node->populate(info); bypassFilters.remove(node); -- cgit v1.2.3 From bece6fa0b9409918ce9c57c59d61537b304c9812 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Dec 2015 10:49:47 +0100 Subject: QDockAreaLayout/QPlaceHolderItem: Store geometry excluding frame. Previously, the geometry stored for floating dock widgets in QPlaceHolderItem::topLevelRect and QDockAreaLayoutInfo::saveState() included the window frame (frame position/content area size). This does not work in the case where a floating dock widget is deleted since the geometry is determined after reparenting the widget when the frame geometry is no longer available. Change the behavior to store the geometry excluding frame to avoid such problems and adapt QDockWidgetPrivate::setWindowState() accordingly. Task-number: QTBUG-49832 Task-number: QTBUG-45780 Change-Id: I84b5c80df6e1c9e738bbb1407b9047cc84719ce0 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qdockarealayout.cpp | 3 ++- src/widgets/widgets/qdockwidget.cpp | 8 +------- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 06c20adb9d..8c79425e44 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -1816,7 +1816,8 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const stream << flags; if (w->isWindow()) { - stream << w->x() << w->y() << w->width() << w->height(); + const QRect geometry = w->geometry(); + stream << geometry.x() << geometry.y() << geometry.width() << geometry.height(); } else { stream << item.pos << item.size << pick(o, item.minimumSize()) << pick(o, item.maximumSize()); diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 292681584d..67eb466ba8 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1093,14 +1093,8 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect q->setWindowFlags(flags); - if (!rect.isNull()) { - if (floating) { - q->resize(rect.size()); - q->move(rect.topLeft()); - } else { + if (!rect.isNull()) q->setGeometry(rect); - } - } updateButtons(); -- cgit v1.2.3