yes, i know its a template, pardon me, a QList<QString> . I didnt think it mattered much.
I dont understand what you mean by "your wizard class public interface" ? Maybe I am missing something?
yes, i know its a template, pardon me, a QList<QString> . I didnt think it mattered much.
I dont understand what you mean by "your wizard class public interface" ? Maybe I am missing something?
Well, it does, because QStringList is already registered to be used with QVariant.
I mean two methods in your wizard class's "public" section - one for setting the value and the other for getting it. Look at the code Lykurg has written, "table()" is the getter method and "setTable(QTableWidget*)" would be a setter method.I dont understand what you mean by "your wizard class public interface" ? Maybe I am missing something?
Still you didn't answer what you want to do with this all so maybe there are tons of better way to do what you want.
I want for the QTableWidget *tableDisplay from the first QWizardPAGE to be accesible to the second, the third and so on Pages. So that i can use them for default values, exacty what the field() does.
The only problem is that I am not competent enough; I dont know how to pass my own variables through registerField().
If I have a QStringList created in Page1, i would like to access it in Page2 and Page3..
in void myPage2::initializePage() {
myObject list = field("some_field_registered_from_page1") <-- something like this...
}
It's not what the field() does. To me it seams you need a model in your wizard. Then you can set this model to a QTableView (or QListView) in the first wizard page and also access the model from other pages. field() should represent a single value, not all possible values.
Umh... so how would i access the model from the QWizard class from inside the Pages ? Pass it to their constructor ?
You can do it any way you see fit. C++ allows for many solutions to this problem. For instance each page has a pointer to the wizard object it is part of.
"For instance each page has a pointer to the wizard object it is part of. "
you mean wizard() ?
Qt Code:
class myWizard : public QWizard { Q_OBJECT public: whatever* m_member; } in the myWizard constructor i do : addPage( new myPage1( ) ); wizard()->m_member ? (is this supposed to work?) (apparently it doesnt) (thats basically what i want :D ) }To copy to clipboard, switch view to plain text mode
Can I reimplement ::next ? http://doc.trolltech.com/4.5/qwizard.html#next [slot] (doesnt say virtual, but I'm no c++ expert)
I do realise your time is more precious than mine, so I *am* thankful.
Last edited by BillGates; 6th May 2010 at 18:07.
Yes, you can cast it to a proper type and use your methods.
Qt Code:
MyWizard *wiz = qobject_cast<MyWizard*>(wizard()); // or static_cast if MyWizard doesn't have Q_OBJECT macro wiz->something();To copy to clipboard, switch view to plain text mode
Reimplement nextId().Can I reimplement ::next ? http://doc.trolltech.com/4.5/qwizard.html#next [slot] (doesnt say virtual, but I'm no c++ expert)
BillGates (6th May 2010)
Thanks so much for the code snippet, I didnt find this anywhere, in no example! Perhaps they considered normal people would know this..(qobject_cast). I had no clue that that must be done :< Thank you
About ::next(), I understand you are saying to Not reimplement ::next, but reimplement ::nextId() instead. I want to do some stuff when the user clicks "next" so ::next() seems more intuitive.. Basically, you are saying to "do some stuff" not in ::next but in ::nextId() ?
Qt Code:
i was thinking void myWizard::next() { ..do some stuff... QWizard::next(); } is this wrong in any way ?To copy to clipboard, switch view to plain text mode
PS: apparently if I do in myWizard constructor :
setButton(QWizard::NextButton, mybuton);
connect ( mybuton, SIGNAL(clicked()), this, SLOT(my_slot()));
my_slot() is executed AFTER the next Page's initializePage() ?!?! (is this logical?)
Last edited by BillGates; 6th May 2010 at 21:33.
It's there in many places, I assure you.
No, in that case you need to reimplement QWizardPage::initializePage() on the next page you want to show.About ::next(), I understand you are saying to Not reimplement ::next, but reimplement ::nextId() instead. I want to do some stuff when the user clicks "next" so ::next() seems more intuitive..
Yes, it's logical.PS: apparently if I do in myWizard constructor :
setButton(QWizard::NextButton, mybuton);
connect ( mybuton, SIGNAL(clicked()), this, SLOT(my_slot()));
my_slot() is executed AFTER the next Page's initializePage() ?!?! (is this logical?)
Read this article, it might help you understand how wizards work:
http://doc.trolltech.com/qq/qq22-qwizard.html
ok, i dont know if this is normal or not.... but apparently after casting i cannot access data members of wiz-> or even methods of wiz that themselves access members of the wizard object. I get a SIGSEGV upon running the program...(tried with static_cast too, although i have the q_object macro)
Check if wizard() doesn't return 0 or that qobject_cast doesn't return 0.
Bookmarks