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
11
votes
1 answer

How to accomplish drop down word suggestions in Qt?

Say I have 10 names in a QListWidget (which is hidden) and an a QLineEdit. Now if I type the letter "a" in the line Edit it should display a drop down of all those name in the list widget that begin with the letter "A". the user could select using a…
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
10
votes
2 answers

How can I add a QLineEdit to Menubar

I am attempting to reclaim some screen real estate in my application. I've got a search bar that is a basic QLineEdit and takes up space. In my menu bar, I easily have enough room to fit this search box, but I can't figure out how to get the…
Andy
  • 49,085
  • 60
  • 166
  • 233
10
votes
3 answers

qlineedit auto resize to content

I'm trying to do a small widget with a lineedit and a pushbutton. If the button is clicked, it should open a filedialog where I can select a file. The file name should then showed in the lineedit. Here is what i got so far: #include…
yangsunny
  • 656
  • 5
  • 13
  • 32
10
votes
3 answers

QLineEdit with custom button

I need to implement LineEdit widget with possibility to add tool buttons at the right end of text area. I know two ways of doing that but both solutions seems ugly. 1) add tool buttons as child widgets of QLineEdit and handle resizeEvent to position…
ArmanHunanyan
  • 905
  • 3
  • 11
  • 24
10
votes
2 answers

How to prevent the default blue border being drawn on QLineEdit focus

I am trying to achieve a borderless QLineEdit through CSS. It works fine when the QLineEdit is not in focus but when in focus the default blue border always comes up. The simple CSS I am using: QLineEdit, QLineEdit:focus { border: none; } I have…
Soumya Das
  • 1,635
  • 2
  • 19
  • 28
10
votes
4 answers

QlineEdit with some default text for which cursor should not be moved?

In QT, a created lineEdit shows a text using the setText() method. But the cursor is movable for the default text. I want the cursor should not be movable for the default text. My lineEdit type has been set as password. Hence the default…
Mathan Kumar
  • 634
  • 2
  • 7
  • 19
9
votes
2 answers

Qt 4.6 QLineEdit Style. How do I style the gray highlight border so it's rounded?

I'm styling a QLineEdit to have rounded borders for use as a search box. The rounding of the borders themselves were easy, but I can't figure out for the life of me how to round the highlighted portion of the widget when it has focus. I've tried…
jkyle
  • 2,002
  • 1
  • 18
  • 23
9
votes
5 answers

How to set Input Mask and QValidator to a QLineEdit at a time in Qt?

I want a line edit which accepts an ip address. If I give input mask as: ui->lineEdit->setInputMask("000.000.000.000"); It is accepting values greater than 255. If I give a validator then we have to give a dot(.) after every three digits. What…
QtUser
  • 185
  • 2
  • 2
  • 12
9
votes
1 answer

How to make QLineEdit expand inside QScrollArea

I have a QLabel and a QLineEdit inside a QWidget. When I have the widget inside a QScrollArea, the line edit does not expand to occupy the excess width of the window. When the widget is not inside the scroll area, it does expand. I've tried setting…
Graeme
  • 95
  • 1
  • 5
9
votes
2 answers

Removing border of QLineEdit

I have a bunch of QLineEdit boxes that I want to remove the borders from. Ideally I want to just do this with one line of code, rather than having to set no border for each QLineEdit box. I am trying to use QLineEdit::setFrame(false); but this…
user2494298
  • 299
  • 3
  • 7
  • 23
8
votes
3 answers

QValidator for hex input

I have a Qt widget which should only accept a hex string as input. It is very simple to restrict the input characters to [0-9A-Fa-f], but I would like to have it display with a delimiter between "bytes" so for example if the delimiter is a space,…
Evan Teran
  • 87,561
  • 32
  • 179
  • 238
8
votes
6 answers

Hide QLineEdit blinking cursor

I am working on QT v5.2 I need to hide the blinking cursor (caret) of QLineEdit permanently. But at the same time, I want the QLineEdit to be editable (so readOnly and/or setting editable false is not an option for me). I am already changing the…
Asheesh
  • 129
  • 1
  • 3
  • 9
8
votes
1 answer

Editable multi-color QLineEdit

I know that you can change the color of a line edit, so long as all the text is the same color, but is it possible to assign different colors to characters? That is, some characters are red, and some are black, or simply every character has a…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
8
votes
1 answer

PyQT LineEdit Border Color

To bring the user's attention to the text field with an error (or if it is not filled) I colorize this QLineEdit) using: red = "QWidget { background-color:#8B0000;}" my_cool_QLineEdit.setStyleSheet(red) That makes an entire background of this…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
7
votes
1 answer

How to hide a row of a QTableWidget without changing the index of the entries?

I have a QTableWidget with 7 colums in a QDialog, where every row has information about files in a specific directory. With some checkboxes, lineedits etc I want to have the possibility to show only those files with a certain text, which I can…
erniberni
  • 313
  • 5
  • 17
1
2
3
39 40