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. [solved] QScrollArea on Tab with QGridLayout not working
Forum Updated to NodeBB v4.3 + New Features

[solved] QScrollArea on Tab with QGridLayout not working

Scheduled Pinned Locked Moved General and Desktop
14 Posts 2 Posters 4.6k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #5

    And without that line ?

    @pScrollArea->setWidgetResizable(true);@

    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
    • R Offline
      R Offline
      RRRitchey
      wrote on last edited by
      #6

      I tried it both with and without "setWidgetResizable." No scroll bars. No change in behavior. Horizontal size is fixed, adding things squishes the other columns. Without the ScrollArea the right side would grow. I was wondering over the weekend, can you do something so that all tabs on a TabWidget have scroll areas or do you have to do each tab individually?
      Thanks.

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

        I got the behavior I wanted by setting the central widget of my mainwindow to the QScrollArea and setting "setWidgetResizable" to true. I then added my tabwidget (subclassed as SF_UnitView) to the ScrollArea. This enabled the ScrollArea on all the tabs. So far this seems to work the way I was hoping.

        My only other issues now is that on the initial tab I have a picture. It maintains its aspect ratio if the window is smaller than the picture but will stretch the picture horizontally but not vertically when the window is sized bigger than its minimum size. Do I need to intercept the resize and adjust it so the aspect is right? Thanks for all your suggestions.

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

          Your widgets were nested differently than I thought, but anyway, cool you found a solution.

          Do you mean resize when it's smaller otherwise keep it size ?

          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
          • R Offline
            R Offline
            RRRitchey
            wrote on last edited by
            #9

            Actually, resize when the window is larger than the picture so the picture keeps its aspect ratio. When the window is larger than the picture, the picture will stretch horizontally but not vertically causing it to lose its aspect ratio. I don't know much about catching the resize signal at this point but I am guessing I need to adjust the vertical to match the horizontal stretch? Not a huge issue now but would make it look nicer in the end. Thanks,

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

              How did you setup that picture ?

              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
              • R Offline
                R Offline
                RRRitchey
                wrote on last edited by
                #11

                This is the code for the label. Its placed in an HBox with a spacer on the right side.

                @ pLabelSF_Logo = new QLabel;
                pLabelSF_Logo->setMinimumWidth(600);
                pLabelSF_Logo->setMinimumHeight(232);
                pLabelSF_Logo->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
                pLabelSF_Logo->setScaledContents(true);
                pLabelSF_Logo->setPixmap(QPixmap("../SFPackage/Smart-Fly_Logo3.jpg"));
                @

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

                  Then you should rather create your own e.g QFrame and draw the image yourself so you can scale it as wanted

                  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
                  • R Offline
                    R Offline
                    RRRitchey
                    wrote on last edited by
                    #13

                    Thanks. At the moment I think thats a bit over my head and I will leave it for later. Thanks for all your input on this thread.

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

                      You're welcome !

                      If your primary problem is solved then please update the thread title prepending [solved] so other forum users may know as solution has been found :)

                      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

                      • Login

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