diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-16 01:22:45 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-16 01:22:45 +0100 |
commit | 7075e291998612a3c0a530bb37a515dd07739e28 (patch) | |
tree | 4e1992498d82ee3f6f92fd6d42754c92928dd581 /src/widgets | |
parent | 1161a8a62907796ea45b1877bec31e66aeef77f6 (diff) | |
parent | 3d9a40038f01bc2a3df0027a9be04e7fa3ce3850 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/widgets/styles/qstyleanimation.cpp
Change-Id: Iae570895be6544de80f9c1ec309d1a08c59daff8
Diffstat (limited to 'src/widgets')
18 files changed, 74 insertions, 23 deletions
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<WId>()) + pp = w->pos(); + else + pp = w->mapToGlobal(QPoint(0,0)); p = QPoint(pp.x() + w->width()/2, pp.y() + w->height()/ 2); } else { 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. diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ed6262ce93..098a439a05 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 @@ -2217,12 +2221,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; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index ecf73ee777..c4ea213f29 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) 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; 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/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 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()); diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index bde33cdb97..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; @@ -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<QRect> scaledRects; scaledRects.reserve(region->rects().count()); diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 64cb23ca6d..a00637deb7 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE QStyleAnimation::QStyleAnimation(QObject *target) : QAbstractAnimation(target), _delay(0), _duration(-1), _startTime(QTime::currentTime()) { - connect(this, SIGNAL(finished()), SLOT(deleteLater())); } QStyleAnimation::~QStyleAnimation() 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<const QStyleOptionSlider*>(option)) + delete slider; + else if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox*>(option)) + delete spinbox; + else if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox*>(option)) + delete groupBox; + else if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox*>(option)) + delete combo; + else if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(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<QWindowsVistaAnimation *>(d->animation(styleObject))) { 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); |