Dear forum
I can add to my QListWidget label, button,radiobutton and other, and all is working.
All items appear in vertical....1 for every line....and all work ok.
Also a scrollbar compare when the number of items occupy more space than the list.
Problem start when i want for example, put in 1 line ,2 buttom (or more) and not only 1.
So, I just try to insert only 2 button in horizontal, using the class QHBoxLayout ,then
create 2 button, and put this 2 button inside,like in next code:
QHBoxLayout *HLay= new QHBoxLayout();
QPushButton *b1 = new QPushButton("B1");
QPushButton *b2 = new QPushButton("B2");
HLay->addWidget(b1);
HLay->addWidget(b2);
and now, i would like to insert this HLay in the QListWidget. So, create
the List:
QListWidget *List= new QListWidget(window);
QListWidgetItem *ListItem=new QListWidgetItem();
List->addItem(ListItem);
List->setItemWidget(ListItem,HLay); //!!!!!!!!ERROR
Last line of code is not correct because setItemWidget () accept Qwidget type
and so not the HLay.
Some help.
Thanks for your time.
Roberto
Bookmarks