AlbertoN
16th April 2013, 21:04
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:
QIcon m_icon;
m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Active,QIcon::On);
m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Normal,QIcon::On);
m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Disabled,QIcon::On);
m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Selected,QIcon::On);
m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Active,QIcon::Off);
m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Normal,QIcon::Off);
m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Disabled,QIcon::Off);
m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Selected,QIcon::Off);
...
QToolBox *tb = new QToolBox(this);
tb->addItem(new QWidget(this),m_icon,"example");
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
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:
QIcon m_icon;
m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Active,QIcon::On);
m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Normal,QIcon::On);
m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Disabled,QIcon::On);
m_icon.addFile(":/icons/selected.png",QSize(),QIcon::Selected,QIcon::On);
m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Active,QIcon::Off);
m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Normal,QIcon::Off);
m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Disabled,QIcon::Off);
m_icon.addFile(":/icons/unselected.png",QSize(),QIcon::Selected,QIcon::Off);
...
QToolBox *tb = new QToolBox(this);
tb->addItem(new QWidget(this),m_icon,"example");
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