summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp1
-rw-r--r--src/gui/styles/qgtkstyle.cpp36
-rw-r--r--src/gui/styles/qgtkstyle_p.cpp62
-rw-r--r--src/gui/styles/qgtkstyle_p.h19
-rw-r--r--src/gui/styles/qs60style.cpp78
-rw-r--r--src/gui/styles/qs60style_p.h4
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp8
-rw-r--r--src/gui/styles/qwindowsstyle.cpp2
8 files changed, 132 insertions, 78 deletions
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 973e682..b08847d 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -3817,6 +3817,7 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption *
newSize.setWidth(80);
if (!btn->icon.isNull() && btn->iconSize.height() > 16)
newSize -= QSize(0, 2);
+ newSize += QSize(0, 1);
}
if (const QPushButton *button = qobject_cast<const QPushButton *>(widget)) {
if (qobject_cast<const QDialogButtonBox *>(button->parentWidget())) {
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 70b7aa3..5566cc6 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -2521,7 +2521,7 @@ void QGtkStyle::drawControl(ControlElement element,
bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
if (selected) {
- QRect rect = option->rect.adjusted(0, 0, -1, -1);
+ QRect rect = option->rect.adjusted(0, 0, 0, -1);
#ifndef QT_NO_COMBOBOX
if (qobject_cast<const QComboBox*>(widget))
rect = option->rect;
@@ -2628,7 +2628,7 @@ void QGtkStyle::drawControl(ControlElement element,
int pixw = pixmap.width();
int pixh = pixmap.height();
QRect pmr(0, 0, pixw, pixh);
- pmr.moveCenter(vCheckRect.center());
+ pmr.moveCenter(vCheckRect.center() - QPoint(0, 1));
painter->setPen(menuItem->palette.text().color());
if (!ignoreCheckMark && checkable && checked) {
QStyleOption opt = *option;
@@ -2670,8 +2670,8 @@ void QGtkStyle::drawControl(ControlElement element,
menuitem->rect.getRect(&x, &y, &w, &h);
int tab = menuitem->tabWidth;
int xm = windowsItemFrame + checkcol + windowsItemHMargin;
- int xpos = menuitem->rect.x() + xm;
- QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
+ int xpos = menuitem->rect.x() + xm + 1;
+ QRect textRect(xpos, y + windowsItemVMargin - 1, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
QString s = menuitem->text;
@@ -2718,13 +2718,19 @@ void QGtkStyle::drawControl(ControlElement element,
QFontMetrics fm(menuitem->font);
int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness;
gfloat arrow_scaling = 0.8;
+ int extra = 0;
+ if (!d->gtk_check_version(2, 16, 0)) {
+ // "arrow-scaling" is actually hardcoded and fails on hardy (see gtk+-2.12/gtkmenuitem.c)
+ // though the current documentation states otherwise
+ d->gtk_widget_style_get(gtkMenuItem, "arrow-scaling", &arrow_scaling, NULL);
+ // in versions < 2.16 ythickness was previously subtracted from the arrow_size
+ extra = 2 * gtkMenuItem->style->ythickness;
+ }
- // "arrow-scaling" is actually hardcoded and fails on hardy (see gtk+-2.12/gtkmenuitem.c)
- // though the current documentation states otherwise
int horizontal_padding;
d->gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL);
- const int dim = static_cast<int>(arrow_size * arrow_scaling);
+ const int dim = static_cast<int>(arrow_size * arrow_scaling) + extra;
int xpos = menuItem->rect.left() + menuItem->rect.width() - horizontal_padding - dim;
QRect vSubMenuRect = visualRect(option->direction, menuItem->rect,
QRect(xpos, menuItem->rect.top() +
@@ -3123,7 +3129,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
case CT_ToolButton:
if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton"));
- newSize = size + QSize(2 * gtkButton->style->xthickness, 1 + 2 * gtkButton->style->ythickness);
+ newSize = size + QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness);
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
QSize minSize(0, 25);
if (toolbutton->toolButtonStyle != Qt::ToolButtonTextOnly)
@@ -3155,7 +3161,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
GtkWidget *gtkMenuItem = d->gtkWidget(QLS("GtkMenu.GtkMenuItem"));
GtkStyle* style = gtkMenuItem->style;
- newSize += QSize(textMargin + style->xthickness - 2, style->ythickness - 4);
+ newSize += QSize(textMargin + style->xthickness - 1, style->ythickness - 3);
// Cleanlooks assumes a check column of 20 pixels so we need to
// expand it a bit
@@ -3175,7 +3181,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
case CT_SpinBox:
// QSpinBox does some nasty things that depends on CT_LineEdit
- newSize = size + QSize(0, -d->gtkWidget(QLS("GtkSpinButton"))->style->ythickness * 2 + 2);
+ newSize = size + QSize(0, -d->gtkWidget(QLS("GtkSpinButton"))->style->ythickness * 2);
break;
case CT_PushButton:
@@ -3206,13 +3212,9 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
}
break;
- case CT_MenuBarItem://cleanlooks adds 2 pixels
- newSize = QWindowsStyle::sizeFromContents(type, option, size, widget) + QSize(0, 1);
- break;
-
case CT_LineEdit: {
GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
- newSize = size + QSize(2*gtkEntry->style->xthickness, 2*gtkEntry->style->ythickness);
+ newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness);
}
break;
@@ -3227,7 +3229,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness);
if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget())))
- newSize += QSize(0, 3);
+ newSize += QSize(0, 2);
}
break;
@@ -3240,7 +3242,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
if (!tab->icon.isNull())
newSize += QSize(6, 0);
}
- newSize += QSize(1, 0);
+ newSize += QSize(1, 1);
break;
default:
diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp
index 7119a4f..5f4ebae 100644
--- a/src/gui/styles/qgtkstyle_p.cpp
+++ b/src/gui/styles/qgtkstyle_p.cpp
@@ -202,12 +202,16 @@ Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0;
typedef int (*x11ErrorHandler)(Display*, XErrorEvent*);
-static void gtkStyleSetCallback(GtkWidget*, QGtkStylePrivate* stylePrivate)
+Q_DECLARE_METATYPE(QGtkStylePrivate*);
+
+static void gtkStyleSetCallback(GtkWidget*)
{
+ qRegisterMetaType<QGtkStylePrivate *>();
+
// We have to let this function return and complete the event
// loop to ensure that all gtk widgets have been styled before
// updating
- QMetaObject::invokeMethod(styleScheduler(), "updateTheme", Qt::QueuedConnection, Q_ARG(QGtkStylePrivate*, stylePrivate));
+ QMetaObject::invokeMethod(styleScheduler(), "updateTheme", Qt::QueuedConnection);
}
static void update_toolbar_style(GtkWidget *gtkToolBar, GParamSpec *, gpointer)
@@ -251,10 +255,18 @@ bool QGtkStyleFilter::eventFilter(QObject *obj, QEvent *e)
return QObject::eventFilter(obj, e);
}
+QList<QGtkStylePrivate *> QGtkStylePrivate::instances;
+
QGtkStylePrivate::QGtkStylePrivate()
: QCleanlooksStylePrivate()
, filter(this)
{
+ instances.append(this);
+}
+
+QGtkStylePrivate::~QGtkStylePrivate()
+{
+ instances.removeOne(this);
}
void QGtkStylePrivate::init()
@@ -285,7 +297,7 @@ GtkStyle* QGtkStylePrivate::gtkStyle(const QString &path)
/*! \internal
* Get references to gtk functions after we dynamically load the library.
*/
-void QGtkStylePrivate::resolveGtk()
+void QGtkStylePrivate::resolveGtk() const
{
// enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
@@ -413,7 +425,7 @@ void QGtkStylePrivate::resolveGtk()
* Initializes a number of gtk menu widgets.
* The widgets are cached.
*/
-void QGtkStylePrivate::initGtkMenu()
+void QGtkStylePrivate::initGtkMenu() const
{
// Create menubar
GtkWidget *gtkMenuBar = QGtkStylePrivate::gtk_menu_bar_new();
@@ -444,7 +456,7 @@ void QGtkStylePrivate::initGtkMenu()
}
-void QGtkStylePrivate::initGtkTreeview()
+void QGtkStylePrivate::initGtkTreeview() const
{
GtkWidget *gtkTreeView = gtk_tree_view_new();
gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, gtk_tree_view_column_new());
@@ -458,7 +470,7 @@ void QGtkStylePrivate::initGtkTreeview()
* Initializes a number of gtk widgets that we can later on use to determine some of our styles.
* The widgets are cached.
*/
-void QGtkStylePrivate::initGtkWidgets()
+void QGtkStylePrivate::initGtkWidgets() const
{
// From gtkmain.c
uid_t ruid = getuid ();
@@ -509,7 +521,7 @@ void QGtkStylePrivate::initGtkWidgets()
if (!gtkWidgetMap()->contains(QLS("GtkButton"))) {
GtkWidget *gtkButton = QGtkStylePrivate::gtk_button_new();
addWidget(gtkButton);
- g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), this);
+ g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), 0);
addWidget(QGtkStylePrivate::gtk_tool_button_new(NULL, NULL));
addWidget(QGtkStylePrivate::gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE));
addWidget(QGtkStylePrivate::gtk_hbutton_box_new());
@@ -613,7 +625,7 @@ bool QGtkStylePrivate::getGConfBool(const QString &key, bool fallback)
return retVal;
}
-QString QGtkStylePrivate::getThemeName() const
+QString QGtkStylePrivate::getThemeName()
{
QString themeName;
// We try to parse the gtkrc file first
@@ -730,7 +742,7 @@ void QGtkStylePrivate::addAllSubWidgets(GtkWidget *widget, gpointer v)
}
// Updates window/windowtext palette based on the indicated gtk widget
-QPalette QGtkStylePrivate::gtkWidgetPalette(const QString &gtkWidgetName)
+QPalette QGtkStylePrivate::gtkWidgetPalette(const QString &gtkWidgetName) const
{
GtkWidget *gtkWidget = QGtkStylePrivate::gtkWidget(gtkWidgetName);
Q_ASSERT(gtkWidget);
@@ -751,7 +763,7 @@ QPalette QGtkStylePrivate::gtkWidgetPalette(const QString &gtkWidgetName)
}
-void QGtkStyleUpdateScheduler::updateTheme( QGtkStylePrivate* stylePrivate )
+void QGtkStyleUpdateScheduler::updateTheme()
{
static QString oldTheme(QLS("qt_not_set"));
QPixmapCache::clear();
@@ -760,20 +772,22 @@ void QGtkStyleUpdateScheduler::updateTheme( QGtkStylePrivate* stylePrivate )
if (QApplication::font() != font)
qApp->setFont(font);
- if (oldTheme != stylePrivate->getThemeName()) {
- oldTheme = stylePrivate->getThemeName();
- QPalette newPalette = qApp->style()->standardPalette();
- QApplicationPrivate::setSystemPalette(newPalette);
- QApplication::setPalette(newPalette);
- stylePrivate->initGtkWidgets();
- stylePrivate->applyCustomPaletteHash();
- QList<QWidget*> widgets = QApplication::allWidgets();
- // Notify all widgets that size metrics might have changed
- foreach (QWidget *widget, widgets) {
- QEvent e(QEvent::StyleChange);
- QApplication::sendEvent(widget, &e);
- }
- }
+ if (oldTheme != QGtkStylePrivate::getThemeName()) {
+ oldTheme = QGtkStylePrivate::getThemeName();
+ QPalette newPalette = qApp->style()->standardPalette();
+ QApplicationPrivate::setSystemPalette(newPalette);
+ QApplication::setPalette(newPalette);
+ if (!QGtkStylePrivate::instances.isEmpty()) {
+ QGtkStylePrivate::instances.last()->initGtkWidgets();
+ QGtkStylePrivate::instances.last()->applyCustomPaletteHash();
+ }
+ QList<QWidget*> widgets = QApplication::allWidgets();
+ // Notify all widgets that size metrics might have changed
+ foreach (QWidget *widget, widgets) {
+ QEvent e(QEvent::StyleChange);
+ QApplication::sendEvent(widget, &e);
+ }
+ }
QIconLoader::instance()->updateSystemTheme();
}
diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h
index fa16769..f6ab8a3 100644
--- a/src/gui/styles/qgtkstyle_p.h
+++ b/src/gui/styles/qgtkstyle_p.h
@@ -255,16 +255,17 @@ class QGtkStylePrivate : public QCleanlooksStylePrivate
Q_DECLARE_PUBLIC(QGtkStyle)
public:
QGtkStylePrivate();
+ ~QGtkStylePrivate();
QGtkStyleFilter filter;
static GtkWidget* gtkWidget(const QString &path);
static GtkStyle* gtkStyle(const QString &path = QLatin1String("GtkWindow"));
- virtual void resolveGtk();
- virtual void initGtkMenu();
- virtual void initGtkTreeview();
- virtual void initGtkWidgets();
+ virtual void resolveGtk() const;
+ virtual void initGtkMenu() const;
+ virtual void initGtkTreeview() const;
+ virtual void initGtkWidgets() const;
static void cleanupGtkWidgets();
@@ -276,7 +277,7 @@ public:
static bool getGConfBool(const QString &key, bool fallback = 0);
static QString getGConfString(const QString &key, const QString &fallback = QString());
- virtual QString getThemeName() const;
+ static QString getThemeName();
virtual int getSpinboxArrowSize() const;
static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
@@ -412,7 +413,7 @@ public:
static Ptr_gnome_icon_lookup_sync gnome_icon_lookup_sync;
static Ptr_gnome_vfs_init gnome_vfs_init;
- virtual QPalette gtkWidgetPalette(const QString &gtkWidgetName);
+ virtual QPalette gtkWidgetPalette(const QString &gtkWidgetName) const;
protected:
typedef QHash<QString, GtkWidget*> WidgetMap;
@@ -434,6 +435,10 @@ protected:
static void addWidget(GtkWidget *widget);
virtual void init();
+
+private:
+ static QList<QGtkStylePrivate *> instances;
+ friend class QGtkStyleUpdateScheduler;
};
// Helper to ensure that we have polished all our gtk widgets
@@ -442,7 +447,7 @@ class QGtkStyleUpdateScheduler : public QObject
{
Q_OBJECT
public slots:
- void updateTheme( QGtkStylePrivate* stylePrivate );
+ void updateTheme();
};
QT_END_NAMESPACE
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 939ea45..b5c0d4f 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -67,6 +67,7 @@
#include "qtoolbar.h"
#include "qtoolbutton.h"
#include "qfocusframe.h"
+#include "qformlayout.h"
#include "private/qtoolbarextension_p.h"
#include "private/qcombobox_p.h"
@@ -783,6 +784,14 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
widgetPalette.setBrush(QPalette::Window, QBrush());
QApplication::setPalette(widgetPalette, "QScrollArea");
widgetPalette = *palette;
+
+ //Webpages should not use S60 theme colors as they are designed to work
+ //with themeBackground and do not generally mesh well with web page backgrounds.
+ QPalette webPalette = *palette;
+ webPalette.setColor(QPalette::WindowText, Qt::black);
+ webPalette.setColor(QPalette::Text, Qt::black);
+ QApplication::setPalette(webPalette, "QWebView");
+ QApplication::setPalette(webPalette, "QGraphicsWebView");
}
QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags)
@@ -859,6 +868,13 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
return result;
}
+bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush)
+{
+ //If brush is not changed from style's default values, draw theme graphics.
+ return (backgroundBrush.color() == Qt::transparent ||
+ backgroundBrush.style() == Qt::NoBrush) ? true : false;
+}
+
/*!
\class QS60Style
\brief The QS60Style class provides a look and feel suitable for applications on S60.
@@ -1372,8 +1388,10 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd);
}
if (vopt->showDecorationSelected &&
- (vopt->palette.highlight().color() == d->themePalette()->highlight().color()))
+ (vopt->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()))
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags);
+ else
+ painter->fillRect(highlightRect, vopt->palette.highlight());
}
// draw the icon
@@ -1845,7 +1863,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
case CE_ShapedFrame:
if (const QTextEdit *textEdit = qobject_cast<const QTextEdit *>(widget)) {
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option);
- if (frame->palette.base().color()==Qt::transparent)
+ if (QS60StylePrivate::canDrawThemeBackground(frame->palette.base()))
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags);
else
QCommonStyle::drawControl(element, option, painter, widget);
@@ -1919,7 +1937,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
if (option->state & State_Sunken && option->state & State_Enabled) {
painter->save();
painter->setOpacity(0.5);
- painter->setBrush(d->themePalette()->light());
+ painter->setBrush(QS60StylePrivate::themePalette()->light());
painter->setRenderHint(QPainter::Antialiasing);
const qreal roundRectRadius = 4 * goldenRatio;
painter->drawRoundedRect(option->rect, roundRectRadius, roundRectRadius);
@@ -1938,6 +1956,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
{
Q_D(const QS60Style);
const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled;
+ bool commonStyleDraws = false;
+
switch (element) {
#ifndef QT_NO_LINEEDIT
case PE_PanelLineEdit:
@@ -1946,12 +1966,10 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
if (widget && qobject_cast<const QComboBox *>(widget->parentWidget()))
break;
#endif
- QBrush editBrush = option->palette.brush(QPalette::Base);
- if (editBrush.color() == Qt::transparent)
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit,
- painter, option->rect, flags);
+ if (QS60StylePrivate::canDrawThemeBackground(option->palette.base()))
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, painter, option->rect, flags);
else
- QCommonStyle::drawPrimitive(element, option, painter, widget);
+ commonStyleDraws = true;
}
break;
#endif // QT_NO_LINEEDIT
@@ -1961,10 +1979,13 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
const QS60StyleEnums::SkinParts skinPart = (option->state & QStyle::State_On) ?
QS60StyleEnums::SP_QgnIndiCheckboxOn : QS60StyleEnums::SP_QgnIndiCheckboxOff;
painter->save();
- QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnIconColors, 13, option);
- QColor buttonTextColor = option->palette.buttonText().color();
- if (themeColor != buttonTextColor)
- painter->setPen(buttonTextColor);
+
+ QColor themeColor = QS60StylePrivate::themePalette()->windowText().color();
+ QColor windowTextColor = option->palette.windowText().color();
+
+ if (themeColor != windowTextColor)
+ painter->setPen(windowTextColor);
+
QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags | QS60StylePrivate::SF_ColorSkinned );
painter->restore();
}
@@ -2007,10 +2028,12 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
buttonRect.adjust(0,-newY,0,-newY);
painter->save();
- QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnIconColors, 13, option);
+ QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option);
QColor buttonTextColor = option->palette.buttonText().color();
if (themeColor != buttonTextColor)
painter->setPen(buttonTextColor);
+ else
+ painter->setPen(themeColor);
// Draw radiobutton indicator as color skinned graphics.
QS60StyleEnums::SkinParts skinPart = (option->state & QStyle::State_On) ?
@@ -2024,14 +2047,13 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_PanelButtonTool:
case PE_PanelButtonBevel:
case PE_FrameButtonBevel: {
- QBrush editBrush = option->palette.brush(QPalette::Base);
- if (editBrush.color() == Qt::transparent) {
+ if (QS60StylePrivate::canDrawThemeBackground(option->palette.base())) {
const bool isPressed = option->state & QStyle::State_Sunken;
const QS60StylePrivate::SkinElements skinElement =
isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
} else {
- QCommonStyle::drawPrimitive(element, option, painter, widget);
+ commonStyleDraws = true;
}
}
break;
@@ -2059,7 +2081,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_IndicatorSpinUp:
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
QStyleOptionSpinBox optionSpinBox = *spinBox;
- if (optionSpinBox.palette.base().color()==Qt::transparent) {
+ if (QS60StylePrivate::canDrawThemeBackground(optionSpinBox.palette.base())) {
const QS60StyleEnums::SkinParts part = (element == PE_IndicatorSpinUp) ?
QS60StyleEnums::SP_QgnGrafScrollArrowUp :
QS60StyleEnums::SP_QgnGrafScrollArrowDown;
@@ -2067,12 +2089,12 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
optionSpinBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment );
QS60StylePrivate::drawSkinPart(part, painter, optionSpinBox.rect,flags);
} else {
- QCommonStyle::drawPrimitive(element, &optionSpinBox, painter, widget);
+ commonStyleDraws = true;
}
}
#ifndef QT_NO_COMBOBOX
else if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- if (cmb->palette.base().color()==Qt::transparent) {
+ if (QS60StylePrivate::canDrawThemeBackground( option->palette.base())) {
// We want to draw down arrow here for comboboxes as well.
const QS60StyleEnums::SkinParts part = QS60StyleEnums::SP_QgnGrafScrollArrowDown;
QStyleOptionFrame comboBox = *cmb;
@@ -2080,7 +2102,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
comboBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment );
QS60StylePrivate::drawSkinPart(part, painter, comboBox.rect,flags);
} else {
- QCommonStyle::drawPrimitive(element, cmb, painter, widget);
+ commonStyleDraws = true;
}
}
#endif //QT_NO_COMBOBOX
@@ -2111,12 +2133,10 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
|| qobject_cast<const QMenu *> (widget)
#endif //QT_NO_MENU
) {
- if (option->palette.base().color()==Qt::transparent) {
- QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu;
- QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
- } else {
- QCommonStyle::drawPrimitive(element, option, painter, widget);
- }
+ if (QS60StylePrivate::canDrawThemeBackground(option->palette.base()))
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_OptionsMenu, painter, option->rect, flags);
+ else
+ commonStyleDraws = true;
}
break;
case PE_FrameWindow:
@@ -2248,6 +2268,9 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
#endif //QT_NO_COLUMNVIEW
case PE_FrameTabBarBase: // since tabs are in S60 always in navipane, let's use common style for tab base in Qt.
default:
+ commonStyleDraws = true;
+ }
+ if (commonStyleDraws) {
QCommonStyle::drawPrimitive(element, option, painter, widget);
}
}
@@ -2379,6 +2402,9 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_RequestSoftwareInputPanel:
retValue = RSIP_OnMouseClickAndAlreadyFocused;
break;
+ case SH_FormLayoutWrapPolicy:
+ retValue = QFormLayout::WrapLongRows;
+ break;
default:
break;
}
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index cfe87ac..ea86bb2 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -453,6 +453,10 @@ public:
static QSize naviPaneSize();
+ //Checks that the current brush is transparent or has BrushStyle NoBrush,
+ //so that theme graphic background can be drawn.
+ static bool canDrawThemeBackground(const QBrush &backgroundBrush);
+
private:
static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter,
const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 59210c3..8b40931 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -4637,6 +4637,7 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
}
break;
+#ifndef QT_NO_TABWIDGET
case PM_TabBarTabHSpace:
case PM_TabBarTabVSpace:
subRule = renderRule(w, opt, PseudoElement_TabBarTab);
@@ -4660,11 +4661,14 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
return 0;
break;
- case PM_TabBarBaseOverlap:
- if (hasStyleRule(w->parentWidget(), PseudoElement_TabWidgetPane)) {
+ case PM_TabBarBaseOverlap: {
+ const QWidget *tabWidget = qobject_cast<const QTabWidget *>(w) ? w : w->parentWidget();
+ if (hasStyleRule(tabWidget, PseudoElement_TabWidgetPane)) {
return 0;
}
break;
+ }
+#endif // QT_NO_TABWIDGET
case PM_SliderThickness: // horizontal slider's height (sizeHint)
case PM_SliderLength: // minimum length of slider
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index f894b82..30f2f35 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -2989,7 +2989,6 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
#ifndef QT_NO_COMBOBOX
case CC_ComboBox:
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
- p->save();
QBrush editBrush = cmb->palette.brush(QPalette::Base);
if ((cmb->subControls & SC_ComboBoxFrame)) {
if (cmb->frame) {
@@ -3059,7 +3058,6 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
}
}
- p->restore();
}
break;
#endif // QT_NO_COMBOBOX