diff options
author | Robert Griebl <rgriebl@trolltech.com> | 2009-12-08 17:10:57 +0100 |
---|---|---|
committer | Robert Griebl <rgriebl@trolltech.com> | 2009-12-08 18:03:51 +0100 |
commit | f3c37838ab149a8a570b7f1df987705815ae45c0 (patch) | |
tree | c28ff9bcb1cc42aabe181ed58fdc10c1ab0dd314 /src/gui/styles/qgtkstyle.cpp | |
parent | 971acc6d34559a2c5035888a5891ea29ad8628af (diff) | |
download | qt4-tools-f3c37838ab149a8a570b7f1df987705815ae45c0.tar.gz |
QGtkStyle: support for the inner-border property in GtkButtons
This additional padding was not taken into account up to now. It didn't
matter for desktop themes, but Maemo5 uses a large (8pix) padding that can
not be ignored.
Reviewed-by: jbache
Diffstat (limited to 'src/gui/styles/qgtkstyle.cpp')
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index afa3325f59..097a2b5b66 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -3375,12 +3375,28 @@ QIcon QGtkStyle::standardIconImplementation(StandardPixmap standardIcon, /*! \reimp */ QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { + Q_D(const QGtkStyle); + QRect r = QCleanlooksStyle::subElementRect(element, option, widget); switch (element) { case SE_ProgressBarLabel: case SE_ProgressBarContents: case SE_ProgressBarGroove: return option->rect; + case SE_PushButtonContents: + if (!d->gtk_check_version(2, 10, 0)) { + GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkBorder *border = 0; + d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL); + if (border) { + r = option->rect.adjusted(border->left, border->top, -border->right, -border->top); + d->gtk_border_free(border); + } else { + r = option->rect.adjusted(1, 1, -1, -1); + } + r = visualRect(option->direction, option->rect, r); + } + break; default: break; } |