Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Smooth scaling QPixmap
Qt 6.11 is out! See what's new in the release blog

Smooth scaling QPixmap

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 1.6k Views 2 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.
  • P Offline
    P Offline
    patrickkidd
    wrote on last edited by
    #1

    I have a QTableView that has gotten kind of slow to paint when animate-expanding to a pre-set width (see screenshot):

    0_1550706705445_Screen Shot 2019-02-20 at 3.47.00 PM.png

    I tried to fake-optimize it by temporarily hiding it and replacing it with a redesign of the widget to a QPixmap shown by a label. The rendering obviously stretches, but fine (see screenshot):

    0_1550706678862_Screen Shot 2019-02-20 at 3.50.02 PM.png

    But even that is slow! I've tested with just showing the label as a top-level window and resizing using the mouse.

    Can anyone think of a faster way to animate-resize a QPixmap of about that size? Or should my table rendering be reasonably fast when animate-resizing itself?

    Thanks!

    https://alaskafamilysystems.com/

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      How are you doing that animation ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        patrickkidd
        wrote on last edited by
        #3

        I you are asking about the animation of the container of the QTableView prior to the QPixmap fake-animation fix described, then like this:

        self.expandAnimation = QPropertyAnimation(self, b'size')
        

        If you are asking about the QPixmap resize animation, then I am using the same QPropertyAnimation as above but on every valueChanged signal I resize the label with QLabel.resize().

        https://alaskafamilysystems.com/

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What are the parameters of the animation ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          P 1 Reply Last reply
          0
          • SGaistS SGaist

            What are the parameters of the animation ?

            P Offline
            P Offline
            patrickkidd
            wrote on last edited by
            #5

            @SGaist

            @SGaist said in Smooth scaling QPixmap:

            What are the parameters of the animation ?

            Just this:

                    self.expandAnimation = QPropertyAnimation(self, b'size')
                    self.expandAnimation.setDuration(util.ANIM_DURATION_MS)
                    self.expandAnimation.setEasingCurve(util.ANIM_EASING)
            

            https://alaskafamilysystems.com/

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What are util.ANIM_DURATION_MS and util.ANIM_EASING?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              P 1 Reply Last reply
              0
              • SGaistS SGaist

                What are util.ANIM_DURATION_MS and util.ANIM_EASING?

                P Offline
                P Offline
                patrickkidd
                wrote on last edited by
                #7

                @SGaist said in Smooth scaling QPixmap:

                What are util.ANIM_DURATION_MS and util.ANIM_EASING?

                ANIM_DURATION_MS = 250
                ANIM_EASING = QEasingCurve.OutQuad
                

                https://alaskafamilysystems.com/

                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