76
76
function loadWindowState() {
77
77
var windowGeometry = windowStateStorage.getGeometry(root.windowId,
78
Qt.rect(target.requestedX, target.requestedY, defaultWidth, defaultHeight));
80
target.requestedWidth = Qt.binding(function() { return Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth - root.leftMargin); });
81
target.requestedHeight = Qt.binding(function() { return Math.min(Math.max(windowGeometry.height, d.minimumHeight),
78
Qt.rect(target.windowedX, target.windowedY, defaultWidth, defaultHeight));
81
target.windowedWidth = Qt.binding(function() { return Math.min(Math.max(windowGeometry.width, d.minimumWidth), screenWidth - root.leftMargin); });
82
target.windowedHeight = Qt.binding(function() { return Math.min(Math.max(windowGeometry.height, d.minimumHeight),
82
83
root.screenHeight - (target.fullscreen ? 0 : PanelState.panelHeight)); });
83
target.requestedX = Qt.binding(function() { return Math.max(Math.min(windowGeometry.x, root.screenWidth - root.leftMargin - target.requestedWidth),
84
target.windowedX = Qt.binding(function() { return Math.max(Math.min(windowGeometry.x, root.screenWidth - root.leftMargin - target.windowedWidth),
84
85
(target.fullscreen ? 0 : root.leftMargin)); });
85
target.requestedY = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight); });
86
target.windowedY = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.windowedHeight), PanelState.panelHeight); });
87
88
var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
88
89
target.restore(false /* animated */, windowState);
112
113
readonly property int minimumWidth: root.target ? Math.max(root.minWidth, root.target.minimumWidth) : root.minWidth
113
114
onMinimumWidthChanged: {
114
if (target.requestedWidth < minimumWidth) {
115
target.requestedWidth = minimumWidth;
115
if (target.windowedWidth < minimumWidth) {
116
target.windowedWidth = minimumWidth;
118
119
readonly property int minimumHeight: root.target ? Math.max(root.minHeight, root.target.minimumHeight) : root.minHeight
119
120
onMinimumHeightChanged: {
120
if (target.requestedHeight < minimumHeight) {
121
target.requestedHeight = minimumHeight;
121
if (target.windowedHeight < minimumHeight) {
122
target.windowedHeight = minimumHeight;
124
125
readonly property int maximumWidth: root.target && root.target.maximumWidth >= minimumWidth && root.target.maximumWidth > 0
125
126
? root.target.maximumWidth : maxSafeInt
126
127
onMaximumWidthChanged: {
127
if (target.requestedWidth > maximumWidth) {
128
target.requestedWidth = maximumWidth;
128
if (target.windowedWidth > maximumWidth) {
129
target.windowedWidth = maximumWidth;
131
132
readonly property int maximumHeight: root.target && root.target.maximumHeight >= minimumHeight && root.target.maximumHeight > 0
132
133
? root.target.maximumHeight : maxSafeInt
133
134
onMaximumHeightChanged: {
134
if (target.requestedHeight > maximumHeight) {
135
target.requestedHeight = maximumHeight;
135
if (target.windowedHeight > maximumHeight) {
136
target.windowedHeight = maximumHeight;
138
139
readonly property int widthIncrement: {
247
248
var pos = mapToItem(root.target.parent, mouseX, mouseY);
248
249
d.startMousePosX = pos.x;
249
250
d.startMousePosY = pos.y;
250
d.startX = target.requestedX;
251
d.startY = target.requestedY;
251
d.startX = target.windowedX;
252
d.startY = target.windowedY;
252
253
d.startWidth = target.width;
253
254
d.startHeight = target.height;
254
255
d.currentWidth = target.width;
286
287
if (d.leftBorder) {
287
288
var newTargetX = d.startX + deltaX;
288
var rightBorderX = target.requestedX + target.width;
289
var rightBorderX = target.windowedX + target.width;
289
290
if (rightBorderX > newTargetX + d.minimumWidth) {
290
291
if (rightBorderX < newTargetX + d.maximumWidth) {
291
target.requestedWidth = rightBorderX - newTargetX;
292
target.windowedWidth = rightBorderX - newTargetX;
293
target.requestedWidth = d.maximumWidth;
294
target.windowedWidth = d.maximumWidth;
296
target.requestedWidth = d.minimumWidth;
297
target.windowedWidth = d.minimumWidth;
299
300
} else if (d.rightBorder) {
300
301
var newWidth = d.startWidth + deltaX;
301
302
if (newWidth > d.minimumWidth) {
302
303
if (newWidth < d.maximumWidth) {
303
target.requestedWidth = newWidth;
304
target.windowedWidth = newWidth;
305
target.requestedWidth = d.maximumWidth;
306
target.windowedWidth = d.maximumWidth;
308
target.requestedWidth = d.minimumWidth;
309
target.windowedWidth = d.minimumWidth;
312
313
if (d.topBorder) {
313
314
var newTargetY = Math.max(d.startY + deltaY, PanelState.panelHeight); // disallow resizing up past Panel
314
var bottomBorderY = target.requestedY + target.height;
315
var bottomBorderY = target.windowedY + target.height;
315
316
if (bottomBorderY > newTargetY + d.minimumHeight) {
316
317
if (bottomBorderY < newTargetY + d.maximumHeight) {
317
target.requestedHeight = bottomBorderY - newTargetY;
318
target.windowedHeight = bottomBorderY - newTargetY;
319
target.requestedHeight = d.maximumHeight;
320
target.windowedHeight = d.maximumHeight;
322
target.requestedHeight = d.minimumHeight;
323
target.windowedHeight = d.minimumHeight;
325
326
} else if (d.bottomBorder) {
326
327
var newHeight = d.startHeight + deltaY;
327
328
if (newHeight > d.minimumHeight) {
328
329
if (newHeight < d.maximumHeight) {
329
target.requestedHeight = newHeight;
330
target.windowedHeight = newHeight;
331
target.requestedHeight = d.maximumHeight;
332
target.windowedHeight = d.maximumHeight;
334
target.requestedHeight = d.minimumHeight;
335
target.windowedHeight = d.minimumHeight;
340
341
target: root.target
341
342
onWidthChanged: {
342
343
if (d.moveLeftBorder) {
343
target.requestedX += d.currentWidth - target.width;
344
target.windowedX += d.currentWidth - target.width;
345
346
d.currentWidth = target.width;
347
348
onHeightChanged: {
348
349
if (d.moveTopBorder) {
349
target.requestedY += d.currentHeight - target.height;
350
target.windowedY += d.currentHeight - target.height;
351
352
d.currentHeight = target.height;