From be93c6aeb373c33e1842f001ce37ec98c9e1fb09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 7 Jan 2013 23:48:20 +0100 Subject: Don't scale 0-region or region without rects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ieb523dadc5d726e26645b3a90652be95c2707ea8 Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index bde33cdb97..5994457eb1 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -6518,6 +6518,9 @@ void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig // move to QRegion? void qt_mac_scale_region(QRegion *region, qreal scaleFactor) { + if (!region || !region->rectCount()) + return; + QVector scaledRects; scaledRects.reserve(region->rects().count()); -- cgit v1.2.3 From 90e4bc5fdf1d0177e6acbb70349d85ca303c8e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 8 Jan 2013 14:30:54 +0100 Subject: Compile in 32-bit mode. CGRect == NSRect only in 64-bit mode. Change-Id: I069b5b050ccf02654a65375c3ab0f58f7d5cc659 Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 5994457eb1..9834d830ca 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3101,7 +3101,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai CGContextScaleCTM(cg, 1, -1); CGContextTranslateCTM(cg, -rect.origin.x, -rect.origin.y); - [triangleCell drawBezelWithFrame:rect inView:[triangleCell controlView]]; + [triangleCell drawBezelWithFrame:NSRectFromCGRect(rect) inView:[triangleCell controlView]]; [NSGraphicsContext restoreGraphicsState]; CGContextRestoreGState(cg); @@ -5028,7 +5028,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex // Draw the track when hovering if (opt->activeSubControls || wasActive) { - CGRect rect = [scroller bounds]; + NSRect rect = [scroller bounds]; if (shouldExpand) { if (isHorizontal) rect.origin.y += 4.5 - expandOffset; -- cgit v1.2.3 From fd372f3866acecf31f69992d6d99fc7c965018bb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 9 Jan 2013 12:54:08 +0100 Subject: Update translucency correctly in QtWidgets. Fixes breakage introduced by cdc436ebe625153c626784a15cb224556fca3728 . Top level widgets with translucent backgrounds were invisible since opacity was set to 0. Task-number: QTBUG-28531 Change-Id: I97058ac1b971422f3bda3a5ffed479ec55bfe5d4 Reviewed-by: Joerg Bornemann --- src/widgets/kernel/qwidget.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 38d3198f2f..e0b1236679 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2080,8 +2080,15 @@ void QWidgetPrivate::setOpaque(bool opaque) void QWidgetPrivate::updateIsTranslucent() { Q_Q(QWidget); - if (QWindow *window = q->windowHandle()) - window->setOpacity(isOpaque ? qreal(1.0) : qreal(0.0)); + if (QWindow *window = q->windowHandle()) { + QSurfaceFormat format = window->format(); + const int oldAlpha = format.alphaBufferSize(); + const int newAlpha = q->testAttribute(Qt::WA_TranslucentBackground)? 8 : 0; + if (oldAlpha != newAlpha) { + format.setAlphaBufferSize(newAlpha); + window->setFormat(format); + } + } } static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush) -- cgit v1.2.3 From c40a1f6b2fb0d950bfe79ad66e36930f0282b1eb Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Sun, 6 Jan 2013 21:45:56 +0100 Subject: Use pos() if the widget is a child of a native window If the widget is embedded in a native window then pos() should be used instead of mapToGlobal() so that the right position is used. This was reproduced with the qtwinmigrate solution as the dialogs were not centered correctly. Change-Id: I2ce7771f8c1a73aa74ab11faf4f9c57b922eefab Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qdialog.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 290f0a7f65..a765e8b7ef 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -827,9 +827,12 @@ void QDialog::adjustPosition(QWidget* w) if (w) { - // Use mapToGlobal rather than geometry() in case w might - // be embedded in another application - QPoint pp = w->mapToGlobal(QPoint(0,0)); + // Use pos() if the widget is embedded into a native window + QPoint pp; + if (w->windowHandle() && w->windowHandle()->property("_q_embedded_native_parent_handle").value()) + pp = w->pos(); + else + pp = w->mapToGlobal(QPoint(0,0)); p = QPoint(pp.x() + w->width()/2, pp.y() + w->height()/ 2); } else { -- cgit v1.2.3 From 1327ded7478de7781bcfe57a2eb84dc0c749c91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Tue, 8 Jan 2013 13:07:16 +0100 Subject: Fix QVariant in a static build. The patch cases registration of QVariant handler for widgets. Task-number: QTBUG-28528 Change-Id: I645e8054bb96db0b92edf5df36f206ec1965ad40 Reviewed-by: Olivier Goffart Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qapplication.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ed6262ce93..d558813f8e 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -579,6 +579,7 @@ void QApplicationPrivate::construct() void qRegisterGuiStateMachine(); void qUnregisterGuiStateMachine(); #endif +extern void qRegisterWidgetsVariant(); /*! \fn void QApplicationPrivate::initialize() @@ -590,6 +591,9 @@ void QApplicationPrivate::initialize() QWidgetPrivate::mapper = new QWidgetMapper; QWidgetPrivate::allWidgets = new QWidgetSet; + // needed for a static build. + qRegisterWidgetsVariant(); + if (application_type != QApplicationPrivate::Tty) (void) QApplication::style(); // trigger creation of application style #ifndef QT_NO_STATEMACHINE -- cgit v1.2.3 From 3295378325c1b4567379d641f05e9eadea35040c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 10 Jan 2013 11:09:46 +0100 Subject: Minimized, maximized and fullscreen are mutually exclusive. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only if minimized does QWidgetWindow need to remember the previous state. Maybe it's OK to restore from fullscreen to maximized though. Task-number: QTBUG-29030 Change-Id: I1e2724c8811366c9536a3e372ce281e8d473a4ac Reviewed-by: J-P Nurmi Reviewed-by: Samuel Rødal --- src/widgets/kernel/qwidgetwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 78d6a293b9..e9f41be9aa 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -597,12 +597,14 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event if (QTLWExtra *tle = m_widget->d_func()->maybeTopData()) tle->normalGeometry = m_widget->geometry(); widgetState |= Qt::WindowMaximized; + widgetState &= ~(Qt::WindowMinimized | Qt::WindowFullScreen); break; case Qt::WindowFullScreen: if (effectiveState(widgetState) == Qt::WindowNoState) if (QTLWExtra *tle = m_widget->d_func()->maybeTopData()) tle->normalGeometry = m_widget->geometry(); widgetState |= Qt::WindowFullScreen; + widgetState &= ~(Qt::WindowMinimized); break; case Qt::WindowActive: // Not handled by QWindow break; -- cgit v1.2.3 From d208c8b2474d352223f78e315893ebfaa7c56ec1 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 8 Jan 2013 13:52:32 +0100 Subject: Doc: corrected typo "the the" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-28756 Spurious repetition of the definite article Trailing space issue corrected. Change-Id: I3a051f5dc291e546d8d67d6775e84b388bdc0363 Reviewed-by: Topi Reiniö Reviewed-by: Geir Vattekar --- src/widgets/doc/src/widgets-and-layouts/gallery-fusion.qdoc | 2 +- src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc | 2 +- src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc | 2 +- src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc | 2 +- src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc | 2 +- src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc | 2 +- src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-fusion.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-fusion.qdoc index 9b2b5913ba..f6c4ed9cd5 100644 --- a/src/widgets/doc/src/widgets-and-layouts/gallery-fusion.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/gallery-fusion.qdoc @@ -58,7 +58,7 @@ \table 100% \row \li \image fusion-groupbox.png - The The QGroupBox widget provides a group box frame with a title. + The QGroupBox widget provides a group box frame with a title. \li \image fusion-tabwidget.png The QTabWidget class provides a stack of tabbed widgets. \li \image fusion-frame.png diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc index fb1a02e5dc..b584582850 100644 --- a/src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/gallery-gtk.qdoc @@ -62,7 +62,7 @@ \table 100% \row \li \image gtk-groupbox.png - The The QGroupBox widget provides a group box frame with a title. + The QGroupBox widget provides a group box frame with a title. \li \image gtk-tabwidget.png The QTabWidget class provides a stack of tabbed widgets. \li \image gtk-frame.png diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc index 5db5f17974..9a0ff587a3 100644 --- a/src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/gallery-macintosh.qdoc @@ -62,7 +62,7 @@ \table 100% \row \li \image macintosh-groupbox.png - The The QGroupBox widget provides a group box frame with a title. + The QGroupBox widget provides a group box frame with a title. \li \image macintosh-tabwidget.png The QTabWidget class provides a stack of tabbed widgets. \li \image macintosh-frame.png diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc index 2505d20c3f..7fb7ea00b5 100644 --- a/src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/gallery-windows.qdoc @@ -58,7 +58,7 @@ \table 100% \row \li \image windows-groupbox.png - The The QGroupBox widget provides a group box frame with a title. + The QGroupBox widget provides a group box frame with a title. \li \image windows-tabwidget.png The QTabWidget class provides a stack of tabbed widgets. \li \image windows-frame.png diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc index 3e9b89832c..1055f2554b 100644 --- a/src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc @@ -62,7 +62,7 @@ \table 100% \row \li \image windowsvista-groupbox.png - The The QGroupBox widget provides a group box frame with a title. + The QGroupBox widget provides a group box frame with a title. \li \image windowsvista-tabwidget.png The QTabWidget class provides a stack of tabbed widgets. \li \image windowsvista-frame.png diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc index 4fad7a55bd..629a53ebed 100644 --- a/src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc @@ -62,7 +62,7 @@ \table 100% \row \li \image windowsxp-groupbox.png - The The QGroupBox widget provides a group box frame with a title. + The QGroupBox widget provides a group box frame with a title. \li \image windowsxp-tabwidget.png The QTabWidget class provides a stack of tabbed widgets. \li \image windowsxp-frame.png diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index 2d9d5bba33..a1074a9064 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -813,7 +813,7 @@ In the case of a checkable QGroupBox, the title includes the check indicator. The indicator is styled using the - the \l{#indicator-sub}{::indicator} subcontrol. The + \l{#indicator-sub}{::indicator} subcontrol. The \l{#spacing-prop}{spacing} property can be used to control the spacing between the text and indicator. -- cgit v1.2.3 From d41fbea2ba84959dd860f2a9c651e7eea260b008 Mon Sep 17 00:00:00 2001 From: Jian Liang Date: Fri, 11 Jan 2013 13:50:58 +0800 Subject: Fix memory leak in windows vista style Introduce a function named deleteClonedAnimationStyleOption() in qwindowsvistastyle.cpp to delete style option cloned by clonedAnimationStyleOption() to prevent object leak which is hold by the actual style option object. Change-Id: I1afd95ddab237059ce3460ac0b52a65de102eaa5 Reviewed-by: Joerg Bornemann Reviewed-by: Friedemann Kleint --- src/widgets/styles/qwindowsvistastyle.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 34fddde604..685b328a67 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -181,6 +181,24 @@ QStyleOption *clonedAnimationStyleOption(const QStyleOption*option) { return styleOption; } +/* \internal + Used by animations to delete cloned styleoption +*/ +void deleteClonedAnimationStyleOption(const QStyleOption *option) +{ + if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) + delete slider; + else if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast(option)) + delete spinbox; + else if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast(option)) + delete groupBox; + else if (const QStyleOptionComboBox *combo = qstyleoption_cast(option)) + delete combo; + else if (const QStyleOptionButton *button = qstyleoption_cast(option)) + delete button; + else + delete option; +} /*! \class QWindowsVistaStyle @@ -411,7 +429,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt } t->setStartTime(QTime::currentTime()); - delete styleOption; + deleteClonedAnimationStyleOption(styleOption); d->startAnimation(t); } styleObject->setProperty("_q_no_animation", false); @@ -940,7 +958,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption t->setStartTime(QTime::currentTime()); styleObject->setProperty("_q_no_animation", false); - delete styleOption; + deleteClonedAnimationStyleOption(styleOption); d->startAnimation(t); } @@ -1627,7 +1645,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle else t->setDuration(500); - delete styleOption; + deleteClonedAnimationStyleOption(styleOption); d->startAnimation(t); } if (QWindowsVistaAnimation *anim = qobject_cast(d->animation(styleObject))) { -- cgit v1.2.3 From 4d2eb3dd01620f4e26f97dca747206ddbc0840c7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 10 Jan 2013 11:28:49 +0100 Subject: QStyleAnimation: use QAbstractAnimation::DeleteWhenStopped This ensures that unexpectedly stopped (for example, when minimizing a window) style animations are removed from QCommonStyle. Task-number: QTBUG-28978 Change-Id: I1403502d85e0614d8644892a2231938c29a8c9c2 Reviewed-by: Jens Bache-Wiig Reviewed-by: Kai Koehne --- src/widgets/styles/qcommonstyle.cpp | 2 +- src/widgets/styles/qstyleanimation.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 7519d7f910..75407c11c5 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1149,7 +1149,7 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const stopAnimation(animation->target()); q->connect(animation, SIGNAL(destroyed()), SLOT(_q_removeAnimation()), Qt::UniqueConnection); animations.insert(animation->target(), animation); - animation->start(); + animation->start(QAbstractAnimation::DeleteWhenStopped); } /*! \internal */ diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 9ddcbcc511..bed3192219 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -53,7 +53,6 @@ QStyleAnimation::QStyleAnimation(QObject *target) : QAbstractAnimation(), moveToThread(target->thread()); setParent(target); } - connect(this, SIGNAL(finished()), SLOT(deleteLater())); } QStyleAnimation::~QStyleAnimation() -- cgit v1.2.3 From aa2da482fe950bc148ca3b245548a5474b0b0887 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Jan 2013 17:31:03 +0100 Subject: Docs: fix the minimum required GTK+ version The minimum GTK+ version was bumped from from 2.10 to 2.18 (sep 2009) in commit 2cce297b58ae50486094a6dcc148484a4a4bace5. Change-Id: I77a48c8a3b0955b00e399f714949d08293abbebd Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qgtkstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index 3ee242334d..33ed9e9b69 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -317,7 +317,7 @@ static GdkColor fromQColor(const QColor &color) It does this by making use of the GTK+ theme engine, ensuring that Qt applications look and feel native on these platforms. - Note: The style requires GTK+ version 2.10 or later. + Note: The style requires GTK+ version 2.18 or later. The Qt3-based "Qt" GTK+ theme engine will not work with QGtkStyle. \sa QWindowsXPStyle, QMacStyle, QWindowsStyle, QFusionStyle -- cgit v1.2.3 From b6963f109ad54c6f03b3391d57db9a536d49ba7d Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 10 Jan 2013 22:43:22 +0200 Subject: QMenu: Fix nested popup when keyboard shortcut is used Task-number: QTBUG-20403 Change-Id: I2a5fe00dd16e9dc1ec0d742a8f48083fc2954996 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart Reviewed-by: Jarek Kobus --- src/widgets/widgets/qmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 17f9ca7911..b3fc6524c5 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2722,7 +2722,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) key_consumed = true; if(d->scroll) d->scrollMenu(nextAction, QMenuPrivate::QMenuScroller::ScrollCenter, false); - d->setCurrentAction(nextAction, 20, QMenuPrivate::SelectedFromElsewhere, true); + d->setCurrentAction(nextAction, 0, QMenuPrivate::SelectedFromElsewhere, true); if (!nextAction->menu() && activateAction) { d->setSyncAction(); d->activateAction(nextAction, QAction::Trigger); -- cgit v1.2.3 From f12cc9c6489d1882058dd990383a7f43f204bbcd Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Thu, 10 Jan 2013 10:22:43 -0500 Subject: set gtk-entry im-module to none in gtkstyle in qt5, gtkstyle use gtk_widget_send_focus_change, this had a side effect that will trigger real gtk im module, if qt load the same qt and gtk im module for same input method, it will cause conflicts for qt im module. The only gtk widget have im-module property is GtkEntry and GtkTextView, since only GtkEntry is used here, we only need to override im-module for GtkEntry. gtk-im-context-none exists in gtk+ since 2.19.5, and for older version, it will also harmlessly fallback to gtk-im-context-simple. Change-Id: I4ffb93453e77c8d5db3349b084342bdca8e4a571 Reviewed-by: Liang Qi Reviewed-by: J-P Nurmi --- src/widgets/styles/qgtkstyle_p.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 782ef8d483..3ba1d07361 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -579,7 +579,17 @@ void QGtkStylePrivate::initGtkWidgets() const addWidget(QGtkStylePrivate::gtk_combo_box_entry_new()); if (gtk_combo_box_new_with_entry) addWidget(QGtkStylePrivate::gtk_combo_box_new_with_entry()); - addWidget(QGtkStylePrivate::gtk_entry_new()); + GtkWidget *entry = QGtkStylePrivate::gtk_entry_new(); + // gtk-im-context-none is supported in gtk+ since 2.19.5 + // and also exists in gtk3 + // http://git.gnome.org/browse/gtk+/tree/gtk/gtkimmulticontext.c?id=2.19.5#n33 + // reason that we don't use gtk-im-context-simple here is, + // gtk-im-context-none has less overhead, and 2.19.5 is + // relatively old. and even for older gtk+, it will fallback + // to gtk-im-context-simple if gtk-im-context-none doesn't + // exists. + g_object_set(entry, "im-module", "gtk-im-context-none", NULL); + addWidget(entry); addWidget(QGtkStylePrivate::gtk_frame_new(NULL)); addWidget(QGtkStylePrivate::gtk_expander_new("")); addWidget(QGtkStylePrivate::gtk_statusbar_new()); -- cgit v1.2.3 From 5eab554227597568a799edb9e9e01563e35e8974 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 14 Jan 2013 12:11:45 +0100 Subject: Check for existence of QWindow in QApplication::isBlockedByModal. Warn if window == 0 is passed in QApplicationPrivate::isWindowBlocked(). Task-number: QTBUG-28637 Change-Id: I1213ea371813eeb90f962cc39235ddfccc663d45 Reviewed-by: Jing Bai Reviewed-by: Joerg Bornemann --- src/widgets/kernel/qapplication.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ed6262ce93..c66a4487b4 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2217,12 +2217,17 @@ Q_WIDGETS_EXPORT bool qt_tryModalHelper(QWidget *widget, QWidget **rettop) bool QApplicationPrivate::isBlockedByModal(QWidget *widget) { widget = widget->window(); - return self->isWindowBlocked(widget->windowHandle()); + QWindow *window = widget->windowHandle(); + return window && self->isWindowBlocked(window); } bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const { QWindow *unused = 0; + if (!window) { + qWarning().nospace() << "window == 0 passed."; + return false; + } if (!blockingWindow) blockingWindow = &unused; -- cgit v1.2.3