Re: Dynamic number of QLabel
Quote:
Originally Posted by
jd
Code:
void CMainWindow::displayDongleData() {
and is CMainWindow shown? What is CMainWindow? have you called "app.exec()" in main?
Quote:
Originally Posted by
jd
Code:
int x = 0;
for (int i; i<plainDongle->DNG_Memmory/4; i++) {
dongleDataLabel[i]->setText(tr("Value "+i));
dongleLayout->addWidget(dongleDataLabel[i], x, 0);
dongleLayout->addWidget(dongleDataLineEdit[i], x, 1);
x++;
}
}
You don't need "int x" just use "i". And better use "i<dongleDataLabel.size()"
EDIT: once you have "dongleDataLabel." and once "dongleDataLabel->"? but that must result in an compiler error...
Re: Dynamic number of QLabel
Argh!
The mistake was her:
Code:
for (int i; i<plainDongle->DNG_Memmory/4; i++) {
i has no value...
so my program starts, but i have another problem with my layout.
If i call
Code:
setLayout(dongleLayout);
I become an error, wicht a layout is already set. How can I add my dongleLayout to CMainWindow?
CMainWindow is my QMainWindow I've created this with QtDesigner.
I can't found a function addLayout.
The error:
QWidget::setLayout: Attempting to add QLayout "" to QWidget "layoutWidget", which already has a layout