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
4
votes
3 answers

How to know if a QLineEdit got focus?

I want to be able to know if in the QLineEdit it was a click. So I guess I should reimplement the following function(??): void QLineEdit::focusInEvent ( QFocusEvent * e ) [virtual protected] How should I do that? Also, please tell me how to use…
Narek
  • 38,779
  • 79
  • 233
  • 389
4
votes
1 answer

QCompleter on QLineEdit for parts of the inserted text

I made a QLineEdit for reading an infix maths expression. Operators are limited to the +-*/ and brackets. Values can be numeric or a variable name representing a numeric value. I want to autocomplete for variable names. The problem is that…
Mark Ang
  • 149
  • 1
  • 11
4
votes
2 answers

How to put a static text (postfix, prefix) in QLineEdit?

How can I put a static text in QLineEdit in Qt C++ so that it can not be deleted and when I write to QLineEdit, it should not be spaced.
Programming
  • 143
  • 1
  • 2
  • 10
4
votes
2 answers

How to use QlineEdit to enter integer values

I am trying to use QlineEdit. How would I enter a value into the edit bar when I run the program and get that valued stored as a variable to be used later. So far I have only found out how to enter text using void…
Duanne
  • 137
  • 1
  • 3
  • 13
4
votes
2 answers

Style Sheet for rounded corners on QLineEdit content?

I'm using Qt style sheets to create a custom QLineEdit that has a light blue border around it when it has focus. Here is the style sheet : this->setStyleSheet(" QLineEdit { " " border-radius: 4px; " …
Jesse J
  • 532
  • 1
  • 7
  • 18
4
votes
2 answers

How to do - QToolButton inside the QlineEdit : Qt5

I want to add QToolButton inside the QLineEdit. I want to clear the text of QLineEdit control on that button click. For example how in google image: I have looked : This StackOverflow article But still not solved my issue. Thanks in Advance.
AB Bolim
  • 1,997
  • 2
  • 23
  • 47
4
votes
1 answer

AttributeError: 'QTextEdit' object has no attribute 'text'

Sometimes I need to make multiple copies of code with incrementing numbers. In a form I'm coding, I need to make upwards of 12 checkboxes, each of which requires the following code: self.checkBox1 = QtGui.QCheckBox() …
Marc B. Hankin
  • 771
  • 3
  • 15
  • 31
4
votes
3 answers

QLineEdit: displaying overlong text as a tooltip if hovering with mouse

Under Windows, I've seen a nice feature: If I hover with the mouse over a short text field which contains overlong text not fitting completely into the field, a tooltip opens, displaying the complete contents of the text field. Can someone point me…
lemzwerg
  • 772
  • 7
  • 15
4
votes
2 answers

How to set QLineEdit default text to one space?

I entered one space as a QLineEdit's text in the Qt Creator GUI Designer. I can see that the space is there in the designer wiew, but if I compile and run it, the space disapears. I want this space to be a QLineEdit's default text, how can set it,…
totymedli
  • 29,531
  • 22
  • 131
  • 165
3
votes
2 answers

How to set the color of caret blinking cursor in QLineEdit

How to set the color of caret blinking cursor in QLineEdit? I have a question, which is how to change the color of caret blinking cursor in QLineEdit.
liulangya
  • 31
  • 3
3
votes
3 answers

How to avoid Null or empty value in Lineedit of Pyqt5

I have created a form using PyQT5 using python, in the form I getting value from user through QLineEdit. My problem is that user should not leave any of the field empty in the form. How to avoid empty Lineedit?
Shri
  • 99
  • 1
  • 1
  • 6
3
votes
1 answer

retrieve value from QlineEdit inside QtableWidget in Pyqt4 Python

I am having trouble in Retrieving the Entered in QWidgetlineEdit box. Got C++ Implementation of the Same but unable to retrieve using Python, self.line = QtGui.QLineEdit() i =0 while(i
3
votes
1 answer

Expand cursor length QLineEdit?

I'd like to take a normal QLineEdit, and change the shape of the cursor. So with a subclass like so: class myLineEdit : public QLineEdit { Q_OBJECT signals: public: explicit myLineEdit(QWidget * parent = 0) { } protected: }; And…
progro
  • 33
  • 4
3
votes
1 answer

QLineEdit Validation for {[A-Z] [a-z][0-9]} text input

I want to accept a new username from the user in my application. I want the username string to contain only A-Z or a-z or 0-9, and have a maxLength of 8. So I want to validate the input from QLineEdit. I went through the documentation but I am…
Surjya Narayana Padhi
  • 7,741
  • 25
  • 81
  • 130
3
votes
2 answers

Reveal password for dialog in Qt

I need to create a login dialog like this image files: eyeOn.png, eyeOff.png Requirements: password is shown only when we CLICK AND HOLD the eyeOn icon (even when we click and hold and drag the mouse to area outside of the dialog, the password…
gnase
  • 580
  • 2
  • 10
  • 25