本文整理汇总了Python中PyQt5.QtGui.QCloseEvent方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QCloseEvent方法的具体用法?Python QtGui.QCloseEvent怎么用?Python QtGui.QCloseEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui
的用法示例。
在下文中一共展示了QtGui.QCloseEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: event
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def event(self, e):
if not isinstance(e, (
QtCore.QEvent,
QtCore.QChildEvent,
QtCore.QDynamicPropertyChangeEvent,
QtGui.QPaintEvent,
QtGui.QHoverEvent,
QtGui.QMoveEvent,
QtGui.QEnterEvent,
QtGui.QResizeEvent,
QtGui.QShowEvent,
QtGui.QPlatformSurfaceEvent,
QtGui.QWindowStateChangeEvent,
QtGui.QKeyEvent,
QtGui.QWheelEvent,
QtGui.QMouseEvent,
QtGui.QFocusEvent,
QtGui.QHelpEvent,
QtGui.QHideEvent,
QtGui.QCloseEvent,
QtGui.QInputMethodQueryEvent,
QtGui.QContextMenuEvent,
)):
log().warning("unknown event: %r %r", e.type(), e)
return super().event(e)
示例2: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event):
""" Override the QWindow close event.
Close all dialogs and database connection.
If selected via menu option exit: event == False
If selected via window x close: event == QtGui.QCloseEvent
"""
if not self.force_quit:
quit_msg = _("Are you sure you want to quit?")
reply = QtWidgets.QMessageBox.question(self, 'Message', quit_msg,
QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
if reply == QtWidgets.QMessageBox.Yes:
self.dialogList = None
if self.app.conn is not None:
try:
self.app.conn.commit()
self.app.conn.close()
except:
pass
QtWidgets.qApp.quit()
return
if event is False:
return
else:
event.ignore()
示例3: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, _e: QCloseEvent) -> None:
"""Save the geometry when closed."""
data = self._widget.saveGeometry().data()
geom = base64.b64encode(data).decode('ASCII')
configfiles.state['inspector']['window'] = geom
示例4: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QtGui.QCloseEvent): # noqa: N802
"""
Can be used to prevent Alt+F4 or other automatic closes.
:param event: The close event
"""
if self.close_callback and not self.close_callback(self):
event.ignore()
示例5: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QCloseEvent):
self.parent.cutter.consoleButton.setChecked(False)
super(ConsoleWidget, self).closeEvent(event)
示例6: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
self.worker.stopped = True
self.settings.setValue("MarkerCount", Marker.count())
for marker in self.markers:
marker.update_settings()
self.settings.setValue("WindowHeight", self.height())
self.settings.setValue("WindowWidth", self.width())
self.settings.sync()
self.bands.saveSettings()
self.threadpool.waitForDone(2500)
a0.accept()
sys.exit()
示例7: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, e: QCloseEvent):
if self.movie.state() == QMovie.Running:
self.movie.stop()
示例8: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QCloseEvent):
"""
This function is automatically called when the window is closed using the close [X] button in the window
decorations or by right clicking in the system window list and using the close action, or similar ways to close
the window.
Just ignore this event and simulate that the user used the action_close_window instead.
To quote the Qt5 QCloseEvent documentation: If you do not want your widget to be hidden, or want some special
handling, you should reimplement the event handler and ignore() the event.
"""
event.ignore()
# Be safe and emit this signal, because it might be connected to multiple slots.
self.action_close_window.triggered.emit(True)
示例9: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, a0: QtGui.QCloseEvent):
print('closing main window')
self._ui_events_engine.stop()
self._outgoing_request_events_engine.stop()
self._client_mq.stop()
示例10: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QCloseEvent):
self.continuous_modulator.stop()
super().closeEvent(event)
示例11: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QCloseEvent):
self.ui.tblViewRuleset.setItemDelegateForColumn(2, None)
self.ui.tblViewRuleset.setItemDelegateForColumn(3, None)
settings.write("{}/geometry".format(self.__class__.__name__), self.saveGeometry())
super().closeEvent(event)
示例12: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QCloseEvent):
self.ui.lineEditParameters.editingFinished.emit()
settings.write("{}/geometry".format(self.__class__.__name__), self.saveGeometry())
for gv in (self.ui.gVCarrier, self.ui.gVData, self.ui.gVModulated, self.ui.gVOriginalSignal):
# Eliminate graphic views to prevent segfaults
gv.eliminate()
super().closeEvent(event)
示例13: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QCloseEvent):
changed_values = {}
if bool(self.ui.checkBoxPauseTime.isChecked()) != self.old_show_pause_as_time:
changed_values['show_pause_as_time'] = bool(self.ui.checkBoxPauseTime.isChecked())
if self.old_default_view != self.ui.comboBoxDefaultView.currentIndex():
changed_values['default_view'] = self.ui.comboBoxDefaultView.currentIndex()
if self.old_num_sending_repeats != self.ui.spinBoxNumSendingRepeats.value():
changed_values["num_sending_repeats"] = self.ui.spinBoxNumSendingRepeats.value()
settings.write('default_view', self.ui.comboBoxDefaultView.currentIndex())
settings.write('num_sending_repeats', self.ui.spinBoxNumSendingRepeats.value())
settings.write('show_pause_as_time', self.ui.checkBoxPauseTime.isChecked())
FieldType.save_to_xml(self.field_type_table_model.field_types)
self.plugin_controller.save_enabled_states()
for plugin in self.plugin_controller.model.plugins:
plugin.destroy_settings_frame()
for i in range(self.ui.scrollAreaWidgetSpectrogramColormapContents.layout().count()):
widget = self.ui.scrollAreaWidgetSpectrogramColormapContents.layout().itemAt(i).widget()
if isinstance(widget, QRadioButton) and widget.isChecked():
selected_colormap_name = widget.objectName()
if selected_colormap_name != colormaps.read_selected_colormap_name_from_settings():
colormaps.choose_colormap(selected_colormap_name)
colormaps.write_selected_colormap_to_settings(selected_colormap_name)
changed_values["spectrogram_colormap"] = selected_colormap_name
break
self.values_changed.emit(changed_values)
settings.write("{}/geometry".format(self.__class__.__name__), self.saveGeometry())
super().closeEvent(event)
示例14: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QCloseEvent):
self.timer.stop()
self.simulator.stop()
time.sleep(0.1)
self.simulator.cleanup()
self.emit_editing_finished_signals()
if self.device_settings_rx_widget:
self.device_settings_rx_widget.emit_device_parameters_changed()
if self.device_settings_tx_widget:
self.device_settings_tx_widget.emit_device_parameters_changed()
if self.sniff_settings_widget:
self.sniff_settings_widget.emit_sniff_parameters_changed()
super().closeEvent(event)
示例15: closeEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCloseEvent [as 别名]
def closeEvent(self, event: QCloseEvent):
self.sniff_settings_widget.emit_sniff_parameters_changed()
super().closeEvent(event)