resizing based on contents implicit sizes
still to be made a tad more reliable
This commit is contained in:
parent
8ea0de9892
commit
7e96fe9000
@ -42,7 +42,7 @@ ConfigView::ConfigView(AppletInterface *interface, QWindow *parent)
|
|||||||
qWarning() << "Invalid home screen package";
|
qWarning() << "Invalid home screen package";
|
||||||
}
|
}
|
||||||
|
|
||||||
setResizeMode(QQuickView::SizeRootObjectToView);
|
setResizeMode(QQuickView::SizeViewToRootObject);
|
||||||
|
|
||||||
|
|
||||||
QQmlComponent *component = new QQmlComponent(engine(), QUrl::fromLocalFile(m_appletInterface->applet()->package().filePath("ui", "config.qml")), this);
|
QQmlComponent *component = new QQmlComponent(engine(), QUrl::fromLocalFile(m_appletInterface->applet()->package().filePath("ui", "config.qml")), this);
|
||||||
@ -76,4 +76,12 @@ void ConfigView::hideEvent(QHideEvent *ev)
|
|||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigView::resizeEvent(QResizeEvent *re)
|
||||||
|
{
|
||||||
|
rootObject()->setWidth(re->size().width());
|
||||||
|
rootObject()->setHeight(re->size().height());
|
||||||
|
QQuickWindow::resizeEvent(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "moc_configview.cpp"
|
#include "moc_configview.cpp"
|
||||||
|
@ -40,6 +40,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void hideEvent(QHideEvent *ev);
|
void hideEvent(QHideEvent *ev);
|
||||||
|
void resizeEvent(QResizeEvent *re);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AppletInterface *m_appletInterface;
|
AppletInterface *m_appletInterface;
|
||||||
|
@ -32,10 +32,13 @@ QtObject {
|
|||||||
id: iconsPage
|
id: iconsPage
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
implicitWidth: mainColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
property alias cfg_Test: testConfigField.text
|
property alias cfg_Test: testConfigField.text
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
id: pageColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 4
|
spacing: 4
|
||||||
Row {
|
Row {
|
||||||
|
@ -88,13 +88,20 @@ Rectangle {
|
|||||||
Column {
|
Column {
|
||||||
id: mainColumn
|
id: mainColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
property int implicitWidth: Math.max(contentRow.implicitWidth, buttonsRow.implicitWidth) + 8
|
||||||
|
property int implicitHeight: contentRow.implicitHeight + buttonsRow.implicitHeight + 8
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
id: contentRow
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
spacing: 4
|
spacing: 4
|
||||||
height: parent.height - buttonsRow.height
|
height: parent.height - buttonsRow.height
|
||||||
|
property int implicitWidth: categoriesScroll.implicitWidth + pageScroll.implicitWidth
|
||||||
|
property int implicitHeight: Math.max(categoriesScroll.implicitHeight, pageScroll.implicitHeight)
|
||||||
|
|
||||||
PlasmaExtras.ScrollArea {
|
PlasmaExtras.ScrollArea {
|
||||||
id: categoriesScroll
|
id: categoriesScroll
|
||||||
anchors {
|
anchors {
|
||||||
@ -103,6 +110,8 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
visible: configDialog.configPages.length > 0 && globalConfigPages.length > 0
|
visible: configDialog.configPages.length > 0 && globalConfigPages.length > 0
|
||||||
width: visible ? 100 : 0
|
width: visible ? 100 : 0
|
||||||
|
implicitWidth: width
|
||||||
|
implicitHeight: theme.defaultFont.mSize.height * 12
|
||||||
Flickable {
|
Flickable {
|
||||||
id: categoriesView
|
id: categoriesView
|
||||||
contentWidth: width
|
contentWidth: width
|
||||||
@ -149,12 +158,15 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlasmaExtras.ScrollArea {
|
PlasmaExtras.ScrollArea {
|
||||||
|
id: pageScroll
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
margins: 4
|
margins: 4
|
||||||
}
|
}
|
||||||
width: parent.width - categoriesScroll.width - 8
|
width: parent.width - categoriesScroll.width - 8
|
||||||
|
implicitWidth: main.currentPage ? main.currentPage.implicitWidth : 0
|
||||||
|
implicitHeight: main.currentPage ? main.currentPage.implicitHeight : 0
|
||||||
Flickable {
|
Flickable {
|
||||||
contentWidth: width
|
contentWidth: width
|
||||||
contentHeight: main.height
|
contentHeight: main.height
|
||||||
@ -167,6 +179,8 @@ Rectangle {
|
|||||||
property Component sourceComponent
|
property Component sourceComponent
|
||||||
onSourceComponentChanged: {
|
onSourceComponentChanged: {
|
||||||
replace(sourceComponent)
|
replace(sourceComponent)
|
||||||
|
root.width = mainColumn.implicitWidth
|
||||||
|
root.height = mainColumn.implicitHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user