Desktop development - 2 questions: Scaling children in sync with main widget and switching views ('layouts' ... 'scenes'???) in a single widget



  • Hoi everybody.

    After 10 years I've finally decided to join the Qt/C++ fray, have started my first small desktop application and now have to fundamental questions I haven't found answers to googling:

    1. I've got a QWidget as my main window and have placed some child-ui-components in there. I'd like those to scale along with the QWidget. Right now the Toolbox inside a vertical layout inside the QWidget doesn't budge. How is scaling and layout management done in Qt - is there some neat method - preferably a visual one in Qt designer in place for that or do I have to start listening to 'QWidgetScaleEvents' and stuff like that and adjusting my subcomponents size myself? I'd expect some basic attributes for this and some accompaning boolean notches in the designer inspector like 'scale with parent' or something, no?

    2. I want to be able to switch views (layouts, scenes, ... whatever they're called in Qt) in said main widget. Turning of individual 'pages' of my desktop app. Right now I'm stacking vertical layouts on top of one another in the Designer and turning them and their children on and off with a large chain of various foo->bar->setVisible(false); and foo->bar->setEnabled(false); and foo->bar->>setVisible(true); etc ... You get the picture. It just doesn't feel right and I'd like to know how this is done correctly - I couldn't find such a thing as a 'layout' pane or 'scene pane' or something in the Designer. Any hints?

    I'm a bit lost on both of these and am thankful for any help.

    Oh, and btw., I'm developing on Mac OS X and would like to deploy my app to OS X and Windows. ... Any trouble I should expect and avoid concerning UI building and components? ... Once again, this is a rather trivial n00by app, a file system level image db integrated with a GUI, nothing big.

    Greetings,
    Qt n00b



  • Hi,

    For Your first question you can use sizepolicy property as expanding along with layouts.
    for more information refer "http://developer.qt.nokia.com/doc/qt-4.8/layout.html":http://developer.qt.nokia.com/doc/qt-4.8/layout.html

    for second question, u can use stacked widget where u can create pages and change current active page. for more information visit "http://www.developer.nokia.com/Community/Wiki/Implementing_a_widget_stack_in_Qt":http://www.developer.nokia.com/Community/Wiki/Implementing_a_widget_stack_in_Qt



  • Thanks for the reply, was of great help.

    Qt n00b


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.