Results 1 to 2 of 2

Thread: QStyle Standard Icons

  1. #1
    Join Date
    May 2011
    Location
    Sheffield
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QStyle Standard Icons

    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:

    Qt Code:
    1. playAction = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this);
    2. playAction->setShortcut(tr("Ctrl+P"));
    To copy to clipboard, switch view to plain text mode 

    each action is added to a QToolBar...

    Qt Code:
    1. transportBar = new QToolBar;
    2. transportBar->addAction(playAction);
    To copy to clipboard, switch view to plain text mode 

    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:

    Qt Code:
    1. recordAction = new QAction(tr("Record"), this);
    2. recordAction->setIcon(QIcon(":/images/recordbuttonavailable.png"));
    3. recordAction->setShortcut(tr("Ctrl+R"));
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QStyle Standard Icons

    Hi,

    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.

Similar Threads

  1. Replies: 2
    Last Post: 14th July 2011, 12:28
  2. Standard buttons/icons?
    By MTK358 in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2010, 17:24
  3. Lack of icons and standard C++ libraries
    By Trok in forum Installation and Deployment
    Replies: 0
    Last Post: 18th June 2009, 22:54
  4. Replies: 2
    Last Post: 2nd June 2008, 08:45
  5. Why QStyle dosen't changes the standard font?
    By Dark_Tower in forum Newbie
    Replies: 8
    Last Post: 31st March 2006, 02:49

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.