Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Desktop development - 2 questions: Scaling children in sync with main widget and switching views ('layouts' ... 'scenes'???) in a single widget
p14r last edited by
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:
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?
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.
Atul Patil last edited by
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
p14r last edited by
Thanks for the reply, was of great help.