Qt World Summit: Register Today!

QT 5.4 - Need to disable a button on Toolbar

  • Hi everyone,

    I need some help.
    I've been trying to figure this out for a few week but I can't seem to find the solution.
    I have an application with multiple pages, so I am using QStackedWidgets. What I would need to do is disabling a button on the toolbar of the application when I am on a certain Index.
    For example on Index 0 and Index 6 I would need for a button on my toolbar to be disabled.
    How can I manage to do this?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Add a slot in the widget containing the toolbar and connect QStackedWidget::currentChanged to it. In the slot check the index value and enable/disable the button.

    Hope it helps