PDA

View Full Version : QML: rendering problems after showMinimized()



dc0
22nd June 2011, 20:04
Encountered the following problem with rendering in QML. I have implemented the 'minimize' button on the frameless window:



Image {
source: "minimize.png"
scale: mouse.pressed ? 0.8 : 1.0
smooth: mouse.pressed

MouseArea {
id: mouse
anchors.fill: parent
anchors.margins: -5
onClicked: {
console.log("MinimizeButton clicked");
viewer.showMinimized();
}
}
}


where 'viewer' is the object inherited from QDeclarativeView which represents the main application window. The button shrinks when user clicks the mouse onto it and window has been minimized. But button stays shrinked when window is restored. Tried to add the timer which prints 'mouse.pressed' every 1 sec:



Timer {
repeat: true
interval: 1000
running: true
onTriggered: {
console.log("mouse.pressed =",mouse.pressed);
}
}


It always prints mouse not pressed. But button is scaled to 0.8, not 1.0. "viewer.showMinimized()" appears to be guilty: button is rendered OK if it is commented out.

Any suggestions to solve the problem?

dc0
22nd June 2011, 23:35
The problem is related to QGraphicsView and it is relatively old (http://www.qtcentre.org/threads/33298-Qt-FramelessWindowHint-qgraphicsview-qgraphicwidget-showminimized-problem).
Still hope the solution exists. It is highly desirable to have possibility of making shaped windows with custom title bars in QML.