Hi,
I am using QUiLoader. Following is my code:
QWidget *form
= loader.
load(&file,
this);
//"this" here refers to the mainwindow class
int i;
QObjectList list;
list = form->children();
for(i = 0; i < list.size(); i++)
{
QString name
= list.
at(i
)->objectName
();
qDebug() <<"object"<< i <<" = "<< name;
}
file.close();
QUiLoader loader;
QFile file(filename);
QWidget *form = loader.load(&file, this); //"this" here refers to the mainwindow class
int i;
QObjectList list;
list = form->children();
for(i = 0; i < list.size(); i++)
{
QString name = list.at(i)->objectName();
qDebug() <<"object"<< i <<" = "<< name;
}
file.close();
To copy to clipboard, switch view to plain text mode
However the output only shows:
object 0 = "_layout"
object 1 = "qt_rubberband"
object 2 = ""
object 3 = "centralwidget"
There are two custom widgets on this form which are being loaded (their constructor called) but their object names are not being listed. Is there something I am missing.
-Charvi
Bookmarks