Results 1 to 11 of 11

Thread: QT Designer Scroll Area not working as expected.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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 !

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    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.


  3. #3
    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.)

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    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.


  5. #5
    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 !

  6. #6
    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

  7. #7
    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 

  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.

    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 12:27.

  9. #9
    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, 13:03
  2. QTableView not working as expected.
    By junxuan in forum Qt Programming
    Replies: 7
    Last Post: 30th July 2009, 08:17
  3. Growing the contents of a scroll area.
    By spraff in forum Qt Programming
    Replies: 1
    Last Post: 2nd July 2009, 15:20
  4. scroll area like QGraphicsItem
    By Gopala Krishna in forum Qt Programming
    Replies: 1
    Last Post: 7th February 2008, 11:28
  5. abstract scroll area
    By moowy in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2006, 09: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
  •  
Qt is a trademark of The Qt Company.