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. Has anyone made scrollarea zoom with widget
Forum Updated to NodeBB v4.3 + New Features

Has anyone made scrollarea zoom with widget

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 1.9k Views 3 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.
  • O Offline
    O Offline
    ofmrew
    wrote on last edited by
    #1

    The scrollarea works with a label, both scrolling and zooming. Using a widget it will scroll, but not zoom. The problem seems to be with:

    mageLabel->resize(scaleFactor * imageLabel->pixmap()->size());
    

    Widget does not resize.

    Has anyone found what changes must be made to widget to get it to work? Label has a method to set the contents scaleable, but widget has no such method.

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

      Hi,

      You should show the complete setup of your widgets.

      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
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        I assume its the scrollarea i help with so im pretty sure you are using a layout.
        When a QWidget is controlled by a layout,
        setGeometry and resize are ignore as layout controls sizes.
        You can however use
        setMinimumSize(QSize( w,h ) ) to make the widget be bigger.

        O 1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          I assume its the scrollarea i help with so im pretty sure you are using a layout.
          When a QWidget is controlled by a layout,
          setGeometry and resize are ignore as layout controls sizes.
          You can however use
          setMinimumSize(QSize( w,h ) ) to make the widget be bigger.

          O Offline
          O Offline
          ofmrew
          wrote on last edited by
          #4

          @mrjj Thanks. I thought it had something to do with the layout. I changed the minimumSize from 20,000x10,000 to 200x100, all of the pixmap was visible and zooming worked, sorta--lost the scrollbars. However, headway has been made.

          In looking at the QLabel source, I noted that on line 1094 the pixmap is converted to an QImage object scaled and converted back to a pixmap. I am assuming that it was done for performance reasons.

          O 1 Reply Last reply
          0
          • O ofmrew

            @mrjj Thanks. I thought it had something to do with the layout. I changed the minimumSize from 20,000x10,000 to 200x100, all of the pixmap was visible and zooming worked, sorta--lost the scrollbars. However, headway has been made.

            In looking at the QLabel source, I noted that on line 1094 the pixmap is converted to an QImage object scaled and converted back to a pixmap. I am assuming that it was done for performance reasons.

            O Offline
            O Offline
            ofmrew
            wrote on last edited by
            #5

            @ofmrew Just a note for others interested in source code, use wobog because it will help you navigate through the code. Nice!

            1 Reply Last reply
            1
            • Prince_0912P Offline
              Prince_0912P Offline
              Prince_0912
              wrote on last edited by
              #6

              Hello Everyone,
              I'm learning Qt as a beginner, I stuck in one query that how can i set image in Scrollarea UI??

              mrjjM 1 Reply Last reply
              0
              • Prince_0912P Prince_0912

                Hello Everyone,
                I'm learning Qt as a beginner, I stuck in one query that how can i set image in Scrollarea UI??

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #7

                @Prince_0912
                Hi and welcome
                I you can place a QLabel on it and set its Pixmap property to an image.

                1 Reply Last reply
                3

                • Login

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