PDA

View Full Version : Margins for QListWidgetItem does not work



luk_man_
17th May 2016, 10:46
Hi,

I have a problem - I created QListWidget that contains QPushButtons and I would like to make space between these buttons, but function setContentsMargins doesn't work.
Do you have any idea, what it do that?

Snippets - creating QListWidgetItem and set margins:

QListWidgetItem *item = new QListWidgetItem;
QPushButton *button = new QPushButton(ui->listMenuWidget);
button->setContentsMargins(20, 10, 20, 10);
ui->listMenuWidget->addItem(item);
ui->listMenuWidget->setItemWidget(item, button);

I created several buttons and what is also important, each of them has a border, so i can't use i.e. padding.


I have lost a few hours on it and I have no clue how I can do that.

BR!