You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, May 29th 2005, 1:10pm

Draw toolbar-style handle onto a pixmap

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.
BasKet's (take notes and keep a full range of data on hand) author:
http://basket.kde.org/
http://kde-apps.org/content/show.php?content=10020

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Monday, May 30th 2005, 1:56pm

Could be that you have to pass a KToolBar as the widget

Cheers,
_
Qt/KDE Developer
Debian User