View Full Version : QStyle Standard Icons

14th December 2011, 20:09
Hello Everyone,

I'm knocking up a data acquisition system, and the PC side of things is done with Qt. Part of the program is a dialogue box with play, pause, rewind, fastforward etc. buttons. To implement these i'm setting up some QActions and assigning standard icons as follows:

playAction = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this);

each action is added to a QToolBar...

transportBar = new QToolBar;

and this plus a few other widgets are arranged by some QHBoxLayouts and QVBoxLayouts to produce an ok looking dialogue box.

The trouble is I want a record button and looking at the Qt Class Reference for QStyle (http://doc.qt.nokia.com/latest/qstyle.html) there isn't one.

So I thought I'd make one, how hard can it be? following in the same theme as above:

recordAction = new QAction(tr("Record"), this);

It works ok, but the image is shockingly bad, I made it by screen dumping the dialogue and reworking one of the other standard icons using the GIMP. Unfortunately I'm not much of a graphic designer. I know that there are good "skins" out there for record buttons and quite a lot of people seem to make a meal out of it using CSS in some way or another. The programmer in me really wants to subclass the image and re-impliment part of it :-) If anyone has an icon for 'record' that is in the style of the standard icons or can give me some graphic design tips on how to do a "near enough" job of making one that would be cool.



14th December 2011, 21:17

for creating icons I would use Inkscape. And if you use the style for standard icons you have the problem, that the user can change his icon theme. So you can never create a icon that fits in, because you can't know the icon theme. Therefore I would look for a whole, custom icon theme to use. There are many good themes for free. Even for commercial software.