Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to update QApplicationWindow when hidden?
QtWS25 Last Chance

How to update QApplicationWindow when hidden?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 476 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eventh
    wrote on last edited by
    #1

    I'm experiencing a weird issue when I'm hiding and showing qml windows. I want to update the layout before I show it again but it shows the old state/data for a split second before updating and showing the new data. Like if I press a button and hide it within that buttons onClick handler, when I show the window it will show the buttons pressed animation finishing from where it left off when it was hidden.

    Is there any way to force updates on a hidden window? Or some workaround I can use? Thanks.

    I've tried the requestUpdate function and then qApp->processEvents(), but it doesn't seem to do anything.

    ODБOïO 1 Reply Last reply
    0
    • E Eventh

      I'm experiencing a weird issue when I'm hiding and showing qml windows. I want to update the layout before I show it again but it shows the old state/data for a split second before updating and showing the new data. Like if I press a button and hide it within that buttons onClick handler, when I show the window it will show the buttons pressed animation finishing from where it left off when it was hidden.

      Is there any way to force updates on a hidden window? Or some workaround I can use? Thanks.

      I've tried the requestUpdate function and then qApp->processEvents(), but it doesn't seem to do anything.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      @Eventh hi,
      I don't have this behavior with qml Button type, nor with custom button (Rectangle with Mousearea ..)
      QtQuick 2.5
      QtQuick.Window 2.2
      QtQuick.Controls 2.2

      How do you hide the window ?
      all this work for me : show(), hide() setVisible(bool), close(), opacity=x ?
      Maybe show the structure, how the window is created ?

      import QtQuick 2.5
      import QtQuick.Window 2.2
      import QtQuick.Controls 2.2
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
          Button{
              id:showBtn
              onClicked:w.show() //w.setVisible(true)
          }
          Window{
              id:w
              visible: true
              width: 300
              height: 300
             Rectangle{
                 id:btn
                 scale: ms.pressed?0.7:1
                 anchors.centerIn:parent
                 height:showBtn.implicitHeight
                 width:showBtn.implicitWidth
                 color: "olive"
                 Behavior on scale{NumberAnimation{duration: 50}}
                  MouseArea{
                      id:ms
                      anchors.fill: parent
                      onClicked:w.close()//w.opacity=0//w.hide()//w.setVisible(false)
                  }
             }
          }
      }
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved