mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
alt
This commit is contained in:
parent
08ac6eb0c4
commit
e0ef0b4174
@ -100,6 +100,23 @@ class edittext(saveposwindow):
|
|||||||
self.textOutput.setPlainText(sentence)
|
self.textOutput.setPlainText(sentence)
|
||||||
|
|
||||||
|
|
||||||
|
class ctrlenter(QPlainTextEdit):
|
||||||
|
enterpressed = pyqtSignal()
|
||||||
|
|
||||||
|
def keyPressEvent(self, e):
|
||||||
|
if e.key() == Qt.Key_Return or e.key() == Qt.Key_Enter:
|
||||||
|
if (
|
||||||
|
e.modifiers() == Qt.ControlModifier
|
||||||
|
or e.modifiers() == Qt.ShiftModifier
|
||||||
|
or e.modifiers() == Qt.AltModifier
|
||||||
|
):
|
||||||
|
self.insertPlainText("\n")
|
||||||
|
else:
|
||||||
|
self.enterpressed.emit()
|
||||||
|
else:
|
||||||
|
super().keyPressEvent(e)
|
||||||
|
|
||||||
|
|
||||||
@Singleton_close
|
@Singleton_close
|
||||||
class edittrans(LMainWindow):
|
class edittrans(LMainWindow):
|
||||||
|
|
||||||
@ -133,12 +150,12 @@ class edittrans(LMainWindow):
|
|||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setWindowIcon(qtawesome.icon("fa.edit"))
|
self.setWindowIcon(qtawesome.icon("fa.edit"))
|
||||||
|
|
||||||
self.textOutput = QPlainTextEdit(self)
|
self.textOutput = ctrlenter(self)
|
||||||
qv = QHBoxLayout()
|
qv = QHBoxLayout()
|
||||||
w = QWidget()
|
w = QWidget()
|
||||||
self.setCentralWidget(w)
|
self.setCentralWidget(w)
|
||||||
w.setLayout(qv)
|
w.setLayout(qv)
|
||||||
|
self.textOutput.enterpressed.connect(self.submitfunction)
|
||||||
submit = LPushButton("确定")
|
submit = LPushButton("确定")
|
||||||
qv.addWidget(self.textOutput)
|
qv.addWidget(self.textOutput)
|
||||||
qv.addWidget(
|
qv.addWidget(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user