equal
deleted
inserted
replaced
45 #if !defined(QT_NO_STYLE_GTK) |
45 #if !defined(QT_NO_STYLE_GTK) |
46 |
46 |
47 // This class is primarily a wrapper around the gtk painter functions |
47 // This class is primarily a wrapper around the gtk painter functions |
48 // and takes care of converting all such calls into cached Qt pixmaps. |
48 // and takes care of converting all such calls into cached Qt pixmaps. |
49 |
49 |
|
50 #include <private/qstylehelper_p.h> |
50 #include <QtGui/QWidget> |
51 #include <QtGui/QWidget> |
51 #include <QtGui/QStyleOption> |
52 #include <QtGui/QStyleOption> |
52 #include <QtGui/QPixmapCache> |
53 #include <QtGui/QPixmapCache> |
53 |
54 |
54 QT_BEGIN_NAMESPACE |
55 QT_BEGIN_NAMESPACE |
140 QGtkStylePrivate::gdk_drawable_unref(pixmap); \ |
141 QGtkStylePrivate::gdk_drawable_unref(pixmap); \ |
141 QGtkStylePrivate::gdk_pixbuf_unref(imgb); \ |
142 QGtkStylePrivate::gdk_pixbuf_unref(imgb); \ |
142 } |
143 } |
143 |
144 |
144 QGtkPainter::QGtkPainter(QPainter *_painter) |
145 QGtkPainter::QGtkPainter(QPainter *_painter) |
145 : m_window(QGtkStylePrivate::gtkWidget(QLatin1String("GtkWindow"))) |
146 : m_window(QGtkStylePrivate::gtkWidget("GtkWindow")) |
146 , m_painter(_painter) |
147 , m_painter(_painter) |
147 , m_alpha(true) |
148 , m_alpha(true) |
148 , m_hflipped(false) |
149 , m_hflipped(false) |
149 , m_vflipped(false) |
150 , m_vflipped(false) |
150 , m_usePixmapCache(true) |
151 , m_usePixmapCache(true) |
153 |
154 |
154 static QString uniqueName(const QString &key, GtkStateType state, GtkShadowType shadow, |
155 static QString uniqueName(const QString &key, GtkStateType state, GtkShadowType shadow, |
155 const QSize &size, GtkWidget *widget = 0) |
156 const QSize &size, GtkWidget *widget = 0) |
156 { |
157 { |
157 // Note the widget arg should ideally use the widget path, though would compromise performance |
158 // Note the widget arg should ideally use the widget path, though would compromise performance |
158 QString tmp = QString(QLS("%0-%1-%2-%3x%4-%5")).arg(key).arg(uint(state)).arg(shadow) |
159 QString tmp = key |
159 .arg(size.width()).arg(size.height()).arg(quintptr(widget)); |
160 % HexString<uint>(state) |
|
161 % HexString<uint>(shadow) |
|
162 % HexString<uint>(size.width()) |
|
163 % HexString<uint>(size.height()) |
|
164 % HexString<quint64>(quint64(widget)); |
160 return tmp; |
165 return tmp; |
161 } |
166 } |
162 |
167 |
163 |
168 |
164 GtkStateType QGtkPainter::gtkState(const QStyleOption *option) |
169 GtkStateType QGtkPainter::gtkState(const QStyleOption *option) |