Gui: port new code to Qt6

This commit is contained in:
wmayer
2023-10-12 08:37:05 +02:00
committed by wwmayer
parent 5f072c9fa4
commit 3ba5cd569d
5 changed files with 92 additions and 19 deletions

View File

@@ -1298,10 +1298,18 @@ int TreeWidget::iconSize() {
static int defaultSize;
if (defaultSize == 0) {
auto tree = instance();
if(tree)
if(tree) {
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
defaultSize = tree->viewOptions().decorationSize.width();
else
#else
QStyleOptionViewItem opt;
tree->initViewItemOption(&opt);
defaultSize = opt.decorationSize.width();
#endif
}
else {
defaultSize = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
}
}
if (treeIconSize() > 0)
return std::max(10, treeIconSize());