summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-06 00:11:52 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-06 00:11:52 +0100
commitb86106387350f673a20d3b0a2413023f6205169b (patch)
tree2dfc079f1eecbbf9fde8733430a3a1e2f04d9a42 /src/widgets/styles
parent88918abddeb323340c4a49dda035898a740373da (diff)
parent5e8ae03578ecd0538a774505f2f7e2fc626b0ab7 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qgtkstyle.cpp30
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp7
-rw-r--r--src/widgets/styles/qgtkstyle_p_p.h2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm4
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp19
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp4
6 files changed, 35 insertions, 31 deletions
diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp
index 6d2c88bfea..9ebab8d52d 100644
--- a/src/widgets/styles/qgtkstyle.cpp
+++ b/src/widgets/styles/qgtkstyle.cpp
@@ -1881,8 +1881,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
GTK_SHADOW_IN : GTK_SHADOW_OUT;
- const QHashableLatin1Literal comboBoxPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new ?
- QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox");
+ const QHashableLatin1Literal comboBoxPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox");
// We use the gtk widget to position arrows and separators for us
GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath);
@@ -1890,8 +1889,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
d->gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
d->gtk_widget_size_allocate(gtkCombo, &geometry);
- QHashableLatin1Literal buttonPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new ?
- QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") : QHashableLatin1Literal("GtkComboBox.GtkToggleButton");
+ QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton")
+ : QHashableLatin1Literal("GtkComboBox.GtkToggleButton");
GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath);
d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
if (gtkToggleButton && (appears_as_list || comboBox->editable)) {
@@ -1900,8 +1899,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
// Draw the combo box as a line edit with a button next to it
if (comboBox->editable || appears_as_list) {
GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state;
- QHashableLatin1Literal entryPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry")
- : comboBox->editable ? QHashableLatin1Literal("GtkComboBox.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame");
+ QHashableLatin1Literal entryPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame");
GtkWidget *gtkEntry = d->gtkWidget(entryPath);
d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
QRect frameRect = option->rect;
@@ -1969,7 +1967,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
// Draw the separator between label and arrows
- QHashableLatin1Literal vSeparatorPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new
+ QHashableLatin1Literal vSeparatorPath = comboBox->editable
? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkVSeparator")
: QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkVSeparator");
@@ -2006,7 +2004,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
state = GTK_STATE_NORMAL;
QHashableLatin1Literal arrowPath("");
- if (comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new) {
+ if (comboBox->editable) {
if (appears_as_list)
arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkArrow");
else
@@ -2044,7 +2042,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (sunken) {
int xoff, yoff;
- const QHashableLatin1Literal toggleButtonPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new
+ const QHashableLatin1Literal toggleButtonPath = comboBox->editable
? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton")
: QHashableLatin1Literal("GtkComboBox.GtkToggleButton");
@@ -3812,15 +3810,19 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple
case CC_ComboBox:
if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
// We employ the gtk widget to position arrows and separators for us
- GtkWidget *gtkCombo = box->editable && QGtkStylePrivate::gtk_combo_box_entry_new ?
- d->gtkWidget("GtkComboBoxEntry") : d->gtkWidget("GtkComboBox");
+ GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry")
+ : d->gtkWidget("GtkComboBox");
d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())};
d->gtk_widget_size_allocate(gtkCombo, &geometry);
int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget);
- QHashableLatin1Literal arrowPath = box->editable && QGtkStylePrivate::gtk_combo_box_entry_new ?
- QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") : box->editable || appears_as_list ?
- QHashableLatin1Literal("GtkComboBox.GtkToggleButton") : QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow");
+ QHashableLatin1Literal arrowPath("GtkComboBoxEntry.GtkToggleButton");
+ if (!box->editable) {
+ if (appears_as_list)
+ arrowPath = "GtkComboBox.GtkToggleButton";
+ else
+ arrowPath = "GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow";
+ }
GtkWidget *arrowWidget = d->gtkWidget(arrowPath);
if (!arrowWidget)
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp
index 4d16e5b9fe..810a8995f8 100644
--- a/src/widgets/styles/qgtkstyle_p.cpp
+++ b/src/widgets/styles/qgtkstyle_p.cpp
@@ -133,7 +133,6 @@ Ptr_gtk_separator_tool_item_new QGtkStylePrivate::gtk_separator_tool_item_new =
Ptr_gtk_tree_view_new QGtkStylePrivate::gtk_tree_view_new = 0;
Ptr_gtk_combo_box_new QGtkStylePrivate::gtk_combo_box_new = 0;
Ptr_gtk_combo_box_entry_new QGtkStylePrivate::gtk_combo_box_entry_new = 0;
-Ptr_gtk_combo_box_new_with_entry QGtkStylePrivate::gtk_combo_box_new_with_entry = 0;
Ptr_gtk_progress_bar_new QGtkStylePrivate::gtk_progress_bar_new = 0;
Ptr_gtk_container_add QGtkStylePrivate::gtk_container_add = 0;
Ptr_gtk_menu_shell_append QGtkStylePrivate::gtk_menu_shell_append = 0;
@@ -411,7 +410,6 @@ void QGtkStylePrivate::resolveGtk() const
gtk_tree_view_new = (Ptr_gtk_tree_view_new)libgtk.resolve("gtk_tree_view_new");
gtk_combo_box_new = (Ptr_gtk_combo_box_new)libgtk.resolve("gtk_combo_box_new");
gtk_combo_box_entry_new = (Ptr_gtk_combo_box_entry_new)libgtk.resolve("gtk_combo_box_entry_new");
- gtk_combo_box_new_with_entry = (Ptr_gtk_combo_box_entry_new)libgtk.resolve("gtk_combo_box_new_with_entry");
gtk_range_get_adjustment = (Ptr_gtk_range_get_adjustment)libgtk.resolve("gtk_range_get_adjustment");
gtk_range_set_adjustment = (Ptr_gtk_range_set_adjustment)libgtk.resolve("gtk_range_set_adjustment");
gtk_range_set_inverted = (Ptr_gtk_range_set_inverted)libgtk.resolve("gtk_range_set_inverted");
@@ -575,10 +573,7 @@ void QGtkStylePrivate::initGtkWidgets() const
addWidget(QGtkStylePrivate::gtk_check_button_new());
addWidget(QGtkStylePrivate::gtk_radio_button_new(NULL));
addWidget(QGtkStylePrivate::gtk_combo_box_new());
- if (gtk_combo_box_entry_new)
- 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_combo_box_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
diff --git a/src/widgets/styles/qgtkstyle_p_p.h b/src/widgets/styles/qgtkstyle_p_p.h
index 643f766215..fc77aea48b 100644
--- a/src/widgets/styles/qgtkstyle_p_p.h
+++ b/src/widgets/styles/qgtkstyle_p_p.h
@@ -143,7 +143,6 @@ typedef GtkWidget* (*Ptr_gtk_menu_bar_new)(void);
typedef GtkWidget* (*Ptr_gtk_menu_new)(void);
typedef GtkWidget* (*Ptr_gtk_combo_box_new)(void);
typedef GtkWidget* (*Ptr_gtk_combo_box_entry_new)(void);
-typedef GtkWidget* (*Ptr_gtk_combo_box_new_with_entry)(void);
typedef GtkWidget* (*Ptr_gtk_toolbar_new)(void);
typedef GtkWidget* (*Ptr_gtk_spin_button_new)(GtkAdjustment*, double, int);
typedef GtkWidget* (*Ptr_gtk_button_new)(void);
@@ -380,7 +379,6 @@ public:
static Ptr_gtk_tree_view_get_column gtk_tree_view_get_column;
static Ptr_gtk_combo_box_new gtk_combo_box_new;
static Ptr_gtk_combo_box_entry_new gtk_combo_box_entry_new;
- static Ptr_gtk_combo_box_new_with_entry gtk_combo_box_new_with_entry;
static Ptr_gtk_progress_bar_new gtk_progress_bar_new;
static Ptr_gtk_container_add gtk_container_add;
static Ptr_gtk_menu_shell_append gtk_menu_shell_append;
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 00356b7468..de7bac93a0 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -4257,7 +4257,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (isIndeterminate || tdi.value < tdi.max) {
if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject)))
tdi.trackInfo.progress.phase = animation->animationStep();
- else
+ else if (opt->styleObject)
d->startAnimation(new QProgressStyleAnimation(d->animateSpeed(QMacStylePrivate::AquaProgressBar), opt->styleObject));
} else {
d->stopAnimation(opt->styleObject);
@@ -5013,6 +5013,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bgColor.blue() < 128;
if (isDarkBg)
[scroller setKnobStyle:NSScrollerKnobStyleLight];
+ else
+ [scroller setKnobStyle:NSScrollerKnobStyleDefault];
[scroller setControlSize:(tdi.kind == kThemeSmallScrollBar ? NSMiniControlSize
: NSRegularControlSize)];
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 6b9b96c171..7087e2a5ca 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -2605,14 +2605,17 @@ static void updateObjects(const QList<const QObject *>& objects)
styleSheetCaches->renderRulesCache.remove(object);
}
}
- for (int i = 0; i < objects.size(); ++i) {
- QObject *object = const_cast<QObject *>(objects.at(i));
- if (object == 0)
- continue;
- if (QWidget *widget = qobject_cast<QWidget *>(object))
- widget->style()->polish(widget);
- QEvent event(QEvent::StyleChange);
- QApplication::sendEvent(object, &event);
+
+ QWidgetList widgets;
+ foreach (const QObject *object, objects) {
+ if (QWidget *w = qobject_cast<QWidget*>(const_cast<QObject*>(object)))
+ widgets << w;
+ }
+
+ QEvent event(QEvent::StyleChange);
+ foreach (QWidget *widget, widgets) {
+ widget->style()->polish(widget);
+ QApplication::sendEvent(widget, &event);
}
}
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 4d98739f63..e9bc17f78f 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -520,7 +520,11 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
break;
case PE_Frame: {
+#ifndef QT_NO_ACCESSIBILITY
if (QStyleHelper::isInstanceOf(option->styleObject, QAccessible::EditableText)) {
+#else
+ if (false) {
+#endif
painter->save();
int stateId = ETS_NORMAL;
if (!(state & State_Enabled))