forked from IPKM/nmreval
graph title is displayed when maximized
This commit is contained in:
parent
a17a4e0c01
commit
bd4b88102a
@ -131,6 +131,8 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
|
||||
@title.setter
|
||||
def title(self, value):
|
||||
if self.graph_label.text() != '':
|
||||
self.graph_label.setText(str(value))
|
||||
self.setWindowTitle(str(value))
|
||||
|
||||
@property
|
||||
@ -349,6 +351,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
self.graphic.addItem(obj.drawing)
|
||||
|
||||
def closeEvent(self, evt: QtGui.QCloseEvent):
|
||||
print(self.parent())
|
||||
if not self.closable:
|
||||
evt.ignore()
|
||||
return
|
||||
@ -746,3 +749,13 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
temp = self._fgcolor, self._bgcolor
|
||||
self.set_color(foreground=self._prev_colors[0], background=self._prev_colors[1])
|
||||
self._prev_colors = temp
|
||||
|
||||
|
||||
@QtCore.pyqtSlot(QtCore.Qt.WindowStates, QtCore.Qt.WindowStates)
|
||||
def state_changed(self, old_state: QtCore.Qt.WindowStates, new_state: QtCore.Qt.WindowStates):
|
||||
old_maximized = old_state & QtCore.Qt.WindowMaximized
|
||||
new_maximized = new_state & QtCore.Qt.WindowMaximized
|
||||
if old_maximized and not new_maximized:
|
||||
self.graph_label.setText('')
|
||||
elif not old_maximized and new_maximized:
|
||||
self.graph_label.setText(self.title)
|
@ -397,6 +397,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
|
||||
subwindow.setOption(QtWidgets.QMdiSubWindow.RubberBandResize, True)
|
||||
subwindow.setMinimumHeight(400)
|
||||
subwindow.setMinimumWidth(600)
|
||||
subwindow.windowStateChanged.connect(w.state_changed)
|
||||
|
||||
|
||||
self.datawidget.blockSignals(True)
|
||||
|
Loading…
Reference in New Issue
Block a user