aboutsummaryrefslogtreecommitdiffstats
path: root/examples/webchannel/standalone/dialog.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-05-19 13:46:56 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-05-19 14:12:36 +0200
commitaf83219d8a6e7ac1c0c8776f61b99ee37f30ef04 (patch)
tree51fa216a02cefef75aef77313a048bf879c91a32 /examples/webchannel/standalone/dialog.py
parent8cd50636102be2e1178c8c602a3e374891398e3e (diff)
Polish the QtWebChannel example
- Rename according to snake case conventions - Connect sending to QLineEdit.returnPressed Task-number: PYSIDE-1112 Change-Id: Ia0e1b81309985219688739a4cead8a252acd8dcc Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'examples/webchannel/standalone/dialog.py')
-rw-r--r--examples/webchannel/standalone/dialog.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/webchannel/standalone/dialog.py b/examples/webchannel/standalone/dialog.py
index 886a323f8..6f7cc842e 100644
--- a/examples/webchannel/standalone/dialog.py
+++ b/examples/webchannel/standalone/dialog.py
@@ -1,7 +1,7 @@
#############################################################################
##
## Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com>
-## Copyright (C) 2020 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the Qt for Python examples of the Qt Toolkit.
@@ -46,16 +46,17 @@ from ui_dialog import Ui_Dialog
class Dialog(QDialog):
- sendText = Signal(str)
+ send_text = Signal(str)
def __init__(self, parent=None):
super().__init__(parent)
self._ui = Ui_Dialog()
self._ui.setupUi(self)
self._ui.send.clicked.connect(self.clicked)
+ self._ui.input.returnPressed.connect(self._ui.send.animateClick)
@Slot(str)
- def displayMessage(self, message):
+ def display_message(self, message):
self._ui.output.appendPlainText(message)
@Slot()
@@ -63,6 +64,6 @@ class Dialog(QDialog):
text = self._ui.input.text()
if not text:
return
- self.sendText.emit(text)
- self.displayMessage(f"Sent message: {text}")
+ self.send_text.emit(text)
+ self.display_message(f"Sent message: {text}")
self._ui.input.clear()