PDA

View Full Version : How QTreeWidget 4.8.5 different from 5.2.1?



neosettler
13th March 2014, 07:21
Greetings,

QTreeWidget 5.2.1 refresh differently from 4.8.5 for some reason but I cant find out why so far.

While version 4.8.5 works beautifully, using QTreeWidgetItem::setItemWidget column 1 to a QTreeWidget long enough to display a scrollbar doesn't refresh well when scrolling the QTreeWidget in 5.1. Although, column 0 seText displays well, I'm ending with multiple copies of the widgets in column 1 as if the embedded widgets paint was occurring only partially. Code works perfectly when compiling with 4.8.5 but the same code does not refresh well with 5.2.1.

Any thoughts would be greatly appreciated.

thank you,

ChrisW67
13th March 2014, 07:49
Since we have no idea what you are doing in your code it will be hard to say where the problem lies.

neosettler
13th March 2014, 08:14
Alright, I'll try to simplify my setup as it is rather didficult to extract the whole thing. But mainly it goes like this:


myDockWidget::myDockWidget(QWidget *in_parent): QDockWidget(in_parent),
{
setAllowedAreas(Qt::AllDockWidgetAreas);

m_QLayout = new QBoxLayout(QBoxLayout::TopToBottom);

m_QWidget = AX6_New QWidget();
m_QWidget->setLayout(m_QLayout);
setWidget(m_QWidget);

QStringList l_labels;
l_labels << "Label" << "Value";
m_QTreeWidget = new QTreeWidget(this);
m_QTreeWidget->setHeaderLabels(l_labels);
m_QTreeWidget->setColumnCount(2);
m_QTreeWidget->setAutoFillBackground(true);

m_QLayout->addWidget(m_QTreeWidget);

for (int i = 0; i < 100; ++i)
{
QTreeWidgetItem *l_item = new QTreeWidgetItem(m_QTreeWidget);
l_item->setText(0, "hello");
m_QTreeWidget->setItemWidget(l_item, 1, new QCheckBox());
}
}