From ad05af534dc61b0c07b2c676d8f1ff040d9fbf7b Mon Sep 17 00:00:00 2001 From: Bjoern Breitmeyer Date: Wed, 30 Jan 2013 14:02:28 +0100 Subject: Fixed QT_NO_ACCESSIBILITY build. Change-Id: I14229753fc2e3b54da8a285ae9d27201b73e24be Reviewed-by: Friedemann Kleint --- src/widgets/styles/qstylehelper.cpp | 12 ++---------- src/widgets/styles/qstylehelper_p.h | 2 ++ 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 6d8a3ce0c3..75c74e4a88 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -86,17 +86,13 @@ qreal dpiScaled(qreal value) #endif } +#ifndef QT_NO_ACCESSIBILITY bool isInstanceOf(QObject *obj, QAccessible::Role role) { bool match = false; -#ifndef QT_NO_ACCESSIBILITY QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(obj); match = iface && iface->role() == role; delete iface; -#else - Q_UNUSED(obj) - Q_UNUSED(role) -#endif // QT_NO_ACCESSIBILITY return match; } @@ -104,19 +100,15 @@ bool isInstanceOf(QObject *obj, QAccessible::Role role) bool hasAncestor(QObject *obj, QAccessible::Role role) { bool found = false; -#ifndef QT_NO_ACCESSIBILITY QObject *parent = obj ? obj->parent() : 0; while (parent && !found) { if (isInstanceOf(parent, role)) found = true; parent = parent->parent(); } -#else - Q_UNUSED(obj) - Q_UNUSED(role) -#endif // QT_NO_ACCESSIBILITY return found; } +#endif // QT_NO_ACCESSIBILITY #ifndef QT_NO_DIAL diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h index 41f823def7..01772e765c 100644 --- a/src/widgets/styles/qstylehelper_p.h +++ b/src/widgets/styles/qstylehelper_p.h @@ -82,8 +82,10 @@ namespace QStyleHelper void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, int left = 0, int top = 0, int right = 0, int bottom = 0); +#ifndef QT_NO_ACCESSIBILITY bool isInstanceOf(QObject *obj, QAccessible::Role role); bool hasAncestor(QObject *obj, QAccessible::Role role); +#endif } -- cgit v1.2.3 From d1fe252d6a5c62b702620fc7f0b4b6b05fcfe5e6 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 12 Feb 2013 18:25:58 +0100 Subject: QSystemTrayIcon: fix the activation signal QObject::connect: No such slot QSystemTrayIcon ::emitActivated(QPlatformSystemTrayIcon::ActivationReason) Change-Id: I64dda8fb863de10d8b1d1cda1b8e6a513238b245 Reviewed-by: Christoph Schleifenbaum Reviewed-by: Friedemann Kleint --- src/widgets/util/qsystemtrayicon_qpa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/util/qsystemtrayicon_qpa.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp index 11d82b2332..113f0b68b2 100644 --- a/src/widgets/util/qsystemtrayicon_qpa.cpp +++ b/src/widgets/util/qsystemtrayicon_qpa.cpp @@ -68,7 +68,7 @@ void QSystemTrayIconPrivate::install_sys() if (qpa_sys) { qpa_sys->init(); QObject::connect(qpa_sys, SIGNAL(activated(QPlatformSystemTrayIcon::ActivationReason)), - q_func(), SLOT(emitActivated(QPlatformSystemTrayIcon::ActivationReason))); + q_func(), SLOT(_q_emitActivated(QPlatformSystemTrayIcon::ActivationReason))); QObject::connect(qpa_sys, SIGNAL(messageClicked()), q_func(), SIGNAL(messageClicked())); updateMenu_sys(); -- cgit v1.2.3 From 44f6dcf054cc8755b29060d366d57a016d6b85cc Mon Sep 17 00:00:00 2001 From: Christoph Schleifenbaum Date: Thu, 7 Feb 2013 13:07:31 +0100 Subject: Mac: Fix transient scroll bar appearance. Transient scroll bars should never be used outside of scroll areas, since they would be unusable. Task-Number: QTBUG-29389 Change-Id: Ie52d2093a4ab66085300a19ca9a1b32f13a29e79 Reviewed-by: J-P Nurmi --- src/widgets/styles/qmacstyle_mac.mm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 4bdd0a9bcb..bb9230804c 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2707,15 +2707,15 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w ret = false; break; case SH_ScrollBar_Transient: - if (!qobject_cast(w)) { - ret = false; - break; - } - ret = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7; + if ((qobject_cast(w) && w->parent() && + qobject_cast(w->parent()->parent())) || + (opt && QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ScrollBar))) { + ret = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) - ret &= [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay; + if (ret) + ret = [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay; #endif + } break; default: ret = QCommonStyle::styleHint(sh, opt, w, hret); -- cgit v1.2.3 From 17e8286fef874630cb2703bd20885c6005bf674a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 14 Feb 2013 08:35:23 +0100 Subject: Fixed mouse double click events not bubbling up to parent widgets. The bug was caused by changes b371f3f943703840d0dfbe30505018bcca06e260 and 3bb902495291c50a2f06e8e03a62a647db3e5cd4, which removed the event forwarding that QWidget::mouseDoubleClickEvent() used to do without making sure to call ignore() on the event like QWidget::mousePressEvent() does. Task-number: QTBUG-29680 Change-Id: I98af8052ad3dd1dea15d07a710aa9212ef5e4a68 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 3b9e889a9c..7209d8c9ad 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8413,7 +8413,7 @@ void QWidget::mouseReleaseEvent(QMouseEvent *event) void QWidget::mouseDoubleClickEvent(QMouseEvent *event) { - Q_UNUSED(event); + event->ignore(); } #ifndef QT_NO_WHEELEVENT -- cgit v1.2.3 From dbbb4d1654ab9deec6a940d3c7304808bd425422 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 13 Feb 2013 13:31:05 +0100 Subject: Don't generate documentation for classes which are not available The Mac specific classes in QtWidgets are currently excluded and aren't available for use in Qt 5.0.x. In Qt 5.1 they will be available via QtMacExtras, when the widgets.pri is changed then this can be removed. Change-Id: I04fbb5204cbd5658efaf24171c5f8dac10fbfd35 Reviewed-by: Jerome Pasion --- src/widgets/doc/qtwidgets.qdocconf | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf index e960ebfeba..a989ef9363 100644 --- a/src/widgets/doc/qtwidgets.qdocconf +++ b/src/widgets/doc/qtwidgets.qdocconf @@ -34,6 +34,15 @@ headerdirs += .. sourcedirs += .. \ ../../../examples/widgets/doc/src +excludefiles += ../widgets/qmacnativewidget_mac.h \ + ../widgets/qmaccocoaviewcontainer_mac.h \ + ../widgets/qcocoatoolbardelegate_mac_p.h \ + ../widgets/qcocoamenu_mac_p.h \ + ../widgets/qmaccocoaviewcontainer_mac.mm \ + ../widgets/qcocoatoolbardelegate_mac.mm \ + ../widgets/qmainwindowlayout_mac.mm \ + ../widgets/qmacnativewidget_mac.mm + exampledirs += ../../../examples/widgets \ ../../../doc/src/snippets \ ../ \ -- cgit v1.2.3 From 34c240289a8682b60d5a61670e1d330d630e1f93 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 14 Feb 2013 16:58:52 +0100 Subject: Track last visited directory for native file dialogs as well. Task-number: QTBUG-28855 Change-Id: Ia7af8540d2a453dfeabd700f44c282c48a239834 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- src/widgets/dialogs/qfiledialog.cpp | 7 +++++++ src/widgets/dialogs/qfiledialog.h | 1 + src/widgets/dialogs/qfiledialog_p.h | 1 + 3 files changed, 9 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 4023981353..240e9979d8 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -536,6 +536,7 @@ void QFileDialogPrivate::initHelper(QPlatformDialogHelper *h) QObject::connect(h, SIGNAL(filesSelected(QStringList)), d, SIGNAL(filesSelected(QStringList))); QObject::connect(h, SIGNAL(currentChanged(QString)), d, SIGNAL(currentChanged(QString))); QObject::connect(h, SIGNAL(directoryEntered(QString)), d, SIGNAL(directoryEntered(QString))); + QObject::connect(h, SIGNAL(directoryEntered(QString)), d, SLOT(_q_nativeEnterDirectory(QString))); QObject::connect(h, SIGNAL(filterSelected(QString)), d, SIGNAL(filterSelected(QString))); static_cast(h)->setOptions(options); } @@ -3112,6 +3113,12 @@ void QFileDialogPrivate::_q_fileRenamed(const QString &path, const QString oldNa } } +void QFileDialogPrivate::_q_nativeEnterDirectory(const QString &directory) +{ + if (!directory.isEmpty()) // Windows native dialogs occasionally emit signals with empty strings. + *lastVisitedDir() = directory; +} + /*! \internal diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index 84bb0fa98c..18aaa781fd 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -242,6 +242,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_updateOkButton()) Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QModelIndex &index)) Q_PRIVATE_SLOT(d_func(), void _q_enterDirectory(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_nativeEnterDirectory(const QString&)) Q_PRIVATE_SLOT(d_func(), void _q_goToDirectory(const QString &path)) Q_PRIVATE_SLOT(d_func(), void _q_useNameFilter(int index)) Q_PRIVATE_SLOT(d_func(), void _q_selectionChanged()) diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index 304eada093..ffaa2bc6f8 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -204,6 +204,7 @@ public: void _q_updateOkButton(); void _q_currentChanged(const QModelIndex &index); void _q_enterDirectory(const QModelIndex &index); + void _q_nativeEnterDirectory(const QString &directory); void _q_goToDirectory(const QString &); void _q_useNameFilter(int index); void _q_selectionChanged(); -- cgit v1.2.3 From 615d120e5a3ccbda82dfa6eeaa445c613adc7ca2 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 15 Feb 2013 18:10:42 +0100 Subject: Fix crash in somewhat faulty QGraphicsProxyWidget unit test. The crash is deep inside QGraphicsSceneIndex, which calls boundingRect() on the item that is being destroyed. The vtable is busted, resulting in a pure virtual function call. There's a more proper fix for this lying around somewhere but in this particular case we can get the test to not crash by guarding based on whether the item has a cursor set. This also happens to speed up QGraphicsItem destruction a bit so I figured it's a win-win situation to fix it. This case will still crash if the item actually had a cursor set but that makes the case even more narrow. Generally speaking, creating objects partially on the stack and partially on the heap, mixing parent/child relationships and then deleting one of the heap objects is quite sketchy and I doubt it happens much outside of this unit test. Change-Id: I25393d2cafb1256269ab6681519bd554cc380bfd Reviewed-by: Friedemann Kleint --- src/widgets/graphicsview/qgraphicsitem.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 87f5f17531..86fd3ce04a 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -2147,6 +2147,8 @@ bool QGraphicsItem::hasCursor() const */ void QGraphicsItem::unsetCursor() { + if (!d_ptr->hasCursor) + return; d_ptr->unsetExtra(QGraphicsItemPrivate::ExtraCursor); d_ptr->hasCursor = 0; if (d_ptr->scene) { -- cgit v1.2.3 From 843de37bca944110fdf3aab161d680e3845d2dd2 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 15 Feb 2013 18:04:07 +0100 Subject: Remove QGraphicsProxyWidget crash in QWidget::hasFocus(). A QGraphicsProxyWidget embeds a focusable widget (e.g., QComboBox). When deleting QGraphicsProxyWidget, the QWidget will be deleted. The QWidget clears focus, and QWidget::hasFocus() is nice enough to check if its embedder QGraphicsProxyWidget has focus - because if it does, it wants to clear focus from that item too. QGraphicsItem's destructor already calls clearFocus() however, so this call is unnecessary; we can simply stop clearing the QWidget's focus in its destructor if the widget is embedded. QWidget::hasFocus checks QGraphicsItem::hasFocus (on the proxy widget that is being deleted), which checks its d_ptr, which is gone. It's generally unfavorable for an object deleting a child to have the child go back and poke at the parent object, which is in many ways what's happening here. Task-number: QTBUG-29684 Change-Id: I1e52bf28f47b2824752de28dff2d0de13733ee48 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 7209d8c9ad..5ec713140e 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1391,6 +1391,14 @@ QWidget::~QWidget() QT_TRY { +#ifndef QT_NO_GRAPHICSVIEW + const QWidget* w = this; + while (w->d_func()->extra && w->d_func()->extra->focus_proxy) + w = w->d_func()->extra->focus_proxy; + QWidget *window = w->window(); + QWExtra *e = window ? window->d_func()->extra : 0; + if (!e || !e->proxyWidget) +#endif clearFocus(); } QT_CATCH(...) { // swallow this problem because we are in a destructor -- cgit v1.2.3