greenlinux
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);
playAction->setShortcut(tr("Ctrl+P"));
each action is added to a QToolBar...
transportBar = new QToolBar;
transportBar->addAction(playAction);
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);
recordAction->setIcon(QIcon(":/images/recordbuttonavailable.png"));
recordAction->setShortcut(tr("Ctrl+R"));
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.
Cheers,
James
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);
playAction->setShortcut(tr("Ctrl+P"));
each action is added to a QToolBar...
transportBar = new QToolBar;
transportBar->addAction(playAction);
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);
recordAction->setIcon(QIcon(":/images/recordbuttonavailable.png"));
recordAction->setShortcut(tr("Ctrl+R"));
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.
Cheers,
James