Important: Please read the Qt Code of Conduct -

ToolbarMenuLayout and programmatcally add or remove buttons

  • Hi all :)
    I have an app with different pages that have different toolbar layouts. In one of these pages I neeed to have 3 or 4 button in the toolbar depending by some event: 2 buttons are always there, the first, ie the back button, and the last, ie the menu button. The page is divided into 2 tabs. The third button is always visible if in the first tab, but never on the second one. Finally, the fourth button is again never visible on the second tab, but it is sometimes visible in the first one, depending on some properties. Now, I have correctly managed to obtain the visibility for the buttons, but their layout is really poor. I mean that, for example, if in the first tab, with just three button, the middle one is not in the center of the toolbar, since the hidden second one still occupy a position in the bar.

    I'm not sure i've been able to fully explain the problem, but in case, is there a solution to it? :P

    Thanks all :)

  • And thus we have signals and slot whatever you want with S&S system, just use the right signals and slots...

  • The problem I have is that if I change the toolbar after it has been shown, it does not change in the view... That's why the question...

  • try @QWidget::update();@

  • That'not available in pure QML... Or do I miss something?

  • So the only one reason is, I think do it in C++...

Log in to reply