how to populate and control the one qcombo box elements from another qcombo box
-
Hi
Your sentence is a bit broken ;)
You mean ?
You have 2 combos
Combo 1 display
aaa
bbb
cccc
Combo 2 display
nothing yet.You click on aaa
now Combo 2 display
Related to aaaKind of way ?
-
first qcombox having ticket_printer,bill_acceptor
second qcombox having slot_admin,smartcard,tckt_in,tckt_out,bill_acceptor_in,bill_acceptor_outif i choose bill_acceptor in first qcombo box ,in second qcombo box need to show bill_acceptor_in,bill_acceptor_out only not all in second qcombo box .....
-
QAbstarctItemModel* model = new QStandardItemModel(this); model->insertColumn(0); model->insertRows(0,2); auto rootIdx = model->index(0,0); model->setData(rootIdx,"ticket_printer"); model->insertColumn(0,rootIdx); model->insertRows(0,4,rootIdx); model->setData(model->index(0,0,rootIdx),"slot_admin"); model->setData(model->index(1,0,rootIdx),"smartcard"); model->setData(model->index(2,0,rootIdx),"tckt_in"); model->setData(model->index(3,0,rootIdx),"tckt_out"); rootIdx = model->index(1,0); model->setData(rootIdx,"bill_acceptor"); model->insertColumn(0,rootIdx); model->insertRows(0,2,rootIdx); model->setData(model->index(0,0,rootIdx),"bill_acceptor_in"); model->setData(model->index(1,0,rootIdx),"bill_acceptor_out"); combo1->setModel(model); combo2->setModel(model); connect(combo1, QOverload<int>::of(&QComboBox::currentIndexChanged),[=](int idx){combo2->setRootModelIndex(model->index(idx,0)); });
-
@VRonin said in how to populate and control the one qcombo box elements from another qcombo box:
QAbstarctItemModel* model = new QStandardItemModel(this);
@VRonin ,
Thanks a lot ,i have already dialog gui window everything i put into the qcombo boxes.here in this above code you are manually creating it ?