PDA

View Full Version : Why QDesigner does not include QListWidgetItem in myfile.h when I use 'gotoslot' ?



tonnot
24th March 2011, 11:54
I'like Qdesigner would include <QListWidgetItem> when I use the 'gotoSlot' on a QListWidget-listitemclicked. Now I have to do manually.

Now, Designer only write this line by me (when a use gotoslot ) :

void on_listWidget_itemClicked(QListWidgetItem* item);
But the ui_ui.h file does not include <QListWidgetItem>

So, I have to include <QListWidgetItem>, because if not I have an error.
I'm doing some bad? Why does not designer does the work ?

(If I'm going to use this slot .... it does not sense I have not include <QListWidgetItem>)
Any help ? Maybe it be a future feature of Designer ?Thanks.

wysota
24th March 2011, 13:15
Why should it include this file? You added the slot so you have to add the include file in the form's settings dialog if you want it there.

tonnot
24th March 2011, 13:51
WY.
If I use a QListWidget, Designer 'writes' the consecuent #include <QListWidget>
If I use GotoSlot and choose QListItemclicked , and it does not going to work if there is
not include #include <QListWidgetItem> .... .... (It does not have sense...)
I think there is a missing feature of Designer, dont you think ?
Where is the correct place to suggest this ?
Thanks

wysota
24th March 2011, 14:11
WY.
If I use a QListWidget, Designer 'writes' the consecuent #include <QListWidget>
Yes, because setupUi() calls methods from QListWidget class.


If I use GotoSlot and choose QListItemclicked , and it does not going to work if there is
not include #include <QListWidgetItem> .... .... (It does not have sense...)
What is not going to work? You write the code in a subclass that has its own compilation unit. You can place the include there. The ui.h file doesn't need it, it only has a pointer to the object and that doesn't require an include.


I think there is a missing feature of Designer, dont you think ?
No, not really.

Where is the correct place to suggest this ?
In Qt bug tracker.