Results 1 to 11 of 11

Thread: QT Designer Scroll Area not working as expected.

  1. #1
    Join Date
    Jul 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default QT Designer Scroll Area not working as expected.

    Hello all!

    I am an Autodesk maya 2011 user and I am trying to create a UI in QT with a Scroll Area in it.
    However so far I have not been able to get it working. I searched a lot for this problem but so far I have not found anyone with a similar problem.
    I also checked the help file on this problem but the scroll area topic in the help file only focuses on using scroll area’s within code.
    As far as I know I can not use any form of scripting/code except for the script in the UI file itself since Autodesk Maya only reads the UI file. Other than that I am a complete novice using QT.

    Problem:

    When I create a Scroll Area in a mainWindow and place any layout or widget inside of it that is larger than the Scroll Area the Scroll area does not show any Scroll bars. Even if I set the verticalScrollBarPolicy to alwaysOn then it only shows a grayed out scrollbar.
    In QT aswell as in maya (ofcourse)

    I'm sure that I am forgetting something... Do I need to do anything extra in order to make the Scroll Area work.

    Any help or suggestions would be most appreciated.

    Thanks!!

    Red

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QT Designer Scroll Area not working as expected.

    What are the minimum sizes on the contained objects? If they are 0x0 then they will simply shrink to nothing with the shrinking QScrollArea/layout and never trigger the scroll bar requirement.

    BTW: I have no idea what Autodesk Maya has to do with any of this.

  3. #3
    Join Date
    Jul 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT Designer Scroll Area not working as expected.

    I checked the minimum size and that was all ok, and also used crazy test values to make absolutely sure that the objects inside the scroll area would be big enough.
    But i think i have it working now. By putting the scroll area within a grid layout.

    Ahm the reason why I mentioned Autodesk Maya is because I saw a lot of examples of scroll layouts where the cpp(or one of the other files ) files were used to create the scrolling effect. And as far as I know Maya can not use those files.

    Thanks for your time and suggestions !

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT Designer Scroll Area not working as expected.

    Show us your ui file.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT Designer Scroll Area not working as expected.

    Here is my ui file.
    For some reason i can not get it to work within a single scroll area.
    But if i put it into a grid layout then it does work.

    http://www.redace.nl/Scripting/QT_Gu.../mainwindow.ui
    (had to upload it to my own site because of 19.5kb upload limit.)

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT Designer Scroll Area not working as expected.

    You didn't apply a layout on the scroll area's widget. It's enough to click on the empty area on the scroll area and apply a layout (i.e. a vertical one). Your frame also doesn't have a layout. You can't expect size adjustment features to work if you don't use layouts.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jul 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT Designer Scroll Area not working as expected.

    ah ok so thats it.Makes sense.

    Thank you very much for the info !

  8. #8
    Join Date
    Jul 2010
    Location
    London
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QT Designer Scroll Area not working as expected.

    Hi folks,
    Trying to do the same here, also for a Maya 2011 PyQt4 application, and I'm running into the same problem.
    The Dialog consists of a scroll layout and various group boxes all vertically aligned in the mainDialog window. The scroll layout itself also has some vertically aligned group boxes with a min height as child objects. When creating an instance of the UI in Maya scroll bars won't show up regardless of the size of the window. However, when testing the UI in designer (v4.6.2) everything is fine.

    Here's the ui file (sorry, uploading doesn't seem to work):
    http://klonko.de/files/test.ui

    Thanks for any help
    Robin

  9. #9
    Join Date
    Jul 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT Designer Scroll Area not working as expected.

    Hey robomat,

    i have no idea what is wrong with your file.

    when I load it into maya 2011 it works perfectly


    testui.jpg

    You could check your maya settings.
    preferences- interface- remember size and position

    to absolutely be sure that its not the maya settings. Make a backup of your mydocuments maya folder. and then delete it.

    then maya will rebuild the folder with default settings. after that you can just put it back.

    Btw here is the code in maya i used to load the ui


    Qt Code:
    1. string $dialog = `loadUI -uiFile ("D:/test.ui")`;
    2.  
    3. showWindow $dialog;
    To copy to clipboard, switch view to plain text mode 

  10. #10
    Join Date
    Jul 2010
    Location
    London
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QT Designer Scroll Area not working as expected.

    That's right, this is the same behaviour like the preview in QtDesigner, but this is just loading the UI file without any context. For my application I need to compile the UI file to .py. Anyway, getting the scrollbars is no problem anymore, thanks to the pyqt docs:
    http://www.riverbankcomputing.co.uk/...crollarea.html

    ... If the widget exceeds the size of the frame, the view can provide scroll bars so that the entire area of the child widget can be viewed. The child widget must be specified with setWidget().

    So I did that and scrollbars show up, but the contents of that scrollArea now behave like they're disabled. In this case I have a scrollLayout that holds a frameLayout containing some groupBoxes containing checkbox widgets, just like this

    Qt Code:
    1. scrollArea
    2. |
    3. |_frameLayout
    4. |
    5. |_groupBox1
    6. | |
    7. | |_checkBox1
    8. | |_checkBox2
    9. |
    10. |_groupBox1
    11. |
    12. |_checkBox3
    13. |_checkBox4
    To copy to clipboard, switch view to plain text mode 
    When attaching the frameLayout to the scrollLayout via setWidget() the I cannot toggle the checkboxes anymore. If I skip setWidget() all works fine, but no scrollbars show up.

    Any idea, what's going on here?

    Many thanks
    Robin
    Last edited by robomat; 2nd August 2010 at 13:27.

  11. #11
    Join Date
    Jul 2010
    Location
    London
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QT Designer Scroll Area not working as expected.

    Got it! The thing I did wrong was to attach a QFrame to the scrollArea instead a QWidget. When creating a QScrollArea with designer it automatically creates a QWidget child object called scrollAreaWidgetContents which needs to be used as the argument for setWidget().

    Cheers
    R

Similar Threads

  1. Scroll Area problem
    By Lodhart in forum Qt Programming
    Replies: 0
    Last Post: 10th October 2009, 14:03
  2. QTableView not working as expected.
    By junxuan in forum Qt Programming
    Replies: 7
    Last Post: 30th July 2009, 09:17
  3. Growing the contents of a scroll area.
    By spraff in forum Qt Programming
    Replies: 1
    Last Post: 2nd July 2009, 16:20
  4. scroll area like QGraphicsItem
    By Gopala Krishna in forum Qt Programming
    Replies: 1
    Last Post: 7th February 2008, 12:28
  5. abstract scroll area
    By moowy in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2006, 10:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.