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 force Redraw
Forum Updated to NodeBB v4.3 + New Features

How to force Redraw

Scheduled Pinned Locked Moved QML and Qt Quick
13 Posts 2 Posters 7.7k Views 1 Watching
  • 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.
  • p3c0P Offline
    p3c0P Offline
    p3c0
    Moderators
    wrote on last edited by
    #2

    Hi,

    Use onVisibleChanged handler in MyItem. If not visible then TakeScreenShot()

    157

    1 Reply Last reply
    0
    • R Offline
      R Offline
      remy67
      wrote on last edited by
      #3

      Good idea, ... but it doesn't work.
      I add a trace on the onVisibleChanged event. It is fired immediately after I modify the visible property and before the repaint job.

      an other idea ? :-)

      1 Reply Last reply
      0
      • p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #4

        You mean that TakeScreenShot() gets called in onVisibleChanged before the item is invisible ?

        157

        1 Reply Last reply
        0
        • R Offline
          R Offline
          remy67
          wrote on last edited by
          #5

          [quote author="p3c0" date="1414645183"]You mean that TakeScreenShot() gets called in onVisibleChanged before the item is invisible ?[/quote]

          Yes

          1 Reply Last reply
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #6

            Can you show us the code after changes ?

            157

            1 Reply Last reply
            0
            • R Offline
              R Offline
              remy67
              wrote on last edited by
              #7

              I just add this to MyItem :
              @onVisibleChanged: console.log('onVisibleChanged:'+visible)@
              At execution I have the log message 'onVisibleChanged:false' before a log message from my C++ method and the screenshot show MyItem.

              1 Reply Last reply
              0
              • p3c0P Offline
                p3c0P Offline
                p3c0
                Moderators
                wrote on last edited by
                #8

                Now that you have added it to MyItem you should call TakeScreenShot() there instead of onClicked handler as you did earlier
                @
                onVisibleChanged: {
                if(!visible) {
                obj.TakeScreenShot()
                }
                }
                @

                This ensures that the item is invisible before taking the screenshot.

                157

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  remy67
                  wrote on last edited by
                  #9

                  It's difficult to take the ScreenShot here because i don't want a screenshot at each visible change.
                  I will test anyway to investigate.
                  But i disagree on your ;sentence : 'This ensures that the item is invisible before taking the screenshot." . This ensure that the visible property is set to false regardless the repaint is done or not.

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    remy67
                    wrote on last edited by
                    #10

                    I just made the test. The screenshot is taken when the Item is still visible.
                    It is clear that the event is fired when the property change. The repaint is done asynchronously.
                    I made a lot of search on internet and it seems there is no way to be notified of a repaint or to start a repaint manually.

                    1 Reply Last reply
                    0
                    • p3c0P Offline
                      p3c0P Offline
                      p3c0
                      Moderators
                      wrote on last edited by
                      #11

                      What is the Item that you are making invisible ?
                      I tested it with a Rectangle. It works as expected. Can you post a complete sample code which shows the problem ?

                      157

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        remy67
                        wrote on last edited by
                        #12

                        It is a Rectangle.
                        I am using 5.4 Beta and i take the screenshot with the QQuickView::grabFrameBuffer() function.
                        You're right, i will make a complete sample code to test it.

                        thanks for your time :-)

                        1 Reply Last reply
                        0
                        • p3c0P Offline
                          p3c0P Offline
                          p3c0
                          Moderators
                          wrote on last edited by
                          #13

                          According to the QQuickItem code "here":http://code.woboq.org/qt5/qtdeclarative/src/quick/items/qquickitem.cpp.html#_ZN17QQuickItemPrivate24setEffectiveVisibleRecurEb the signal visibleChanged() is emitted after the the item is made invisible; if I understood it correctly ;)

                          157

                          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