Forum
Sign Up

How to get RibbonBackstageButton objects?

3 months 2 weeks ago #1 by Eun-seop, Yu
I wnat to I want to enable or disable the RibbonBackstageButton. I tried disabling the RibbonBackstagePage, but only the widgets within the RibbonBackstagePage were disabled, and the RibbonBackstageButton itself was not disabled.

Additionally, it seems that the setClosePrevented() function of RibbonBackstageView is not working as expected. My understanding of setClosePrevented() is that it should prevent the RibbonBackstageView from closing, but even after setting setClosePrevented() to True or False, the RibbonBackstageView closes when the [esc] key or the back button in the GUI is pressed.

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #2 by Eun-seop, Yu
The function RibbonBackstageView.actions() return QWidgetAction list.
Elements in the list are RibbonBackstageButton

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #3 by Developer Machines
Could you tell me, what Qt version and QtitanRibbon version do you use?

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #4 by Eun-seop, Yu
Thank you for your response.
python 3.10.11
pyside 6.4.3
qtitan 2023.1.0

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago - 3 months 2 weeks ago #5 by Eun-seop, Yu
As a temporary workaround to prevent the RibbonBackstageView from closing, two steps are needed:

1. Disable the BackstageView close button
I haven't yet found a way to disable the close button mouse hover event.

2. Disable the [esc] key event handling
class BackStageView(RibbonBackstageView):
    def __init__(self, parent):
        RibbonBackstageView.__init__(self, parent)

        self.button: QWidget = self.children()[0]
        self.is_activation = False

    def SetActivation(self, state: bool):
        self.is_activation = state

        self.button.setEnabled(state)

        actions = self.actions()
        if len(actions) > 1:
            for action in actions[1:]:
                action.setEnabled(state)

    def event(self, event):
        if not self.is_activation:
            if event.type() == QKeyEvent.Type.KeyPress:
                return True

        return super().event(event)
Last edit: 3 months 2 weeks ago by Eun-seop, Yu.

Please Log in or Create an account to join the conversation.

More
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer Machines
Time to create page: 0.154 seconds

Developer Newsletter

Join our Developer Machines newsletter to get informed on all the latest releases of the commercial components for Qt.C++, Delphi FireMonkey, updates and general knowledges.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Get in Touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.( any questions related to our products or services )
  • This email address is being protected from spambots. You need JavaScript enabled to view it.( questions related to licensing )