[Qt-interest] QToolButton, no icons in menu?
Daniel Franke
franke.daniel at gmail.com
Sun Jun 20 17:49:52 CEST 2010
On Sunday 20 June 2010 17:25:47 Daniel Franke wrote:
> 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
This is once more one of those send-question-find-answer-five-minutes-later
mails.
http://doc.qt.nokia.com/4.6/qaction.html#iconVisibleInMenu-prop
i.e. chaning the previously attached code to ...
foreach (QString name, QColor::colorNames()) {
QAction *action = menu.addAction(colorIcon(QColor(name), QSize(16, 16)),
name);
action->setIconVisibleInMenu(true);
}
... works as expected.
Please excuse the noise.
Daniel
More information about the Qt-interest-old
mailing list