Qt Designer beginner. 1. Creating right project. 2. User slot for Action
I need a Qt Designer to develop a GUI for a Python3 project. It would be nice to get a main.ui file and use it in such a way:
class MyWindowClass(QMainWindow, uic.loadUiType("main.ui"))
So I want no main.h nor main.cpp files. Just a single main.ui.
So here is my 1-st question: when I create a new Project/File in Qt Designer - what is my right selection among all proposed templates?
And please check your answer in such a point: what are next fields in the creating process? I mean, if there is an obligatory "Kit" field - what kit have i to choose?
Meanwhile I try to work with Application -> Qt Widgets Application template. I have a MainWindow with a menubar widget. I inserted an Exit Action - exactly as described here with actionNew_Window. And now my 2-nd question: how can I create a user slot for the Action? For example, if I create a Push Button widget, I can add a slot in Signals & Slots Editor. It may be just a name of a method - and I will create the method in Python program. But I cannot understand how can I create such link for an Action.
Thank in advance!
Well, I drop my 1-st question (unanswered, alas!) and I've got my answer for a 2-nd question. Actions are happily linked to a Python script.
Now I have one new question.
There is a QMainWindow object. And it has a QLineEdit widget. Python(3) script communicates with some external device and writes data from the device to the QLineEdit widget, using setText() method. So far it is a pure Display Widget (in terms of Qt Designer).
But now I need to write some user data to the external device, using this widget. For example (but not necessarily) I click on a QLineEdit widget (1-st event), enter some text and press Enter key (2-nd event). And my data is being sent to the external device. As far as data is sent, the Python script resumes to read data from the device and to refresh the text in the widget.
What is a problem? I need to enter new text in the the widget from the moment of the 1-st event, but the Python script over-writes the text being edited with the external data. This is the reason I want to stop refreshing. But the QLineEdit has not clicked() signal. How can I get a signal from a QLineEdit widget about the beginning of editing the text?
In the Qt4 Designer I used to translate my mainwindow.ui file into the mainwindow.py file and then I made manual editing of the file. I defined myLineEdit(QtGui.QLineEdit) class and redefined mousePressEvent() to emit a "mousePressed" SIGNAL at the LeftButton event.
Now I'd like to avoid that sort of translation - just import the mainwindow.ui file via loadUiType(). How can I stop the refreshing with the absence of clicked(0 signal in QLineEdit class?
Or maybe I have to use come other widget? Or other input technology?
I hope there are some standard approaches to entering data in the widget upon the constant refreshing process.