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
0
votes
2 answers

QString to short using toShort

I want to convert QString to short.when I try this code ui->lineEdit->text().toShort(); It works well for text = 20 but it returns "0" for value = 20.5. but I need value = 20. how can I solve it?
citi
  • 31
  • 2
  • 7
0
votes
1 answer

QValidator prevents intermediate typing

I have a QLineEdit that accepts a string that will be evaluated at a javascript expression like "[0,3]" and connected to fire changes using editingFinished(). I added a validator so the user couldn't leave the input with a bad expression, but…
voodoogiant
  • 2,118
  • 6
  • 29
  • 49
0
votes
1 answer

qt5 designer, using fileopen, displaying file path in lineedit, is there an issue doing it this way?

just started using qt, looked through docs, google, examples, etc.. trying to find simple examples(working mind you) that showed how to do (imho) simple things, by themselves. well i stumbled upon my answer and i was wondering if this approach would…
angjminer
  • 3
  • 3
0
votes
0 answers

How to allow QLineEdit from Designer to accept only integer in the range 0 to 255?

QT version 5.1 I have 2 issues: 1) I am wondering is there is any way I can set QLineEdit widget to accept only integer in the range from 0 < x < 255 from QT DESIGNER. I guess Input Mask can do this thing for us but wondering how ? 2) Only if…
samprat
  • 2,150
  • 8
  • 39
  • 73
0
votes
1 answer

Tkinter .focus_set() equivalent in PyQt4

I have a Qlineedit widget which i will use to accept the username. It will be displayed as soon as user launch the application. I want the Qlineedit widget ready for typing (ie, with cursor already in place) without needing the user to use mouse to…
Chris Aung
  • 9,152
  • 33
  • 82
  • 127
0
votes
1 answer

Setting focus on QLineEdit while showing the QListView view

In Qt, there is a QCompleter class which provides auto-complete funtionanity. I want to use QListView to finish the same thing. In the following code, When the QListView shows, QLineEdit will lose focus. How could I keep QLineEdit's focus? 1)…
hu.
  • 131
  • 1
  • 9
0
votes
2 answers

QLineEdit -- how to enter single value -- with no spaces

I have made an editor in which i have to enter a Hex or decimal value in each field. Here the field i am using is QLineEdit. Now requirement is that each Qlineedit box accept only one value without spaces. Then i can read this text value & convert…
Katoch
  • 2,709
  • 9
  • 51
  • 84
0
votes
1 answer

Onscreen Keyboard Show/Hide

What I want I made onscreen keyboard using simple QPushButtons and QFrame. What I want, when a input widget (QLineEdit, QTextEdit, QPlainText, QSpinBox) is in focus my onscreen keyboard will show and when no input widget is in focus, my keyboard…
Jai
  • 1,292
  • 4
  • 21
  • 41
0
votes
1 answer

show onscreenkeyboard when type in QLineEdit in Qt

I want to show osk.exe(onscreenkeyboard) when click on the QLineEdit and when focus out osk.exe hide or minimized? how can i do? thanks
Sarkhan
  • 1,281
  • 1
  • 11
  • 33
0
votes
1 answer

How to implement undo in a QLineEdit heir?

How to use QLineEdit's built-in undo/redo functionality while implementing custom input logic? I am implementing a custom editor for amounts of money for a cashier's efficient work. Basic features are: The format is always ^\d+,\d{2}$; When cursor…
0
votes
1 answer

puqt4 clearing the line edit field

I am trying to create tqo line edit and when i click on the line edit box i should be able to clear the current text. I tried the below code but no success , Can someone point out what is wrong here? OPTIONS = ['Enter IP Address','Number of…
user2190483
  • 269
  • 1
  • 5
  • 22
0
votes
1 answer

Change Case to Capital on focusOutEvent

I have a customized QLineEdit editor for inputting initials in a delegated QTableWidget. I would like to force upper case once the focus has been left without using an input mask (f.i. without using self.setInputMask(">AA")) Notes: - the QLineEdit…
David Yee
  • 3,515
  • 25
  • 45
0
votes
1 answer

Perform Input Validation in QAbstractItemDelegate / Custom QLineEdit

I would like to perform input validation on a customized QTableWidget that has its setItemDelegate to a subclass of QStyledItemDelegate. The input validation works and my error message pops up correctly, but the focus moves on to the next cell…
David Yee
  • 3,515
  • 25
  • 45
0
votes
2 answers

Qt5 custom LineEdit widget (QLineEdit subclass) private variable crashes application

I've created a custom QLineEdit widget that handles drag and drop of files. Everything is working great with that part, but as soon as I add a Class variable the application crashes either at the construction of the class or at destruction: When my…
speed488
  • 302
  • 1
  • 10
0
votes
2 answers

How to keep Qt Widgets responsive to keyboard and mouse while handling Windows Events?

My app have a QLineEdit and a QPushButton which not respond properly to inputs of keyboard and mouse (the QLineEdit is not receiving the keyboard inputs, and both the QLineEdit and QPushButton are not receiving mouse inputs) when my app is handling…
Antonio Dias
  • 2,751
  • 20
  • 40