Results 1 to 3 of 3

Thread: QToolBoxitem issue

  1. #1
    Join Date
    Apr 2010
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default QToolBoxitem issue

    Hi all,

    i'm posting because i can't set a QToolBox's iconset with QToolBox's addItem method. For iconset i mean an icon which can change on item changes...

    I'll try to provide a snippet of code:
    Qt Code:
    1. QIcon m_icon;
    2. m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Active,QIcon::On);
    3. m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Normal,QIcon::On);
    4. m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Disabled,QIcon::On);
    5. m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Selected,QIcon::On);
    6.  
    7. m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Active,QIcon::Off);
    8. m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Normal,QIcon::Off);
    9. m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Disabled,QIcon::Off);
    10. m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Selected,QIcon::Off);
    11. ...
    12. QToolBox *tb = new QToolBox(this);
    13. tb->addItem(new QWidget(this),m_icon,"example");
    To copy to clipboard, switch view to plain text mode 

    even if resource path are right, there are no typo and so on it doesn't work. Reading on google maybe i get the point: changes happens only if the button's checkable property is true. So button saves its "state".
    Infact i tried to implement a little example with designer and it works only if i set that property. My issue is that there is no way to set up that property on standard QToolBox's item.
    I missed something important or could it be a QToolBox's bug?
    I'm going to attach my simple designer example(toolboxbutton.zip) so anyone can check it works properly and another example using QToolBox's standard item (notworking.zip)

    Thanks for your help.
    Alberto
    Attached Files Attached Files
    Last edited by AlbertoN; 16th April 2013 at 22:27.

  2. #2
    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: QToolBoxitem issue

    Ok, so we know it "doesn't work" but we have no idea what you were expecting to happen.

    The On state is only relevant if the widget is checkable/toggle-able.
    The Active mode Off state would need to be different to the other Off state images if you ware expecting a on-hover or while-clicked change.
    The separate images are only used by widgets that a written to use them.

  3. #3
    Join Date
    Apr 2010
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: QToolBoxitem issue

    I'd like that icon change on click, to highlight current "selected" tab, as it happens on QToolBox (like) used in Qt Designer to hold widgets...
    Reading source code of QToolBox as far as I could understand the button is just a QToolButton, to let it work you should only provide a QToolBox::setCheckable method to change its state...that's all

Similar Threads

  1. Qt 5.0.1 Issue
    By kiboi in forum Qt-based Software
    Replies: 0
    Last Post: 22nd March 2013, 05:22
  2. MS C++ issue
    By sepehr in forum Installation and Deployment
    Replies: 4
    Last Post: 29th December 2008, 23:45
  3. XML issue
    By jbpvr in forum Qt Programming
    Replies: 1
    Last Post: 25th August 2008, 13:01
  4. ui_....h issue
    By stevey in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 04:54
  5. qt3 to qt4 - uic issue
    By hvengel in forum Qt Programming
    Replies: 10
    Last Post: 4th March 2007, 02:59

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.