Expanding the Window when clicked



  • I'm trying to figure out how to get the window to expand when I click on it. If some one can point me in the right direction as far documentation goes it would be greatly appreciated. Thanks


  • Moderators

    Hi,

    Check if "this":http://qt-project.org/forums/viewthread/46690/ helps you ?



  • I appreciate it. What I'm trying to do is have a note expand to a fixed size when I double click the notetoolbar component. Once is does that I can write my notes and scroll up and down. Once I'm done writing the note I just want to double click again and see it go back to its original size.


  • Moderators

    Ok. Also you can change the width and height of the component on doubleclick.



  • I'm still having trouble getting it to work so here is the code for the note component. This is the code for the notetoolbar compnent. If I can get this figured out I'll be good to go. And thanks for your help p3c0

    @import QtQuick 2.0
    import QtQuick.Layouts 1.1

    Rectangle {
    id:root
    width: 100
    height: 62
    color:"#9c9449"

    MouseArea {
        id: mouseArea1
        doubleClicked:{
        height: 400
        }
    
        anchors.fill: parent
        width: 100
        height: 62
        
    }
    

    }@


  • Moderators

    Well i see multiple issues here,

    1. The handler is onDoubleClicked and not doubleClicked so change it.
    2. Since you want to change the height of Rectangle you must refer to it in MouseArea using the id of Rectangle or since it's a parent of MouseArea you can use parent.
    3. No need to use binding there.
      So,

    @
    MouseArea {
    id: mouseArea1
    onDoubleClicked:{
    parent.height =400
    }
    }
    @

    Also you need not specify width and height for MouseArea since you are already filling it to parent's width and height.


Log in to reply
 

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