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

Unexpected behavior of QDoubleValidator using PyQt5

I am trying to use QDoubleValidator in an application to validate float numbers in the range 0.00 to 99.99 that are enter in a QLineEdit widget. For that I use a structure like the following: self.e2 =…
Juan Osorio
  • 378
  • 3
  • 15
3
votes
1 answer

Retrieve value of QTableWidget cells which are QLineEdit widgets

I create a QLineEdit,set a validator and put it on the table with this code: ui->moneyTableWidget->setCellWidget(rowsNum, 1, newQLineEdit); Then I've got another class for manipulating the table's data doing the sum of every value of a column.…
Segolas
  • 575
  • 2
  • 10
  • 26
3
votes
1 answer

Why does a QLineEdit widget generate an "editingFinished" signal when other widgets are activated?

I'm trying to understand why QLineEdit "editingFinished" signals are generated when other widgets are selected. In the example below the "on_lineedit" method is called when the combo box is selected. Why? import sys from PyQt5 import…
ToddP
  • 652
  • 13
  • 18
3
votes
1 answer

Adjusting the width of QLineEdit to contents (and getting shorter than expected)

I have a similar issue as in this question, but the answer to that does not work well for me. I have a QLineEdit element with a short piece of text, and I want this element to be adjusted in width to the contents, so that the text fits right into…
Maximko
  • 627
  • 8
  • 20
3
votes
1 answer

PySide: How to have Input Mask and Place Holder Text at the same time

I'm trying to make a lineEdit widget have place holder text (look like 'MM/DD/YYYY') when not in focus and have input masking (looks like ' / / ', or you can put in slashes through other means) when in focus. Currently the input mask…
Arda Arslan
  • 1,331
  • 13
  • 24
3
votes
1 answer

PyQt4 filter by text on a QListView using setRowHidden

I have a dialog which looks like this: That dialog has the following code connected to the filter button: class Dialog(QtGui.QDialog, addWin.Ui_Dialog): ... self.list = QListView() self.filter.clicked.connect(self.filterClicked) …
birdmw
  • 865
  • 10
  • 18
3
votes
2 answers

PyQt: retrieving values from QLineEdit

I'm developing a chat program using Python-3.5 and Qt Creator for the GUI. At first when Enter is pressed it calls the first function called run_chat. So far so good. But when the if statement is true, I want to get the next value entered by the…
Eman S.
  • 145
  • 1
  • 8
3
votes
1 answer

adding Focus In and Focus out events in Q Line Edit PYQT

I want to set FocusIn and Focusout events on QLine Edit widget but not able to do so. i know that i am very near to the solution but not able to get the exact solution. my code:- from PyQt4.QtGui import * url = QtGui.QLineEdit("Please enter URL",…
ashish
  • 126
  • 3
  • 13
3
votes
3 answers

QlineEdit selectAll doesn't work?

I use folowing code. In it lineEdit->selectAll() works called by pushButton and only at first launch called by eventFilter. Although label->setText works all time propperly. Why? Widget::Widget(QWidget *parent) : QWidget(parent), ui(new…
Shatodor
  • 91
  • 1
  • 7
3
votes
0 answers

How to remove focus from QLineEdit

I am developing a cpp/Qt tool.When I click on a QLineEdit field, its frame turns to a different color and the cursor starts blinking.When I type on Return in the field, I want its cursor to stop blinking and its frame color to default back to…
Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89
3
votes
1 answer

How does QLineEdit triger QAbstractItemDelegate::commitData

I am developing a Qt application using QTreeView and QAbstractItemModel. The model contains somewhat heterogenous data, which requires different controls for editing. I am implementing it by having a custom delegate, that queries…
Serge
  • 1,027
  • 14
  • 21
3
votes
1 answer

How to search for and select items from a QListView?

I have a QLineEdit and a QListView. I use QStringListModel to populate the QListView with items. If I type something in the QLineEdit, how can I find and select an item from the QListView that begins with the text that I am typing in the QLineEdit?
Bhaddiya Tanchangya
  • 331
  • 1
  • 5
  • 12
3
votes
2 answers

Automatic focus on showing deletes the placeholder text of a QLineEdit

I use PyQt4 and Python 2.7.9. My program contains a few QLineEdit objects. The problem is that when the program is launched, one of the QLineEdits is being focused automatically, which causes my placeholder text to disappear. Is there any way to…
ohad987
  • 326
  • 2
  • 4
  • 15
3
votes
2 answers

How to display Arabic notations in left-to-right direction in QLineEdit/QLabel etc.?

In Qt's implementation arabic notation is shown in right-to-left direction, thus any strings that contain arabic notations will be right-aligned. But what my application wants to do is showing all texts in left-to-right direction, whether it…
waterd
  • 603
  • 1
  • 7
  • 23
3
votes
1 answer

Programmatically validate a QLineEdit

I have a QLineEdit with a QDoubleValidator, calling QDoubleValidator::setRange will not validate the current text of the QLineEdit. How could I programmatically validate (focusing and unfocusing it with the mouse work ) Here is the code of my…
Mathieu Westphal
  • 2,544
  • 1
  • 19
  • 33