diff options
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qcleanlooksstyle.cpp | 1 | ||||
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 48 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle_p.cpp | 8 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle_p.h | 8 | ||||
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 68 | ||||
-rw-r--r-- | src/gui/styles/qplastiquestyle.cpp | 7 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qstylesheetstyle.cpp | 166 | ||||
-rw-r--r-- | src/gui/styles/qstylesheetstyle_default.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qstylesheetstyle_p.h | 20 | ||||
-rw-r--r-- | src/gui/styles/qwindowscestyle.cpp | 1 | ||||
-rw-r--r-- | src/gui/styles/qwindowsstyle.cpp | 6 | ||||
-rw-r--r-- | src/gui/styles/qwindowsvistastyle.cpp | 16 | ||||
-rw-r--r-- | src/gui/styles/qwindowsxpstyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/styles.pri | 2 |
16 files changed, 215 insertions, 144 deletions
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 2fbec15..8a2a88b 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -3763,6 +3763,7 @@ int QCleanlooksStyle::pixelMetric(PixelMetric metric, const QStyleOption *option break; case PM_MenuBarItemSpacing: ret = 6; + break; case PM_MenuBarHMargin: ret = 0; break; diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index de5920e..8f99d6a 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -2218,7 +2218,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (vopt->state & QStyle::State_HasFocus) { QStyleOptionFocusRect o; o.QStyleOption::operator=(*vopt); - o.rect = subElementRect(SE_ItemViewItemFocusRect, vopt, widget); + o.rect = proxy()->subElementRect(SE_ItemViewItemFocusRect, vopt, widget); o.state |= QStyle::State_KeyboardFocusChange; o.state |= QStyle::State_Item; QPalette::ColorGroup cg = (vopt->state & QStyle::State_Enabled) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 83ce5cb..277e302 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1706,12 +1706,17 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom fakePos = maximum; else if (scrollBar->sliderPosition > scrollBar->minimum) fakePos = maximum - 1; - GtkObject *adjustment = d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); - if (horizontal) - d->gtk_range_set_adjustment((GtkRange*)(gtkHScrollBar), (GtkAdjustment*)(adjustment)); - else - d->gtk_range_set_adjustment((GtkRange*)(gtkVScrollBar), (GtkAdjustment*)(adjustment)); + + GtkRange *range = (GtkRange*)(horizontal ? gtkHScrollBar : gtkVScrollBar); + GtkAdjustment *adjustment = d->gtk_range_get_adjustment(range); + + if (adjustment) { + d->gtk_adjustment_configure(adjustment, fakePos, 0, maximum, 0, 0, 0); + } else { + adjustment = (GtkAdjustment*)d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); + d->gtk_range_set_adjustment(range, adjustment); + } if (scrollBar->subControls & SC_ScrollBarGroove) { GtkStateType state = GTK_STATE_ACTIVE; @@ -1990,15 +1995,29 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom style = scaleWidget->style; if ((option->subControls & SC_SliderGroove) && groove.isValid()) { - GtkObject *adjustment = d->gtk_adjustment_new(slider->sliderPosition, - slider->minimum, - slider->maximum, - slider->singleStep, - slider->singleStep, - slider->pageStep); + + GtkRange *range = (GtkRange*)scaleWidget; + GtkAdjustment *adjustment = d->gtk_range_get_adjustment(range); + if (adjustment) { + d->gtk_adjustment_configure(adjustment, + slider->sliderPosition, + slider->minimum, + slider->maximum, + slider->singleStep, + slider->singleStep, + slider->pageStep); + } else { + adjustment = (GtkAdjustment*)d->gtk_adjustment_new(slider->sliderPosition, + slider->minimum, + slider->maximum, + slider->singleStep, + slider->singleStep, + slider->pageStep); + d->gtk_range_set_adjustment(range, adjustment); + } + int outerSize; - d->gtk_range_set_adjustment ((GtkRange*)(scaleWidget), (GtkAdjustment*)(adjustment)); - d->gtk_range_set_inverted((GtkRange*)(scaleWidget), !horizontal); + d->gtk_range_set_inverted(range, !horizontal); d->gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL); outerSize++; @@ -2998,8 +3017,7 @@ void QGtkStyle::drawControl(ControlElement element, else if (bar->progress > bar->minimum) fakePos = maximum - 1; - GtkObject *adjustment = d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); - d->gtk_progress_set_adjustment((GtkProgress*)(gtkProgressBar), (GtkAdjustment*)(adjustment)); + d->gtk_progress_configure((GtkProgress*)gtkProgressBar, fakePos, 0, maximum); QRect progressBar; diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp index 1e2dd7c..d7c53c9 100644 --- a/src/gui/styles/qgtkstyle_p.cpp +++ b/src/gui/styles/qgtkstyle_p.cpp @@ -121,7 +121,8 @@ Ptr_gtk_combo_box_entry_new QGtkStylePrivate::gtk_combo_box_entry_new = 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; -Ptr_gtk_progress_set_adjustment QGtkStylePrivate::gtk_progress_set_adjustment = 0; +Ptr_gtk_progress_configure QGtkStylePrivate::gtk_progress_configure = 0; +Ptr_gtk_range_get_adjustment QGtkStylePrivate::gtk_range_get_adjustment = 0; Ptr_gtk_range_set_adjustment QGtkStylePrivate::gtk_range_set_adjustment = 0; Ptr_gtk_range_set_inverted QGtkStylePrivate::gtk_range_set_inverted = 0; Ptr_gtk_icon_factory_lookup_default QGtkStylePrivate::gtk_icon_factory_lookup_default = 0; @@ -145,6 +146,7 @@ Ptr_gtk_paint_focus QGtkStylePrivate::gtk_paint_focus = 0; Ptr_gtk_paint_arrow QGtkStylePrivate::gtk_paint_arrow = 0; Ptr_gtk_paint_handle QGtkStylePrivate::gtk_paint_handle = 0; Ptr_gtk_paint_expander QGtkStylePrivate::gtk_paint_expander = 0; +Ptr_gtk_adjustment_configure QGtkStylePrivate::gtk_adjustment_configure = 0; Ptr_gtk_adjustment_new QGtkStylePrivate::gtk_adjustment_new = 0; Ptr_gtk_paint_hline QGtkStylePrivate::gtk_paint_hline = 0; Ptr_gtk_paint_vline QGtkStylePrivate::gtk_paint_vline = 0; @@ -376,7 +378,8 @@ void QGtkStylePrivate::resolveGtk() const gtk_entry_new = (Ptr_gtk_entry_new)libgtk.resolve("gtk_entry_new"); 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_progress_set_adjustment = (Ptr_gtk_progress_set_adjustment)libgtk.resolve("gtk_progress_set_adjustment"); + gtk_progress_configure = (Ptr_gtk_progress_configure)libgtk.resolve("gtk_progress_configure"); + 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"); gtk_container_add = (Ptr_gtk_container_add)libgtk.resolve("gtk_container_add"); @@ -405,6 +408,7 @@ void QGtkStylePrivate::resolveGtk() const gtk_paint_extension = (Ptr_gtk_paint_extension)libgtk.resolve("gtk_paint_extension"); gtk_paint_hline = (Ptr_gtk_paint_hline)libgtk.resolve("gtk_paint_hline"); gtk_paint_vline = (Ptr_gtk_paint_vline)libgtk.resolve("gtk_paint_vline"); + gtk_adjustment_configure = (Ptr_gtk_adjustment_configure)libgtk.resolve("gtk_adjustment_configure"); gtk_adjustment_new = (Ptr_gtk_adjustment_new)libgtk.resolve("gtk_adjustment_new"); gtk_menu_item_set_submenu = (Ptr_gtk_menu_item_set_submenu)libgtk.resolve("gtk_menu_item_set_submenu"); gtk_settings_get_default = (Ptr_gtk_settings_get_default)libgtk.resolve("gtk_settings_get_default"); diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h index 5cf1c59..15a98c8 100644 --- a/src/gui/styles/qgtkstyle_p.h +++ b/src/gui/styles/qgtkstyle_p.h @@ -174,8 +174,9 @@ typedef GtkWidget* (*Ptr_gtk_frame_new)(const gchar *); typedef GtkWidget* (*Ptr_gtk_expander_new)(const gchar*); typedef GtkWidget* (*Ptr_gtk_statusbar_new)(void); typedef GtkSettings* (*Ptr_gtk_settings_get_default)(void); +typedef GtkAdjustment* (*Ptr_gtk_range_get_adjustment)(GtkRange *); typedef void (*Ptr_gtk_range_set_adjustment)(GtkRange *, GtkAdjustment *); -typedef void (*Ptr_gtk_progress_set_adjustment)(GtkProgress *, GtkAdjustment *); +typedef void (*Ptr_gtk_progress_configure)(GtkProgress *, double, double, double); typedef void (*Ptr_gtk_range_set_inverted)(GtkRange*, bool); typedef void (*Ptr_gtk_container_add)(GtkContainer *container, GtkWidget *widget); typedef GtkIconSet* (*Ptr_gtk_icon_factory_lookup_default) (const gchar*); @@ -198,6 +199,7 @@ typedef void (*Ptr_gtk_paint_arrow) (GtkStyle*,GdkWindow*, GtkStateType, GtkSha typedef void (*Ptr_gtk_paint_option) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint); typedef void (*Ptr_gtk_paint_flat_box) (GtkStyle*,GdkWindow*, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint , gint , gint , gint); typedef void (*Ptr_gtk_paint_extension) (GtkStyle *, GdkWindow *, GtkStateType, GtkShadowType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint, gint, GtkPositionType); +typedef void (*Ptr_gtk_adjustment_configure) (GtkAdjustment *, double, double, double, double, double, double); typedef GtkObject* (*Ptr_gtk_adjustment_new) (double, double, double, double, double, double); typedef void (*Ptr_gtk_paint_hline) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint y); typedef void (*Ptr_gtk_paint_vline) (GtkStyle *, GdkWindow *, GtkStateType, const GdkRectangle *, GtkWidget *, const gchar *, gint, gint, gint); @@ -393,7 +395,8 @@ public: 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; - static Ptr_gtk_progress_set_adjustment gtk_progress_set_adjustment; + static Ptr_gtk_progress_configure gtk_progress_configure; + static Ptr_gtk_range_get_adjustment gtk_range_get_adjustment; static Ptr_gtk_range_set_adjustment gtk_range_set_adjustment; static Ptr_gtk_range_set_inverted gtk_range_set_inverted; static Ptr_gtk_icon_factory_lookup_default gtk_icon_factory_lookup_default; @@ -416,6 +419,7 @@ public: static Ptr_gtk_paint_arrow gtk_paint_arrow; static Ptr_gtk_paint_handle gtk_paint_handle; static Ptr_gtk_paint_expander gtk_paint_expander; + static Ptr_gtk_adjustment_configure gtk_adjustment_configure; static Ptr_gtk_adjustment_new gtk_adjustment_new; static Ptr_gtk_paint_vline gtk_paint_vline; static Ptr_gtk_paint_hline gtk_paint_hline; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 39b0eac..ac05789 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1566,8 +1566,7 @@ void QMacStylePrivate::timerEvent(QTimerEvent *) progressBars.removeAt(i); } else { if (QProgressBar *pb = qobject_cast<QProgressBar *>(maybeProgress)) { - if (pb->maximum() == 0 || pb->value() > 0 - && pb->value() < pb->maximum()) { + if (pb->maximum() == 0 || (pb->value() > 0 && pb->value() < pb->maximum())) { if (doAnimate(AquaProgressBar)) pb->update(); } @@ -1642,7 +1641,7 @@ bool QMacStylePrivate::eventFilter(QObject *o, QEvent *e) case QEvent::FocusOut: case QEvent::Show: case QEvent::WindowActivate: { - QList<QPushButton *> list = qFindChildren<QPushButton *>(btn->window()); + QList<QPushButton *> list = btn->window()->findChildren<QPushButton *>(); for (int i = 0; i < list.size(); ++i) { QPushButton *pBtn = list.at(i); if ((e->type() == QEvent::FocusOut @@ -1948,10 +1947,9 @@ void QMacStyle::unpolish(QWidget* w) rubber->setAttribute(Qt::WA_NoSystemBackground, true); } - if (QFocusFrame *frame = qobject_cast<QFocusFrame *>(w)) { + if (QFocusFrame *frame = qobject_cast<QFocusFrame *>(w)) frame->setAttribute(Qt::WA_NoSystemBackground, true); - frame->setAutoFillBackground(true); - } + QWindowsStyle::unpolish(w); } @@ -3609,7 +3607,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter break; } } - bool stretchTabs = (!verticalTabs && tabRect.height() > 22 || verticalTabs && tabRect.width() > 22); + bool stretchTabs = (!verticalTabs && tabRect.height() > 22) || (verticalTabs && tabRect.width() > 22); switch (tp) { case QStyleOptionTab::Beginning: @@ -4034,7 +4032,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter bdi.version = qt_mac_hitheme_version; bdi.state = kThemeMenuBarNormal; bdi.attributes = 0; - HIRect hirect = qt_hirectForQRect(mi->rect); HIThemeDrawMenuBarBackground(&menuRect, &bdi, cg, kHIThemeOrientationNormal); } @@ -5336,8 +5333,8 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op case SC_GroupBoxCheckBox: { // Cheat and use the smaller font if we need to bool checkable = groupBox->subControls & SC_GroupBoxCheckBox; - bool fontIsSet = (widget && widget->testAttribute(Qt::WA_SetFont) - || !QApplication::desktopSettingsAware()); + bool fontIsSet = (widget && widget->testAttribute(Qt::WA_SetFont)) + || !QApplication::desktopSettingsAware(); int tw; int h; int margin = flat || hasNoText ? 0 : 12; @@ -5540,6 +5537,57 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, // hack to work around horrible sizeHint() code in QAbstractSpinBox sz.setHeight(sz.height() - 3); break; + case QStyle::CT_TabWidget: + // the size between the pane and the "contentsRect" (+4,+4) + // (the "contentsRect" is on the inside of the pane) + sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget); + /** + This is supposed to show the relationship between the tabBar and + the stack widget of a QTabWidget. + Unfortunately ascii is not a good way of representing graphics..... + PS: The '=' line is the painted frame. + + top ---+ + | + | + | + | vvv just outside the painted frame is the "pane" + - -|- - - - - - - - - - <-+ + TAB BAR +=====^============ | +2 pixels + - - -|- - -|- - - - - - - <-+ + | | ^ ^^^ just inside the painted frame is the "contentsRect" + | | | + | overlap | + | | | + bottom ------+ <-+ +14 pixels + | + v + ------------------------------ <- top of stack widget + + + To summarize: + * 2 is the distance between the pane and the contentsRect + * The 14 and the 1's are the distance from the contentsRect to the stack widget. + (same value as used in SE_TabWidgetTabContents) + * overlap is how much the pane should overlap the tab bar + */ + // then add the size between the stackwidget and the "contentsRect" + + if (const QStyleOptionTabWidgetFrame *twf + = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { + QSize extra(0,0); + const int overlap = pixelMetric(PM_TabBarBaseOverlap, opt, widget); + const int gapBetweenTabbarAndStackWidget = 2 + 14 - overlap; + + if (getTabDirection(twf->shape) == kThemeTabNorth || getTabDirection(twf->shape) == kThemeTabSouth) { + extra = QSize(2, gapBetweenTabbarAndStackWidget + 1); + } else { + extra = QSize(gapBetweenTabbarAndStackWidget + 1, 2); + } + sz+= extra; + } + + break; case QStyle::CT_TabBarTab: if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget); diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 3698818..02ce60e 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -1054,7 +1054,7 @@ void QPlastiqueStylePrivate::drawPartialFrame(QPainter *painter, const QStyleOpt bool reverse = option->direction == Qt::RightToLeft; QStyleOptionFrame frameOpt; #ifndef QT_NO_LINEEDIT - if (QLineEdit *lineedit = qFindChild<QLineEdit *>(widget)) + if (QLineEdit *lineedit = widget->findChild<QLineEdit *>()) frameOpt.initFrom(lineedit); #else Q_UNUSED(widget) @@ -1362,11 +1362,8 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption if (const QStyleOptionFrame *lineEdit = qstyleoption_cast<const QStyleOptionFrame *>(option)) { // Panel of a line edit inside combo box or spin box is drawn in CC_ComboBox and CC_SpinBox if (widget) { -#ifndef QT_NO_COMBOBOX - if (qobject_cast<const QComboBox *>(widget->parentWidget())) - break; -#endif #ifndef QT_NO_SPINBOX + // Spinbox doesn't need a separate palette for the lineedit if (qobject_cast<const QAbstractSpinBox *>(widget->parentWidget())) break; #endif diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 38a4b7c..ecc2539 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1419,7 +1419,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, bool isScrollBarVisible = false; int scrollBarWidth = 0; - QList<QScrollBar *> scrollBars = qFindChildren<QScrollBar *>(widget); + QList<QScrollBar *> scrollBars = widget->findChildren<QScrollBar *>(); for (int i = 0; i < scrollBars.size(); ++i) { QScrollBar *scrollBar = scrollBars.at(i); if (scrollBar && scrollBar->orientation() == Qt::Vertical) { diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index a4e7c38..ecf924c 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -99,14 +99,7 @@ public: }; -static QHash<const QWidget *, QVector<StyleRule> > *styleRulesCache = 0; -static QHash<const QWidget *, QHash<int, bool> > *hasStyleRuleCache = 0; -typedef QHash<int, QHash<quint64, QRenderRule> > QRenderRules; -static QHash<const QWidget *, QRenderRules> *renderRulesCache = 0; -static QHash<const QWidget *, QPalette> *customPaletteWidgets = 0; // widgets whose palette we tampered -static QHash<const void *, StyleSheet> *styleSheetCache = 0; // parsed style sheets -static QSet<const QWidget *> *autoFillDisabledWidgets = 0; - +static QStyleSheetStyleCaches *styleSheetCaches = 0; /* RECURSION_GUARD: * the QStyleSheetStyle is a proxy. If used with others proxy style, we may end up with something like: @@ -1525,8 +1518,8 @@ private: QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const { - QHash<const QWidget *, QVector<StyleRule> >::const_iterator cacheIt = styleRulesCache->constFind(w); - if (cacheIt != styleRulesCache->constEnd()) + QHash<const QWidget *, QVector<StyleRule> >::const_iterator cacheIt = styleSheetCaches->styleRulesCache.constFind(w); + if (cacheIt != styleSheetCaches->styleRulesCache.constEnd()) return cacheIt.value(); if (!initWidget(w)) { @@ -1536,12 +1529,12 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const QStyleSheetStyleSelector styleSelector; StyleSheet defaultSs; - QHash<const void *, StyleSheet>::const_iterator defaultCacheIt = styleSheetCache->constFind(baseStyle()); - if (defaultCacheIt == styleSheetCache->constEnd()) { + QHash<const void *, StyleSheet>::const_iterator defaultCacheIt = styleSheetCaches->styleSheetCache.constFind(baseStyle()); + if (defaultCacheIt == styleSheetCaches->styleSheetCache.constEnd()) { defaultSs = getDefaultStyleSheet(); QStyle *bs = baseStyle(); - styleSheetCache->insert(bs, defaultSs); - QObject::connect(bs, SIGNAL(destroyed(QObject*)), this, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection); + styleSheetCaches->styleSheetCache.insert(bs, defaultSs); + QObject::connect(bs, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection); } else { defaultSs = defaultCacheIt.value(); } @@ -1549,8 +1542,8 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const if (!qApp->styleSheet().isEmpty()) { StyleSheet appSs; - QHash<const void *, StyleSheet>::const_iterator appCacheIt = styleSheetCache->constFind(qApp); - if (appCacheIt == styleSheetCache->constEnd()) { + QHash<const void *, StyleSheet>::const_iterator appCacheIt = styleSheetCaches->styleSheetCache.constFind(qApp); + if (appCacheIt == styleSheetCaches->styleSheetCache.constEnd()) { QString ss = qApp->styleSheet(); if (ss.startsWith(QLatin1String("file:///"))) ss.remove(0, 8); @@ -1559,7 +1552,7 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const qWarning("Could not parse application stylesheet"); appSs.origin = StyleSheetOrigin_Inline; appSs.depth = 1; - styleSheetCache->insert(qApp, appSs); + styleSheetCaches->styleSheetCache.insert(qApp, appSs); } else { appSs = appCacheIt.value(); } @@ -1571,8 +1564,8 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const if (wid->styleSheet().isEmpty()) continue; StyleSheet ss; - QHash<const void *, StyleSheet>::const_iterator widCacheIt = styleSheetCache->constFind(wid); - if (widCacheIt == styleSheetCache->constEnd()) { + QHash<const void *, StyleSheet>::const_iterator widCacheIt = styleSheetCaches->styleSheetCache.constFind(wid); + if (widCacheIt == styleSheetCaches->styleSheetCache.constEnd()) { parser.init(wid->styleSheet()); if (!parser.parse(&ss)) { parser.init(QLatin1String("* {") + wid->styleSheet() + QLatin1Char('}')); @@ -1580,7 +1573,7 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const qWarning("Could not parse stylesheet of widget %p", wid); } ss.origin = StyleSheetOrigin_Inline; - styleSheetCache->insert(wid, ss); + styleSheetCaches->styleSheetCache.insert(wid, ss); } else { ss = widCacheIt.value(); } @@ -1595,7 +1588,7 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const StyleSelector::NodePtr n; n.ptr = (void *)w; QVector<QCss::StyleRule> rules = styleSelector.styleRulesForNode(n); - styleRulesCache->insert(w, rules); + styleSheetCaches->styleRulesCache.insert(w, rules); return rules; } @@ -1724,7 +1717,7 @@ static void qt_check_if_internal_widget(const QWidget **w, int *element) QRenderRule QStyleSheetStyle::renderRule(const QWidget *w, int element, quint64 state) const { qt_check_if_internal_widget(&w, &element); - QHash<quint64, QRenderRule> &cache = (*renderRulesCache)[w][element]; + QHash<quint64, QRenderRule> &cache = styleSheetCaches->renderRulesCache[w][element]; QHash<quint64, QRenderRule>::const_iterator cacheIt = cache.constFind(state); if (cacheIt != cache.constEnd()) return cacheIt.value(); @@ -2035,7 +2028,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QWidget *w, const QStyleOption *o bool QStyleSheetStyle::hasStyleRule(const QWidget *w, int part) const { - QHash<int, bool> &cache = (*hasStyleRuleCache)[w]; + QHash<int, bool> &cache = styleSheetCaches->hasStyleRuleCache[w]; QHash<int, bool>::const_iterator cacheIt = cache.constFind(part); if (cacheIt != cache.constEnd()) return cacheIt.value(); @@ -2342,7 +2335,7 @@ static QWidget *embeddedWidget(QWidget *w) #ifndef QT_NO_SPINBOX if (QAbstractSpinBox *sb = qobject_cast<QAbstractSpinBox *>(w)) - return qFindChild<QLineEdit *>(sb); + return sb->findChild<QLineEdit *>(); #endif #ifndef QT_NO_SCROLLAREA @@ -2565,7 +2558,7 @@ void QStyleSheetStyle::setPalette(QWidget *w) rule.configurePalette(&p, map[i].group, ew, ew != w); } - customPaletteWidgets->insert(w, w->palette()); + styleSheetCaches->customPaletteWidgets.insert(w, w->palette()); w->setPalette(p); if (ew != w) ew->setPalette(p); @@ -2573,32 +2566,32 @@ void QStyleSheetStyle::setPalette(QWidget *w) void QStyleSheetStyle::unsetPalette(QWidget *w) { - if (customPaletteWidgets->contains(w)) { - QPalette p = customPaletteWidgets->value(w); + if (styleSheetCaches->customPaletteWidgets.contains(w)) { + QPalette p = styleSheetCaches->customPaletteWidgets.value(w); w->setPalette(p); QWidget *ew = embeddedWidget(w); if (ew != w) ew->setPalette(p); - customPaletteWidgets->remove(w); + styleSheetCaches->customPaletteWidgets.remove(w); } QVariant oldFont = w->property("_q_styleSheetWidgetFont"); if (oldFont.isValid()) { - w->setFont(qVariantValue<QFont>(oldFont)); + w->setFont(qvariant_cast<QFont>(oldFont)); } - if (autoFillDisabledWidgets->contains(w)) { + if (styleSheetCaches->autoFillDisabledWidgets.contains(w)) { embeddedWidget(w)->setAutoFillBackground(true); - autoFillDisabledWidgets->remove(w); + styleSheetCaches->autoFillDisabledWidgets.remove(w); } } static void updateWidgets(const QList<const QWidget *>& widgets) { - if (!styleRulesCache->isEmpty() || !hasStyleRuleCache->isEmpty() || !renderRulesCache->isEmpty()) { + if (!styleSheetCaches->styleRulesCache.isEmpty() || !styleSheetCaches->hasStyleRuleCache.isEmpty() || !styleSheetCaches->renderRulesCache.isEmpty()) { for (int i = 0; i < widgets.size(); ++i) { const QWidget *widget = widgets.at(i); - styleRulesCache->remove(widget); - hasStyleRuleCache->remove(widget); - renderRulesCache->remove(widget); + styleSheetCaches->styleRulesCache.remove(widget); + styleSheetCaches->hasStyleRuleCache.remove(widget); + styleSheetCaches->renderRulesCache.remove(widget); } } for (int i = 0; i < widgets.size(); ++i) { @@ -2622,12 +2615,7 @@ QStyleSheetStyle::QStyleSheetStyle(QStyle *base) { ++numinstances; if (numinstances == 1) { - styleRulesCache = new QHash<const QWidget *, QVector<StyleRule> >; - hasStyleRuleCache = new QHash<const QWidget *, QHash<int, bool> >; - renderRulesCache = new QHash<const QWidget *, QRenderRules>; - customPaletteWidgets = new QHash<const QWidget *, QPalette>; - styleSheetCache = new QHash<const void *, StyleSheet>; - autoFillDisabledWidgets = new QSet<const QWidget *>; + styleSheetCaches = new QStyleSheetStyleCaches; } } @@ -2635,18 +2623,7 @@ QStyleSheetStyle::~QStyleSheetStyle() { --numinstances; if (numinstances == 0) { - delete styleRulesCache; - styleRulesCache = 0; - delete hasStyleRuleCache; - hasStyleRuleCache = 0; - delete renderRulesCache; - renderRulesCache = 0; - delete customPaletteWidgets; - customPaletteWidgets = 0; - delete styleSheetCache; - styleSheetCache = 0; - delete autoFillDisabledWidgets; - autoFillDisabledWidgets = 0; + delete styleSheetCaches; } } QStyle *QStyleSheetStyle::baseStyle() const @@ -2658,19 +2635,19 @@ QStyle *QStyleSheetStyle::baseStyle() const return QApplication::style(); } -void QStyleSheetStyle::widgetDestroyed(QObject *o) +void QStyleSheetStyleCaches::widgetDestroyed(QObject *o) { - styleRulesCache->remove((const QWidget *)o); - hasStyleRuleCache->remove((const QWidget *)o); - renderRulesCache->remove((const QWidget *)o); - customPaletteWidgets->remove((const QWidget *)o); - styleSheetCache->remove((const QWidget *)o); - autoFillDisabledWidgets->remove((const QWidget *)o); + styleRulesCache.remove((const QWidget *)o); + hasStyleRuleCache.remove((const QWidget *)o); + renderRulesCache.remove((const QWidget *)o); + customPaletteWidgets.remove((const QWidget *)o); + styleSheetCache.remove((const QWidget *)o); + autoFillDisabledWidgets.remove((const QWidget *)o); } -void QStyleSheetStyle::styleDestroyed(QObject *o) +void QStyleSheetStyleCaches::styleDestroyed(QObject *o) { - styleSheetCache->remove(o); + styleSheetCache.remove(o); } /*! @@ -2688,7 +2665,7 @@ bool QStyleSheetStyle::initWidget(const QWidget *w) const return false; const_cast<QWidget *>(w)->setAttribute(Qt::WA_StyleSheet, true); - QObject::connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(widgetDestroyed(QObject*))); + QObject::connect(w, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(widgetDestroyed(QObject*)), Qt::UniqueConnection); return true; } @@ -2700,12 +2677,12 @@ void QStyleSheetStyle::polish(QWidget *w) if (!initWidget(w)) return; - if (styleRulesCache->contains(w)) { + if (styleSheetCaches->styleRulesCache.contains(w)) { // the widget accessed its style pointer before polish (or repolish) // (exemple: the QAbstractSpinBox constructor ask for the stylehint) - styleRulesCache->remove(w); - hasStyleRuleCache->remove(w); - renderRulesCache->remove(w); + styleSheetCaches->styleRulesCache.remove(w); + styleSheetCaches->hasStyleRuleCache.remove(w); + styleSheetCaches->renderRulesCache.remove(w); } setGeometry(w); setProperties(w); @@ -2771,7 +2748,7 @@ void QStyleSheetStyle::polish(QWidget *w) QWidget *ew = embeddedWidget(w); if (ew->autoFillBackground()) { ew->setAutoFillBackground(false); - autoFillDisabledWidgets->insert(w); + styleSheetCaches->autoFillDisabledWidgets.insert(w); if (ew != w) { //eg. viewport of a scrollarea //(in order to draw the background anyway in case we don't.) ew->setAttribute(Qt::WA_StyledBackground, true); @@ -2795,20 +2772,20 @@ void QStyleSheetStyle::polish(QPalette &pal) void QStyleSheetStyle::repolish(QWidget *w) { - QList<const QWidget *> children = qFindChildren<const QWidget *>(w, QString()); + QList<const QWidget *> children = w->findChildren<const QWidget *>(QString()); children.append(w); - styleSheetCache->remove(w); + styleSheetCaches->styleSheetCache.remove(w); updateWidgets(children); } void QStyleSheetStyle::repolish(QApplication *app) { Q_UNUSED(app); - const QList<const QWidget*> allWidgets = styleRulesCache->keys(); - styleSheetCache->remove(qApp); - styleRulesCache->clear(); - hasStyleRuleCache->clear(); - renderRulesCache->clear(); + const QList<const QWidget*> allWidgets = styleSheetCaches->styleRulesCache.keys(); + styleSheetCaches->styleSheetCache.remove(qApp); + styleSheetCaches->styleRulesCache.clear(); + styleSheetCaches->hasStyleRuleCache.clear(); + styleSheetCaches->renderRulesCache.clear(); updateWidgets(allWidgets); } @@ -2819,10 +2796,10 @@ void QStyleSheetStyle::unpolish(QWidget *w) return; } - styleRulesCache->remove(w); - hasStyleRuleCache->remove(w); - renderRulesCache->remove(w); - styleSheetCache->remove(w); + styleSheetCaches->styleRulesCache.remove(w); + styleSheetCaches->hasStyleRuleCache.remove(w); + styleSheetCaches->renderRulesCache.remove(w); + styleSheetCaches->styleSheetCache.remove(w); unsetPalette(w); w->setProperty("_q_stylesheet_minw", QVariant()); w->setProperty("_q_stylesheet_minh", QVariant()); @@ -2849,10 +2826,10 @@ void QStyleSheetStyle::unpolish(QApplication *app) { baseStyle()->unpolish(app); RECURSION_GUARD(return) - styleRulesCache->clear(); - hasStyleRuleCache->clear(); - renderRulesCache->clear(); - styleSheetCache->remove(qApp); + styleSheetCaches->styleRulesCache.clear(); + styleSheetCaches->hasStyleRuleCache.clear(); + styleSheetCaches->renderRulesCache.clear(); + styleSheetCaches->styleSheetCache.remove(qApp); } #ifndef QT_NO_TABBAR @@ -3048,6 +3025,13 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC titleRule.configurePalette(&pal, QPalette::WindowText, QPalette::Window); drawItemText(p, labelRect, alignment, pal, gb->state & State_Enabled, gb->text, QPalette::WindowText); + + if (gb->state & State_HasFocus) { + QStyleOptionFocusRect fropt; + fropt.QStyleOption::operator=(*gb); + fropt.rect = labelRect; + drawPrimitive(PE_FrameFocusRect, &fropt, p, w); + } } return; @@ -3717,7 +3701,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q editRect.translate(cb->iconSize.width() + spacing, 0); } if (!cb->currentText.isEmpty() && !cb->editable) { - drawItemText(p, editRect.adjusted(0, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->palette, + QPalette styledPalette(cb->palette); + rule.configurePalette(&styledPalette, QPalette::Text, QPalette::Base); + drawItemText(p, editRect.adjusted(0, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, styledPalette, cb->state & State_Enabled, cb->currentText, QPalette::Text); } p->restore(); @@ -4150,6 +4136,10 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op pseudoElement = PseudoElement_DownArrow; break; + case PE_IndicatorArrowUp: + pseudoElement = PseudoElement_UpArrow; + break; + case PE_IndicatorRadioButton: pseudoElement = PseudoElement_ExclusiveIndicator; break; @@ -4250,7 +4240,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op case PE_Widget: if (w && !rule.hasDrawable()) { QWidget *container = containerWidget(w); - if (autoFillDisabledWidgets->contains(container) + if (styleSheetCaches->autoFillDisabledWidgets.contains(container) && (container == w || !renderRule(container, opt).hasBackground())) { //we do not have a background, but we disabled the autofillbackground anyway. so fill the background now. // (this may happen if we have rules like :focus) @@ -5074,7 +5064,7 @@ QIcon QStyleSheetStyle::standardIconImplementation(StandardPixmap standardIcon, if (!s.isEmpty()) { QRenderRule rule = renderRule(w, opt); if (rule.hasStyleHint(s)) - return qVariantValue<QIcon>(rule.styleHint(s)); + return qvariant_cast<QIcon>(rule.styleHint(s)); } return baseStyle()->standardIcon(standardIcon, opt, w); } @@ -5092,7 +5082,7 @@ QPixmap QStyleSheetStyle::standardPixmap(StandardPixmap standardPixmap, const QS if (!s.isEmpty()) { QRenderRule rule = renderRule(w, opt); if (rule.hasStyleHint(s)) { - QIcon icon = qVariantValue<QIcon>(rule.styleHint(s)); + QIcon icon = qvariant_cast<QIcon>(rule.styleHint(s)); return icon.pixmap(16, 16); // ###: unhard-code this if someone complains } } @@ -5186,7 +5176,7 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi case SH_ComboBox_PopupFrameStyle: #ifndef QT_NO_COMBOBOX if (qobject_cast<const QComboBox *>(w)) { - QAbstractItemView *view = qFindChild<QAbstractItemView *>(w); + QAbstractItemView *view = w->findChild<QAbstractItemView *>(); if (view) { view->ensurePolished(); QRenderRule subRule = renderRule(view, PseudoElement_None); diff --git a/src/gui/styles/qstylesheetstyle_default.cpp b/src/gui/styles/qstylesheetstyle_default.cpp index 002dcff..76ffac8 100644 --- a/src/gui/styles/qstylesheetstyle_default.cpp +++ b/src/gui/styles/qstylesheetstyle_default.cpp @@ -151,7 +151,7 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const BasicSelector bSelector; Selector selector; Declaration decl; - Value value; + QCss::Value value; Pseudo pseudo; AttributeSelector attr; diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h index 38c51f5..1f331b2 100644 --- a/src/gui/styles/qstylesheetstyle_p.h +++ b/src/gui/styles/qstylesheetstyle_p.h @@ -145,10 +145,6 @@ protected Q_SLOTS: protected: bool event(QEvent *e); -private Q_SLOTS: - void widgetDestroyed(QObject *); - void styleDestroyed(QObject *); - private: int refcount; @@ -186,6 +182,22 @@ private: Q_DECLARE_PRIVATE(QStyleSheetStyle) }; +class QStyleSheetStyleCaches : public QObject +{ + Q_OBJECT +public Q_SLOTS: + void widgetDestroyed(QObject *); + void styleDestroyed(QObject *); +public: + QHash<const QWidget *, QVector<QCss::StyleRule> > styleRulesCache; + QHash<const QWidget *, QHash<int, bool> > hasStyleRuleCache; + typedef QHash<int, QHash<quint64, QRenderRule> > QRenderRules; + QHash<const QWidget *, QRenderRules> renderRulesCache; + QHash<const QWidget *, QPalette> customPaletteWidgets; // widgets whose palette we tampered + QHash<const void *, QCss::StyleSheet> styleSheetCache; // parsed style sheets + QSet<const QWidget *> autoFillDisabledWidgets; +}; + QT_END_NAMESPACE #endif // QT_NO_STYLE_STYLESHEET diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/gui/styles/qwindowscestyle.cpp index 7fd9f20..d7947bc 100644 --- a/src/gui/styles/qwindowscestyle.cpp +++ b/src/gui/styles/qwindowscestyle.cpp @@ -2294,6 +2294,7 @@ int QWindowsCEStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QW break; case SH_EtchDisabledText: ret = false; + break; case SH_RequestSoftwareInputPanel: ret = RSIP_OnMouseClick; break; diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index e7598a2..44f3f92 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -176,7 +176,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) widget = widget->window(); // Alt has been pressed - find all widgets that care - QList<QWidget *> l = qFindChildren<QWidget *>(widget); + QList<QWidget *> l = widget->findChildren<QWidget *>(); for (int pos=0 ; pos < l.size() ; ++pos) { QWidget *w = l.at(pos); if (w->isWindow() || !w->isVisible() || @@ -199,7 +199,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) // Update state and repaint the menu bars. d->alt_down = false; #ifndef QT_NO_MENUBAR - QList<QMenuBar *> l = qFindChildren<QMenuBar *>(widget); + QList<QMenuBar *> l = widget->findChildren<QMenuBar *>(); for (int i = 0; i < l.size(); ++i) l.at(i)->update(); #endif @@ -1161,7 +1161,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid if (!menuBar && qobject_cast<const QMenu *>(widget)) { QWidget *w = QApplication::activeWindow(); if (w && w != widget) - menuBar = qFindChild<QMenuBar *>(w); + menuBar = w->findChild<QMenuBar *>(); } // If we paint a menu bar draw underlines if is in the keyboardState if (menuBar) { diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 24d8555..7f1a3ab 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -588,10 +588,6 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt if (QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget())) resolve_mask = spinbox->palette().resolve(); #endif // QT_NO_SPINBOX -#ifndef QT_NO_COMBOBOX - if (QComboBox *combobox = qobject_cast<QComboBox*>(widget->parentWidget())) - resolve_mask = combobox->palette().resolve(); -#endif // QT_NO_COMBOBOX } if (resolve_mask & (1 << QPalette::Base)) { // Base color is set for this widget, so use it @@ -842,10 +838,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt const QDialogButtonBox *buttonBox = 0; if (qobject_cast<const QMessageBox *> (widget)) - buttonBox = qFindChild<const QDialogButtonBox *>(widget,QLatin1String("qt_msgbox_buttonbox")); + buttonBox = widget->findChild<const QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox")); #ifndef QT_NO_INPUTDIALOG else if (qobject_cast<const QInputDialog *> (widget)) - buttonBox = qFindChild<const QDialogButtonBox *>(widget,QLatin1String("qt_inputdlg_buttonbox")); + buttonBox = widget->findChild<const QDialogButtonBox *>(QLatin1String("qt_inputdlg_buttonbox")); #endif // QT_NO_INPUTDIALOG if (buttonBox) { @@ -2396,14 +2392,14 @@ void QWindowsVistaStyle::polish(QWidget *widget) } } else if (qobject_cast<QMessageBox *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground); - QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox *>(widget,QLatin1String("qt_msgbox_buttonbox")); + QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox")); if (buttonBox) buttonBox->setContentsMargins(0, 9, 0, 0); } #ifndef QT_NO_INPUTDIALOG else if (qobject_cast<QInputDialog *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground); - QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox *>(widget,QLatin1String("qt_inputdlg_buttonbox")); + QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_inputdlg_buttonbox")); if (buttonBox) buttonBox->setContentsMargins(0, 9, 0, 0); } @@ -2435,14 +2431,14 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) widget->setAttribute(Qt::WA_Hover, false); else if (qobject_cast<QMessageBox *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); - QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox *>(widget,QLatin1String("qt_msgbox_buttonbox")); + QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox")); if (buttonBox) buttonBox->setContentsMargins(0, 0, 0, 0); } #ifndef QT_NO_INPUTDIALOG else if (qobject_cast<QInputDialog *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); - QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox *>(widget,QLatin1String("qt_inputdlg_buttonbox")); + QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_inputdlg_buttonbox")); if (buttonBox) buttonBox->setContentsMargins(0, 0, 0, 0); } diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 629a8c6..74a20fc 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -4054,7 +4054,7 @@ void QWindowsXPStylePrivate::dumpNativeDIB(int w, int h) bufferPos += sprintf(bufferPos, "\n};\n\n"); printf(bufferDump); - delete bufferDump; + delete[] bufferDump; ++pCount; } } diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index b22a908..b6eeec9 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -35,7 +35,7 @@ contains( styles, all ) { styles = mac windows windowsxp windowsvista } -x11|embedded|!macx-*:styles -= mac +x11|embedded|qpa|!macx-*:styles -= mac x11{ QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE |