[SOLVED]can not declare QIcon in class?
-
Just for kicks, change the name to m_icon and see what happens.
Obviously it isn't just the fact that you do @QIcon *icon@ in some header. There is more to this. The code snippet you showed is just as good as the description you gave. If the above doesn't work, we will need a lot more context to the problem.
-
can you produce a small example with this problem? (only a small class with QIcon)
-
Hi Franzk,
I'm sorry if i'm not clear here, so i try to explain myself a little better now.
I'm writing a little test program where i want to have a icon shown in a listview.
if i use a function call like:
@ QStandardItem *item = new QStandardItem;
item->setIcon(QIcon(":/icon/pic5"));@
then everything works like a charme.
If i do :
@ QStandardItem *item = new QStandardItem;
QIcon proeficon(":/icon/pic5");
item->setIcon(proeficon);@
everything works like a charme.
If i do:
@ QStandardItem *item = new QStandardItem;
QIcon proeficon;
proeficon.addFile(":/icon/pic5");item->setIcon(proeficon);@
everything works like a charme.
But if i do:
In header:
@
QIcon proeficon;
@
And in the constructor:
@
proeficon.addFile(":/icon/pic5");@
Then my program crashes.I hope i did explain it better now?
-
Solved:
Very strange,
I just copied the whole class to another one and it worked like expected. So there was nothing wrong with the code.
So i deleted the whole build folder to force creator to build again and everything worked perfectly after that.
Does somebody know what was going on here?