Commit 76ea7842 authored by Marco Martin's avatar Marco Martin

make qml widget size based upon qml item implicitwidth

parent 2759ca41
......@@ -265,8 +265,23 @@ void SidebarMode::initWidget()
d->kdeclarative.setupBindings();
d->quickWidget->setSource(d->package.filePath("mainscript"));
//FIXME
d->quickWidget->setFixedWidth(240);
const int rootImplicitWidth = d->quickWidget->rootObject()->property("implicitWidth").toInt();
if (rootImplicitWidth != 0) {
d->quickWidget->setFixedWidth(rootImplicitWidth);
} else {
d->quickWidget->setFixedWidth(240);
}
connect(d->quickWidget->rootObject(), &QQuickItem::implicitWidthChanged,
this, [this]() {
const int rootImplicitWidth = d->quickWidget->rootObject()->property("implicitWidth").toInt();
if (rootImplicitWidth != 0) {
d->quickWidget->setFixedWidth(rootImplicitWidth);
} else {
d->quickWidget->setFixedWidth(240);
}
});
d->quickWidget->installEventFilter(this);
d->toolTipManager = new ToolTipManager(d->proxyModel, d->quickWidget);
......
......@@ -19,11 +19,11 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.0 as QtControls
import QtQuick.Controls 2.0 as QtControls2
import org.kde.kirigami 2.1 as Kirigami
Kirigami.ApplicationItem {
id: root
implicitWidth: Kirigami.Units.gridUnit * 15
pageStack.initialPage: mainColumn
CategoriesPage {
......
Markdown is supported
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