Pergunta

Steps to reproduce in designer for Qt 4.8.0

  • I create a new dialog form in Qt Designer
  • I add a QStackedWidget to the dialog
  • I set the layout of the dialog to make the stacked layout size with the dialog
  • I add a few controls to page one in the stacked widget
  • I select the first page in the stacked widget in the right hand tree view of controls
  • The icon next to that page (which is a QWidget) shows the page is missing a layout

When I click one of the layout buttons above, it doesn't change the layout of the page QWidget, it changes the layout of the dialog even though I had explicitly selected the page.

Is this a bug in designer? Am I missing something? I really don't want to add the layouts programatically as that prevents me from being able to layout the pages in designer in the same .ui file

Foi útil?

Solução

Clicking a widget page in the object tree brings that page to the top of the stack, but it does not select it.

In fact, it is not possible to select a widget page itself - only its child widgets can be selected (as well as, of course, the parent stacked-widget).

The easiest way to set a layout for a widget page is to:

  1. bring it to the top by clicking the little arrows on the top-right corner of its parent stacked-widget
  2. set the appropriate layout using the buttons on the toolbar

Note that it is not possible to set a layout on a widget that does not have any child widgets.

(If there is a bug here, it is that the toolbar buttons should really be greyed-out when clicking on a widget page in the object tree that has no child widgets. When the stacked-widget arrows are used, the toolbar buttons are greyed-out correctly).

Outras dicas

It's not a bug in designer, but it's not very intuitive either. You need to click within the stacked widget page itself (where your controls are) and then click one of the layout buttons in the toolbar. Clicking the page in the tree view won't select the page for you.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top