Commit c315020a authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

force-resize columns in the wayland module

inspired by similar code in the opengl module. since tree columns can
have wildly different size requirements based on the content we'll want
to resize them to ensure labels can be displayed completely

BUG: 433327
FIXED-IN: 5.21.3
parent 7ef1d289
/*
Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
Copyright 2021 Harald Sitter <sitter@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -66,6 +67,15 @@ void WaylandModule::init()
auto interfacesItem = new QTreeWidgetItem(compositorItem, QStringList() << i18n("Interfaces") << i18n("Interface Version"));
interfacesItem->setExpanded(true);
auto resizeColumns = [this] {
for (int i = 0; i < m_tree->columnCount(); ++i) {
m_tree->resizeColumnToContents(i);
}
};
connect(m_tree, &QTreeWidget::expanded, this, resizeColumns);
connect(m_tree, &QTreeWidget::collapsed, this, resizeColumns);
connect(m_tree->model(), &QAbstractItemModel::dataChanged, this, resizeColumns);
connect(m_connection, &ConnectionThread::connected, this,
[this, compositorItem, interfacesItem] {
Registry *registry = new Registry(this);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment