Questions tagged [qlineedit]

QLineEdit is a component of the Qt library which is basically a text editor that has only one line, and which allows one to make inputting and editing of text. A related class is QTextEdit which allows multi-line, rich text editing.

A minimalistic example of a QLineEdit that is shown in a new window, and contains the infamous "Hello, World!" line:

#include <QtGui>
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a( argc, argv );
    QLineEdit * myLine = new QLineEdit( "Hello, World!" );
    myLine->show();
    return a.exec();
}

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

600 questions
5
votes
2 answers

How can I limit text box width of QLineEdit to display at most four characters?

I am working with a GUI based on PySide. I made a (one line) text box with QLineEdit and the input is just four characters long, a restriction I already successfully applied. The problem is I have a wider than needed text box (i.e. there is a lot of…
Nerdrigo
  • 308
  • 1
  • 5
  • 14
5
votes
1 answer

Placeholder in qt

I want to set a placeholder text in a QLineEdit. I am using the below code to do so: QLineEdit *q = new QLineEdit; q->setPlaceholderText("Enter number"); But on executing, the placeholder does not set. What may be the problem here?
annie
  • 143
  • 1
  • 1
  • 11
5
votes
1 answer

How to hide password in QLineEdit

Want to hide password typed by "*". But the password is appearing as original text... class Form(QDialog): def __init__(self, parent = None): super(Form,self).__init__(parent) self.usernamelabel = QLabel("Username : ") …
Aniruddh Chaudhari
  • 113
  • 2
  • 3
  • 9
5
votes
1 answer

PyQt QLineEdit with history

Do you know an easy way to make an "history" on a QLineEdit in PySide/PyQt? Example: Whenever Enter is pressed, the typed text will be stored, and pressing the "up" or "down" arrows allows you to navigate through the history. Thank you very much
Ben
  • 244
  • 2
  • 9
5
votes
4 answers

Uppercase input in QLineEdit python way

I had drawn up an UI using the QT Designer but found out that there are no parameters for me to set QLineEdit inputs to be uppercase. After doing some online searching, I have only seen a very few handful of results that cater to my needs, however…
dissidia
  • 1,531
  • 3
  • 23
  • 53
5
votes
3 answers

QLineEdit editingFinished signal twice when changing focus?

I've found a few similar questions on this but these appear to refer to cases where a message box is used in the slot handler. In my case I am a bit stuck as I am getting the editFinished signal twice even when my slot handler is doing nothing. For…
Toby
  • 131
  • 2
  • 8
5
votes
5 answers

Pyside - Select all text when QLineEdit gets focus

I am new to Qt/PySide. I want QLineEdit to select all text in it when it gets focus. After getting focus and selecting all text, it should select all text only after focus is lost and gained again. It should not select all text when I change cursor…
Suresh Subedi
  • 660
  • 2
  • 10
  • 25
5
votes
2 answers

QLineEdit::textEdited() equivalent in QTextEdit?

In QLineEdit, there is a textEdit() signal, which only emits if the user changes the text, but not when you call setText(), So what's the equivalent in QTextEdit? I only see a textChanged() signal, and the documentation states it is emitted whenever…
daisy
  • 22,498
  • 29
  • 129
  • 265
4
votes
3 answers

How to subclass a widget to add more elements to it?

I'm trying to make a subclass of QTableView that has an embedded QLineEdit at the top for filtering the results as-you-type. I need my table to have the same API as a normal QTableView, so I want to subclass it rather than subclassing QWidget and…
swiss_miss
4
votes
3 answers

QCompleter and Tab key

I'm trying to make a Completion when pressing tab, you get the first completion of all possibilities. But, in a QWidget-based main window, pressing tab will make that QLineEdit lost focus, and completion popup hides after that. Is there a way to fix…
daisy
  • 22,498
  • 29
  • 129
  • 265
4
votes
1 answer

Issue in QLineEdit with title()?

In my Programme. use two QLineEdit. First one is normal and second one is titled Line edit. First one/normal QLineEidt works smoothly, But In second textbox(QLineEdit), I cannot insert a text at begging or any where at a time. for example : I…
Bala
  • 648
  • 5
  • 15
4
votes
1 answer

QLineEdit change PlaceholderText color

I have a LineEdit widget in an app and its PlaceholderText changes based on the user's input. However, I'd like for the PlaceholderText to look like normal text, i.e. to be black instead of grey. I've looked online but most of the results were…
Thibaut B.
  • 172
  • 1
  • 12
4
votes
0 answers

QDateEdit Select Section Text on Single Click

I have a QDateEdit with current date as default and the date format as "dd/MM/yyyy". When I click on the Month then the MM text should be selected. Also, when I click on the date edit the cursor position of the lineEdit() returns 0 as the cursor…
Helen
  • 41
  • 2
4
votes
2 answers

How can i get current focused QLineEdit in qt?

How can I identify which QLineEdit has the current focus in qt? To set the focus for QLinEdit I have tried: ui->linedit->setfocus(); but it also not working for me. How can I solve these two?
user3575807
  • 49
  • 1
  • 7
4
votes
3 answers

Display text from QLineEdit in a QTextEdit already containing some text and update it in real time

What is the procedure to make a text being written in a QLineEdit widget, dynamically display inside a QTextEdit that already contains some text? For example, let us say that a QLineEdit asks for a name where one writes "John". Is it possible to…
Meclassic
  • 209
  • 2
  • 5