Results 1 to 7 of 7

Thread: [duplicate] Qt stock items ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2014
    Posts
    3
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [duplicate] Qt stock items ?

    Hi all.

    Are there stock items in Qt, such as those provided by GTK ?

    http://pygtk.org/docs/pygtk/gtk-stock-items.html

    For instance, to create a OK buttons, setting the OK stock item sets the right themable icon in the button, along with a localized text.

    I can't seem to find anything equivalent in Qt.

    Thanks in advance.

    Edit: Sorry, I found a few leads after posting. Marking as duplicate.

    http://www.qtcentre.org/threads/17965-Stock-Icons
    http://www.qtcentre.org/threads/3191...-buttons-icons
    http://doc.qt.digia.com/4.6/qdialogbuttonbox.html

    I'm using a buttonbox. Apparently, it is localized. Although I don't see how to set icons.
    Last edited by JeromeQt; 21st March 2014 at 08:48. Reason: duplicate

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [duplicate] Qt stock items ?

    The buttons have icons set if that is what the current theme is supposed to do.

    If you want to override icons, you can get each button using the QDialogButtonBox::button() method.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    JeromeQt (21st March 2014)

  4. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [duplicate] Qt stock items ?

    Use this stylesheet : QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; }

  5. The following user says thank you to Lesiok for this useful post:

    JeromeQt (21st March 2014)

  6. #4
    Join Date
    Mar 2014
    Posts
    3
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [duplicate] Qt stock items ?

    Thanks !

    Apparently my theme (default Xfce theme on Debian and default on Windows 7 ) does not use icons, and using the stylesheet adds them.

    In QtDesigner, the locale of the buttonbox is set to French as default. The locale of my system is also French (fr_FR.UTF-8). However, the buttons are displayed in english.

  7. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [duplicate] Qt stock items ?

    Maybe try to explicitly load the Qt translations.
    See the code example a bit down from here http://qt-project.org/doc/qt-4.8/int...e-translations

    Cheers,
    _

  8. #6
    Join Date
    Mar 2014
    Posts
    3
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [duplicate] Qt stock items ?

    Thanks, I'll have a look. If I'm stuck, I'll create a dedicated thread.

  9. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: [duplicate] Qt stock items ?

    The available stock icons can be accessed directly through QStyle::standardIcon() and the StandardPixmap enum. You can apply these images to any button or other place taking an icon in code but not from Designer. The QDialogButtonBox draws from these for OK, Cancel etc. They are provided by the style, so there is no one set of images.
    Last edited by ChrisW67; 24th March 2014 at 00:11.

Similar Threads

  1. How to iterate through GraphicsScene items using items()
    By MercyYuen in forum Qt Programming
    Replies: 5
    Last Post: 10th October 2012, 15:51
  2. Replies: 1
    Last Post: 24th January 2012, 20:53
  3. Replies: 2
    Last Post: 20th August 2010, 05:18
  4. Read live stock quoted from a website using qt4 c++?
    By abghosh in forum Qt Programming
    Replies: 4
    Last Post: 21st February 2010, 03:08
  5. Stock Icons
    By wswartzendruber in forum Newbie
    Replies: 2
    Last Post: 14th February 2009, 09:31

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
  •  
Qt is a trademark of The Qt Company.