From 812e97aebcf2e06142b516383097d5fb51d8872b Mon Sep 17 00:00:00 2001 From: Chris Colbert Date: Mon, 17 Jun 2013 14:57:04 -0400 Subject: [PATCH] hook up the title bar right click event --- enaml/qt/qt_dock_item.py | 11 ++++++++++- enaml/widgets/dock_item.py | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/enaml/qt/qt_dock_item.py b/enaml/qt/qt_dock_item.py index 11861d033..80392cc9a 100644 --- a/enaml/qt/qt_dock_item.py +++ b/enaml/qt/qt_dock_item.py @@ -85,6 +85,7 @@ def init_layout(self): # Use a queued connection so the dock manager can finish # closing the dock item before the signal handler runs. widget.titleEdited.connect(self.on_title_edited) + widget.titleBarRightClicked.connect(self.on_title_bar_right_clicked) widget.closed.connect(self.on_closed, Qt.QueuedConnection) #-------------------------------------------------------------------------- @@ -113,6 +114,14 @@ def on_title_edited(self, text): finally: self._guard &= ~TITLE_GUARD + def on_title_bar_right_clicked(self, pos): + """ Handle the 'titleBarRightClicked' signal on the dock item. + + """ + d = self.declaration + if d is not None: + d.title_bar_right_clicked() + def on_closed(self): """ Handle the closed signal from the dock item. @@ -164,7 +173,7 @@ def set_title_bar_visible(self, visible): """ Set the visibility of the widget's title bar. """ - self.widget.titleBarWidget().setForceHidden(not visible) + self.widget.setTitleBarForceHidden(not visible) def set_icon(self, icon): """ Set the icon on the underlying widget. diff --git a/enaml/widgets/dock_item.py b/enaml/widgets/dock_item.py index 5b1a52ee7..8305aa47b 100644 --- a/enaml/widgets/dock_item.py +++ b/enaml/widgets/dock_item.py @@ -75,6 +75,9 @@ class DockItem(Widget): #: Whether or not the dock item is closable via a close button. closable = d_(Bool(True)) + #: An event emitted when the title bar is right clicked. + title_bar_right_clicked = d_(Event(), writable=False) + #: An event emitted when the dock item is closed. The item will be #: destroyed after this event has completed. closed = d_(Event(), writable=False)