Adding a list of flags to a single widget in Qt

I am using Qt Creator 2.0.1 (Qt 4.7). I need a widget that can contain several checkboxes vertically. Flags will be added to the widget dynamically when interacting with another user interface element. The widget will have a fixed width and height, so if there are too many flags, a vertical scroll bar will appear.

What I want is imagine a QListWidget where list items can be checkboxes.

Which widget will allow me to do this?

Thank.

+5
source share
3 answers

QListWidget .

QStringList  itemLabels= getLabels();

QStringListIterator it(itemLabels);
while (it.hasNext())
{
      QListWidgetItem *listItem = new QListWidgetItem(it.next(),listWidget);
      listItem->setCheckState(Qt::Unchecked);
      ui->listWidget->addItem(listItem);
}

, , .

+11

QListWidget QScrollArea , QVBoxLayout. QCheckboxes . updateGeometry() , , .

0

All Articles