[SOLVED]QML Settings Type seems to have no effect on window size.
-
wrote on 28 Feb 2016, 10:18 last edited by ealione
I have decided to use
Qt.labs.settings 1.0
to save the state of my window in this manner:ApplicationWindow { // Main configuration section for the application window id: mainwindow visible: true // Needed if loading from c++. property string accentchosen: "#F4511E" height: Units.dp(600) minimumHeight: Units.dp(500) maximumHeight: Units.dp(1200) width: Units.dp(800) minimumWidth: Units.dp(300) maximumWidth: Units.dp(1080) Settings { id: settings property alias x: mainwindow.x property alias y: mainwindow.y property alias width: mainwindow.width property alias height: mainwindow.height property alias accentchosen: mainwindow.accentchosen }
This code will result in my application starting on the x and y position it was last on, but its width and height do not seem to follow their last state, instead they keep being 600x800.
According to the docs the second time, and each subsequent time after that it should remember its state. Am I doing something wrong?
-
wrote on 28 Feb 2016, 19:57 last edited by
Does it work without Units.dp()?
-
wrote on 28 Feb 2016, 20:24 last edited by
How is Units.dp() implemented?
-
wrote on 28 Feb 2016, 20:31 last edited by
This function comes from the qml-material module that can be found here. It will simply return a new number based on the pixel density of the device, in order for the units to be screen independent. Now since what I get is a number I imagined nothing would go wrong.
PS: I should have provided all this info from the start, I apologize about that.
-
This function comes from the qml-material module that can be found here. It will simply return a new number based on the pixel density of the device, in order for the units to be screen independent. Now since what I get is a number I imagined nothing would go wrong.
PS: I should have provided all this info from the start, I apologize about that.
-
wrote on 29 Feb 2016, 17:41 last edited by
I see, so I should find another way of saving this data. Thanks for the answer jpnurmi.
-
wrote on 2 Mar 2016, 06:00 last edited by
@ealione It's still worth opening a ticket at bugreports.qt.io though. If it cannot be fixed, it probably should be noted in the docs. :)
-
wrote on 6 Mar 2016, 11:28 last edited by ealione 3 Jun 2016, 11:28
OK, Just created a new issue https://bugreports.qt.io/browse/QTBUG-51697
1/9