Hello,
For my program, I need to draw a toolbar-style handle (the grip on the left of toolbars to move/undock them) onto a pixmap.
I've done this code:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
// PREPARE THE PIXMAP:
m_handlePixmap.resize(59, 39);
painter.begin(&m_handlePixmap);
// FILL IT FOR TEST PURPOSE:
QBrush brush(Qt::black);
painter.fillRect(QRect(0, 0, 59, 39), brush);
// DRAW THE HANDLE:
((KStyle&)(kapp->style())).drawKStylePrimitive(KStyle::KPE_ToolBarHandle,
&painter,
this,
QRect(0, 0, 19, 19),
colorGroup(),
QStyle::Style_Default);
painter.end();
|
I've created a pixmap and filled it with black.
I've drawn the handle in a smaller portion of this pixmap ("this" pointer is a QWidget).
When displaying the reesulting pixmap, a small white rectangle is inside the black rectangle.
So, the drawKStylePrimitive do something, but only filling the area of white and not drawing an handle in this area!
Does anyone know how to make it work?
Thanks.