Open a new window by mouse clicking in the QLineEdit field and not by clicking of a button

Mohsen Owzar mohsen.owzar at
Tue Oct 5 03:04:05 EDT 2021

Hi all,
I'm looking for an approach, but couldn't find any appropriate answer to my problem:
On my GUI on a tablet, I have bunch of QlineEdit widgets for the settings of my task.
Because we have no keyboard connected to the tablet, I have put two buttons ("+" and "-") around each QLineEdit widget to increase or decrease its value.
When the target value is far away from the displayed one in the QLineEdit, I have to click lots of times to reach the end value.
Due to this ugliness feature, I wanted to offer to the user the possibility to click in the edit field to get another window with a numeric keypad to type the target value. And then by clicking an OK button, the new window will be closed and the typed value will be taken into the QLineEdit widget of my original GUI.
In all my searches, I found examples to open new windows by clicking a button and not by clicking in an edit field.
I used the following line to have an edit field on window1.

        self.text_from_window2 = QLineEdit('Setting Value')

And wanted to open another window (window2) in which I programmed a numeric keypad. By typing the desired value on this keypad and enter OK, this value should be taken to the edit field of window1.
But the following line brings an error that QLineEdit has no attribute "clicked".


I tried to use other attributes like focus, textChanged or textEdited. None of them could help me.
Is it at all possible to use QLineEdit with mouse click to generate an action (open new window)?
Has anyone an example of such a code snippet?
I am very curious to see if someone has a solution to my problem.


More information about the Python-list mailing list