There is any way to move a SplashScreen Window in desktop env?



  • hi guys
    i am working on a project that i need to create an ApplicationWindow with flags set to Qt.SplashScreen.
    but i need to abale to move this window like when i move it with titlebar.

    what should i do?

    @import QtQuick 2.0
    import QtQuick.Controls 1.1

    ApplicationWindow {
    id: screen
    width: 500
    height: 500
    flags: Qt.SplashScreen
    }@



  • I don't see a possibility of moving ApplicationWindow using a MouseArea and Drag since it is type of ApplicationWindow_QMLTYPE_7. What you can do is to create a transparent Rectangle, use a MouseArea to drag it around and pass it's x and y coordinates to cpp using a signal. In cpp you can set the coordinates of your ApplicationWindow based on the coordinates of the rectangle.

    Im sure it will even work if you have this function implemented in QML directly without cpp, but it is a really dry workaround...



  • thanks onek24
    unfortunately i don't use cpp.
    i want to implement it in QML.
    but this is a good idea
    thanks again



  • You're welcome, i hope you find a solution.



  • Lastly i find a way:
    in any item you want to move you should add this MouseArea:
    @
    MouseArea {
    anchors.fill: parent
    property real lastMouseX: 0
    property real lastMouseY: 0
    acceptedButtons: Qt.LeftButton
    onPressed: {
    if(mouse.button == Qt.LeftButton){
    parent.forceActiveFocus()
    lastMouseX = mouseX
    lastMouseY = mouseY
    }
    }
    onMouseXChanged: root.x += (mouseX - lastMouseX)
    onMouseYChanged: root.y += (mouseY - lastMouseY)
    }@

    Good luck


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.