I want to read measured data from a device. At first the device tells me what data I can read from it, then the user is able to select the data he wants to measure. He can set an intervall time for measuring and then start the process.
//"monitorwindow.h"
//"monitorwindow.h"
QStringList AvailableData;
QCheckBox *DataCheckbox[];
To copy to clipboard, switch view to plain text mode
This is the first proto type of the list that will be created (because communication to the device isn't ready yet):
void MonitorWindow::on_CreateListButton_clicked(){
AvailableData.append("Temp1");
AvailableData.append("Temp2");
AvailableData.append("Temp3");
AvailableData.append("Temp4");
QLabel* tempLabel
[AvailableData.
count()];
for (int i = 0; i< AvailableData.count(); i++){
connect(DataCheckbox[i],SIGNAL(clicked()),SLOT(setTransducerFlags()));
horizontalLayout[i]->addWidget(DataCheckbox[i]);
tempLabel[i]->setText(AvailableData.at(i));
horizontalLayout[i]->addWidget(tempLabel[i]);
horizontalLayout[i]->setStretch(1,9);
verticalLayout->addLayout(horizontalLayout[i]);
}
ui->groupBox->setLayout(verticalLayout);
}
void MonitorWindow::on_CreateListButton_clicked(){
QVBoxLayout* verticalLayout = new QVBoxLayout;
AvailableData.append("Temp1");
AvailableData.append("Temp2");
AvailableData.append("Temp3");
AvailableData.append("Temp4");
QLabel* tempLabel[AvailableData.count()];
QHBoxLayout* horizontalLayout[AvailableData.count()];
for (int i = 0; i< AvailableData.count(); i++){
DataCheckbox[i] = new QCheckBox;
tempLabel[i] = new QLabel;
horizontalLayout[i] = new QHBoxLayout;
connect(DataCheckbox[i],SIGNAL(clicked()),SLOT(setTransducerFlags()));
horizontalLayout[i]->addWidget(DataCheckbox[i]);
tempLabel[i]->setText(AvailableData.at(i));
horizontalLayout[i]->addWidget(tempLabel[i]);
horizontalLayout[i]->setStretch(1,9);
verticalLayout->addLayout(horizontalLayout[i]);
}
ui->groupBox->setLayout(verticalLayout);
}
To copy to clipboard, switch view to plain text mode
On the basis of this list I want to create a tableview that shows me the selected data in different columns while measuring. But I really have no idea of creating a tableview dynamically, I always worked on the base of a model (that already was created).
So step by step. How can I add a new column and set the columnheader text to AvailableData.at(i)?
Thank You!
Bookmarks