[Qt-interest] QToolButton, no icons in menu?

Daniel Franke franke.daniel at gmail.com
Sun Jun 20 17:25:47 CEST 2010


Hi all.

I need a simple color selection tool. A QToolButton that shows the current 
color as its icon, provides the color selection dialog on click and a quick-
selection list of knwon colors (QColor::colorNames) in the popup menu seems to 
be a perfect solution.

In general this works, but

 (a) the menu entries do not show an icon
 (b) there are so many entries in colorNames(), that the menu 
     is shown in multiple columns

I'd like to mainly see the icons for now, but if somebody knowns how to 
confine the menu into a scrollable area (like a combobox), I'd be happy to 
hear about it as well :)

The attached code reproduces the problem (I'm using Qt-4.6.2).
Comments are highly welcome!

Thanke

	Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toolbutton.cpp
Type: text/x-c++src
Size: 731 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100620/9b07906d/attachment.bin 
-------------- next part --------------
######################################################################
# Automatically generated by qmake (2.01a) Sun Jun 20 17:19:31 2010
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .

# Input
SOURCES += toolbutton.cpp


More information about the Qt-interest-old mailing list