Hello
Is it possible to create an array of Widgets inside the ui file?
Something like 3 QPushButtons that could then be used as :
array[0]->setText("blá");
Thanks
Hello
Is it possible to create an array of Widgets inside the ui file?
Something like 3 QPushButtons that could then be used as :
array[0]->setText("blá");
Thanks
No, but you can create such an array in the widget subclass you implement to use the ui file.
gt.beta2 (25th February 2009)
And how can i put them in the interface along with the other widgets already created using Designer?!
Here is a possibility:
Qt Code:
#include "dialog.h" #include "ui_dialog.h" { ui->setupUi(this); array[0] = ui->l1; array[1] = ui->l2; array[2] = ui->l3; for(int i = 0; i < 3 ; i++) array[i]->setText("yess!"); } Dialog::~Dialog() { delete ui; }To copy to clipboard, switch view to plain text mode
l1, l2 and l3 are QLineEdit objects created using Designer.
array[0], array[1] and array[2] are the "clones"![]()
Yes, that's exactly what I meant. And they are not clones, they are just pointers to the same data.
Bookmarks