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

QLineEdit in QDialog does not show the text that is typed in it

I am developing an application in QT For Symbian 3. I have a QDialog that takes text input from user. Everything works fine except that the text entered in QLineEdit cannot be seen. The text is there but it is not visible. I used update() and…
Khalil
  • 360
  • 1
  • 4
  • 14
2
votes
1 answer

How to hide action button when QLineEdit is disabled?

I have a class which is inherited from QLineEdit, and I set an icon as an action button for this. MyEdit::MyEdit( QWidget *p_parent ) : QLineEdit( p_parent ) { m_buttonAction = addAction( QIcon( "search.png" ), QLineEdit::TrailingPosition ); …
songvan
  • 369
  • 5
  • 21
2
votes
1 answer

QLineEdit emits returnPressed when getting focus triggered by other returnPressed singal

I've 2 QlineEdit and a QPushbutton QLineEdit *field1 = new QlineEdit(); QLineEdit *field2 = new QLineEdit(); QPushButton *button = new QPushButton(); What I want: If the user presses return in field1 the focus shall be changed to field2. If the…
Maro
  • 43
  • 6
2
votes
1 answer

QLineEdit show selected text from mouse selection with push button

I want to get the selected text from a QLineEdit widget. We get the selected text by clicking on a push button. It works if the text was programatically selected with selectAll. But it does not work if the text is selected with a mouse. In the…
Jan Bodnar
  • 10,969
  • 6
  • 68
  • 77
2
votes
1 answer

Problem in EventFilter, with Alt /Shift modifiers from QLineEdit

From QLineEdit, if I press : Ctrl + S, it works fine But at the same time, if I press Alt + C, or Shift+S (as per my code) Event filter works fine, but at the same time QLineEdit Box Updated with that Pressing key. For example if I…
Bala
  • 648
  • 5
  • 15
2
votes
2 answers

model/view QCompleter in a QLineEdit

ubuntu 10.04, KDE 4.4.5 python 2.6.4 qt 4.6.2 pyqt 4.6.2 I'm trying to create a QCompleter, which works fine if I just build the QLineEdit. However if I drop the QLineEdit into a QMainWindow, the QCompleter no longer works. Here is the LineEdit…
T Carrasco
  • 463
  • 2
  • 6
  • 16
2
votes
1 answer

QLineEdit readOnly disables clear button as well

Essentially this post describes the problem however the answers are for c++ and I'd like to know if there is a way to do this in python. Turning a lineedit into readOnly mode also disables the clearButton and I wondered if it is possible to keep…
HdM Upload
  • 35
  • 3
2
votes
2 answers

QLineEdit placeholder text not working in Qt 4.6.3

I am using Qt 4.6.3, and tried to set some placeholder text on a QLineEdit. But these methods didn't work: using Qt designer (uic) through code ui->lineedit.setPlaceholderText("phtext") setProperty("placeholderText","phtext") The error is that…
yolo
  • 2,757
  • 6
  • 36
  • 65
2
votes
1 answer

how to remove the cursor in QLineedit completer

This is my sample program for Qlineedit Completer. After Autosuggestion i want to display the text as starting of the item in line edit for that i wrote completer.activated.connect(lambda: QTimer.singleShot(0, lambda: edit.home(False))). Its…
raghava
  • 119
  • 2
  • 11
2
votes
1 answer

python GUI autocomplete by key value

I am trying to create an autocomplete GUI in python such that as I type a first name, I see possible last names. For example, let's say I have this dictionary: {"George": ["Washington", "Bush"]}. When I start typing "G", I want it to show…
SKCSS
  • 37
  • 4
2
votes
0 answers

How to remove inline completion for QCompleter?

I'm trying to create a subclass for QCombobox and QCompleter to achieve the following: I want to make editable combobox which pops-up completion list when user starts typing. Ex: Completion List - QStringList<<"manual"<<"anual" When I type 'anu', I…
Pramod
  • 121
  • 2
  • 16
2
votes
2 answers

How to get the QLineEdit text offset when have QAction at leading position

I have a QLineEdit with a QAction at leading position. I want to know the start position of the text but I don't find how to do: QLineEdit *le = new QLineEdit(parent); le->addAction(QIcon(":/myicon"), QLineEdit::LeadingPosition); // Now I want to…
thibsc
  • 3,747
  • 2
  • 18
  • 38
2
votes
1 answer

PyQt5 QLine setInputMask + setValidator IP address

Problem to combine a setInputMask and setValidator IPv4 Address into a QlineEdit I have a QLineEdit to set my IPv4 address. In the first time, I set my QLineEdit with setInputMask to have " . . . " In the second time, I'm using a Ip Validator to…
2
votes
0 answers

How to get QLineEdit text cursor position realtime

I'm trying to get the position -(x,y) coordinates- of the text cursor in a QLineEdit row.(not mouse position) Considering the current position of the text cursor x = 100 and y = 100, after typing foo in QLineEdit Assuming each letter move the…
GLHF
  • 3,835
  • 10
  • 38
  • 83
2
votes
1 answer

Add syntax highlighting to parts of the text being entered in a QLineEdit

Using PySide/PyQT, I need to add some syntax highlighting to text being entered in a QLineEdit. I need to highlight specific key words. I saw the post below with an example of how to do this in C++ but I'm trying to do it in Python. (Tried…
flewis
  • 41
  • 4