mirror of
https://github.com/pyqt/examples.git
synced 2025-08-29 04:47:41 +00:00
Fix example 07 for PyQt6
This commit is contained in:
parent
7dd87f7a03
commit
946320ea9e
@ -1,5 +1,5 @@
|
||||
from PyQt6.QtWidgets import *
|
||||
from PyQt6.QtGui import QKeySequence
|
||||
from PyQt6.QtGui import QKeySequence, QAction
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def closeEvent(self, e):
|
||||
@ -37,7 +37,7 @@ def open_file():
|
||||
text.setPlainText(open(path).read())
|
||||
file_path = path
|
||||
open_action.triggered.connect(open_file)
|
||||
open_action.setShortcut(QKeySequence.Open)
|
||||
open_action.setShortcut(QKeySequence.StandardKey.Open)
|
||||
menu.addAction(open_action)
|
||||
|
||||
save_action = QAction("&Save")
|
||||
@ -49,7 +49,7 @@ def save():
|
||||
f.write(text.toPlainText())
|
||||
text.document().setModified(False)
|
||||
save_action.triggered.connect(save)
|
||||
save_action.setShortcut(QKeySequence.Save)
|
||||
save_action.setShortcut(QKeySequence.StandardKey.Save)
|
||||
menu.addAction(save_action)
|
||||
|
||||
save_as_action = QAction("Save &As...")
|
||||
|
Loading…
x
Reference in New Issue
Block a user