Is it possible to get QToolBox widget’s page name, in run time?
I have a QToolBox and adding pages to it in runtime
Each page has scroll area, inside scroll area comboboxes area dded at runtime
Is it possible to get page name of any particular combobox?
i tried code shown below, but it didnt work…
- std::cout<<"FILE NAME:"<<fname.toStdString()<<endl;
also tried using
but program was crashing both time….
5 replies
As a generic comment, whenever using dynamic_cast (or object_cast, any of those that return 0 if the cast failed), it is always recommendable to check the result for 0 before continuing. If it is “certain” that the cast should not fail, use an assert. Doing so will always catch problems right when they occur, not later when some other element is accessed through a zero pointer.
Thank u all…
But how can i get page name in QToolBox….
I tried as below….i got pointer to QToolBox….
But whenever i try to get page name of any widget it just returns nothing…always index is -1….:(
please tell me whats wrong here?
- {
- if(!tempCheckBox)
- {
- cout<<"no check box"<<endl;
- return;
- }
- if(!parent)
- {
- cout<<"np page for this widget"<<endl;
- return;
- }
- while(parent)
- cout<<"the parent class is:"<<classname.toStdString() <<endl;
- if(classname=="QToolBox")
- std::cout<<"the tool box page name:"<<temp->itemText(temp->indexOf(tempCheckBox)).toStdString()<<endl;
- cout<<"the index is :"<<temp->indexOf(tempCheckBox)<<endl;
- }
- parent=parent->parentWidget();
- }
- }
You must log in to post a reply. Not a member yet? Register here!



