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

Show decimal number in QLineEdit

I have this little piece of code: Qint32 value Value = price * qty; Qstring str; Ui->lin->text(str.number(value)); But when I build it gives me the wrong values. The variables price and qty represent values from the database which I want to display…
Chris
  • 17
-1
votes
1 answer

I want to add a color for the text for every new line added PyQt5

I am trying to figure out how to color the text using TextEdit in a line Edit, but for any new text I will choose the color. Let's say if it is an error I want it to be red or for warning I want it to be yellow and in a normal case to remain…
Mihai
  • 19
  • 1
  • 5
-1
votes
1 answer

How to select rows on QTableWidget and return the value to the QLineEdit

I want to make that when i click on particular cell on the QTableWidget it will block the corresponding rows and I want to return the value of each row selected into the QLineEdit. I couldnt seem to find the solution my code only return when i…
-1
votes
1 answer

Google search suggestion in PyQt5

I built a google search suggestion completer for my simple browser built with pyqt5 and python. code is below. self.url_bar = QLineEdit() self.url_bar.textChanged.connect(self.suggest) def suggest(self): suggestlist =[] term…
-1
votes
1 answer

how to be uable to input more than specific value in digit in python

I would like to limit digit input value in PyQt5 QLineEdit Gui in Python. The explanation photo is below. Wind direction is from 0 to 359 degree. so, the value to be able to input is from 0 to 359. The code that I made is below. class…
Woody Kim
  • 29
  • 8
-1
votes
1 answer

How do you get text from dynamically created QLineEdit in a QToolBox?

I am trying to make a variable number of pages on a QToolbox with a set number of QLineEdit fields. The number of pages and their names is determined by a vector of strings. Each page of the QToolbox has two QLineEdits. After the fillToolbox…
BDD
  • 25
  • 1
  • 6
-1
votes
3 answers

QT: How to retrieve floating point value from QLineEdit form fields

how do i get/convert the text from a QLineEdit field. the code below is operated by a button / slot. but when compiled and pressing the button, 0.00000000000 shows up. no calculation takes place, whatever numbers i type into fields. float solution =…
NaturalDemon
  • 934
  • 1
  • 9
  • 21
-1
votes
1 answer

How can I append the same element several times in python?

I am creating a GUI with NUMBER of line edits. However, to get the text that is written in them I tried to make a list of LineEdits and append/add a LineEdit element to the list for each iteration. Then I tried to add the current item to the layout…
AuroraS
  • 59
  • 8
-1
votes
1 answer

How to programmatically pass QLineEdit content into QTableView rows using QPushButton

I am trying to programmatically pass the content of a QLineEdit into rows of a QTableView using a QPushButton. I was wondering if there is anyone who can provide some guidance on how to do that. Basically this is the initial situation: and this is…
Emanuele
  • 2,194
  • 6
  • 32
  • 71
-1
votes
1 answer

How to get QString from one window to another window, via pressing a button in a 3rd window

New to C++ and Qt as part of a research project (biology) and have been struggling with presumably some quite simple stuff. I'd really appreciate someone's help. I'm working with a GUI for a pre-existing programme and I'm trying to transfer a…
-1
votes
1 answer

from a GUI, how to read, edit, and save info in a txt file -> Qt c++ GUI qLineEdit

Good morning, I want to improve a GUI with QT c++ to read, edit and save info in a txt file. This is what I have: A txt file with some parameters written (like "A=1 B=5 ...") And I have been able to do the following with my qt code in c++ : 2.1. I…
Minikornio
  • 47
  • 5
-1
votes
1 answer

Setting a variable in a QlineEdit PyQT

I need to put a value of an element ( float) of a list into a QlineEdit of GUI i developed with Qt Designer. raw = self.model_lineEdit.text() print('raw : ', raw) ic,E = zip(*[ list(map(float,line.split(", "))) for line in raw.split("\n") ]) E,ic…
Felahi.M
  • 3
  • 3
-1
votes
2 answers

Can't retrieve text value from QLineEdit

Im trying to retrieve the text() value from a simple QLineEdit function but I'm unable to make it work, I'm new to Qt so I'm kinda lost, especially when using pointers. Inside my ui_Ventas2.h file, Qt already initialize all the classes QLineEdit…
lightshadown
  • 165
  • 1
  • 1
  • 10
-1
votes
1 answer

PyQt QLineEdit get value from separate .py file

I have the following code in one python file (sales.py) and want to display the results of the script's calculation in a QLineEdit of a separate file (control.py). All line_edit.setText(def), line_edit.dispayText(def), line_edit.setText(subtotal)…
rainer
  • 3,295
  • 5
  • 34
  • 50
-1
votes
1 answer

PyQt5 how to set QLineEdit behaviour like '\n'

The answer is probably really simple but I searched like 30 mins and couldn't find anything. I just want to set QLineEdit like what does \n do. To be more specific, when I start to type in QLineEdit, if it's a long sentence and bigger than the width…
GLHF
  • 3,835
  • 10
  • 38
  • 83
1 2 3
39
40