summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-16 01:22:45 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-16 01:22:45 +0100
commit7075e291998612a3c0a530bb37a515dd07739e28 (patch)
tree4e1992498d82ee3f6f92fd6d42754c92928dd581 /src/widgets/styles
parent1161a8a62907796ea45b1877bec31e66aeef77f6 (diff)
parent3d9a40038f01bc2a3df0027a9be04e7fa3ce3850 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/widgets/styles/qstyleanimation.cpp Change-Id: Iae570895be6544de80f9c1ec309d1a08c59daff8
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp2
-rw-r--r--src/widgets/styles/qgtkstyle.cpp2
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp12
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm7
-rw-r--r--src/widgets/styles/qstyleanimation.cpp1
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp24
6 files changed, 39 insertions, 9 deletions
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))) {