def __add__(self, widget): """ Show widget on mdi area. If widget does not have a subwindow assigned, create a new subwindow without enabling the WA_DeleteOnClose event. This will allow subwindow to be hidden instead of destroyed. Otherwise, the closeEvent.accept() will cause the "Internal c++ Object Already Deleted" problem. If widget already has a subwindow, just show them (both the subwindow and the widget inside)! :param widget: :return: """ if not hasattr(widget, 'subwindow'): subwindow = QMdiSubWindow() subwindow.setWidget(widget) rect = widget.geometry() # DO NOT SET ATTRIBUTE WA_DeleteOnClose because we want window not to be destroyed widget.subwindow = self.addSubWindow(subwindow) subwindow.setGeometry(rect) widget.subwindow.show() widget.show() widget.closeEvent = lambda x: self._subWindowClosed(x) widget.setFocus() logger.debug("Sub window opened. MDI area sub windows: %s", self.subWindowList()) return self
def __init__(self, parent = None, file_identifier = ""): QMdiSubWindow.__init__(self,parent) self.resize(400,300) self.setWindowIcon(QIcon(":/plugins/stdm/images/icons/photo.png")) self._file_identifier = file_identifier self._view_widget = None
def _add_to_current_tab(self, new_widget): page = self.current_tab sub = QMdiSubWindow() sub.setWidget(new_widget) sub.resize(new_widget.size()) page.addSubWindow(sub)
def __init__(self, parent, flags): QMdiSubWindow.__init__(self, parent, flags) self.__isReadOnly = False self.__alwaysEnabled = [] self.__disabledForReadOnly = [] self.__widgets = None
def __init__(self, parent=None, file_identifier=""): QMdiSubWindow.__init__(self, parent) self.setWindowIcon(QIcon(":/plugins/stdm/images/icons/photo.png")) self._file_identifier = file_identifier self._view_widget = None self.mdi_area = parent self.doc_width = None self.doc_height = None
def __init__(self, parent): QMdiSubWindow.__init__(self, parent) icon = os.path.join(Globals.config['main:system_picture_path'], 'subwin.xpm') self.setWindowIcon(QIcon(QPixmap(icon))) self.setWindowTitle(QCoreApplication.translate('SubWindow', 'Unnamed Subwindow')) self.toggleVisibleAction = QAction(self) self.toggleVisibleAction.setCheckable(True) # for windows that will simply hide on a closeEvent self.hideOnClose = False self.connect(self.toggleVisibleAction, SIGNAL("triggered(bool)"), self.setVisible) self.hideOnClose = False
def create_widget(self): """ Create the underlying QMdiSubWindow widget. """ # We don't parent the subwindow immediately. It will be added # explicitly by the parent QMdiArea during its layout pass. # If we set the parent here, Qt will spit out warnings when # it's set added to the area later on. We *could* parent it # here, and simply not add it explicitly to the mdi area, but # this way is more explicit and consistent with the rest of # the framework. widget = QMdiSubWindow() widget.layout().setSizeConstraint(QLayout.SetMinAndMaxSize) self.widget = widget
def _add_to_current_tab(self, new_widget, label=None): page = self.current_tab sub = QMdiSubWindow() sub.setWidget(new_widget) sub.resize(new_widget.size()) if label: sub.setWindowTitle(label) page.addSubWindow(sub) page.setActiveSubWindow(sub) return sub
def show(self): QMdiSubWindow.show(self) self.widget().setVisible(True) self.raise_() self.widget().activateWindow() # Needs to be called in addition to raise for some X11 WMs (see docs).
def setWidget(self, widget): QMdiSubWindow.setWidget(self, widget) self.resize(widget.size())
def __init__(self, parent=None, flags=Qt.SubWindow): QMdiSubWindow.__init__(self, parent, flags)