Unsolved Dynamically creating checkboxes
Actually, i need to create checkboxes dynamically as per user requirements, so which one is the better approach, should i go for scroll area then create checboxes inside that or is there any better approach pls let me know.
VRonin last edited by
Normally in these cases you don't need checkboxes but a checkable list like QListWidget
mrjj Lifetime Qt Champion last edited by
as @VRonin saids a ListWidget with ItemIsUserCheckable is
often a far better solution than scrollarea.
QListWidgetItem* item = new QListWidgetItem("item", listWidget);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
item->setCheckState(Qt::Unchecked); // AND initialize check state ( not sure its 100% needed but i like to be sure :)