qlineedit

Saving QList<T> to a file?

I've got a QList of QLineEdit*'s QList<QLineEdit*> example; Example will hold 100 items of lineEdits. When I try to save or load to a file, it fails to save or load the QList properly, if at all. I get a much lower than expected count of data. I see on QList<T>'s resource page here that there's the correct operator for << & >>, ho...

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) mdict.h: #include <QtGui/QWidget> class QLineEdit; class QListView; class QModelIndex; class...

Connecting multiple signals to a single slot in Qt

I'm trying to keep track of the textChanged() signal on for handful of QTextEdits. I want to do the same thing regardless of the text edit emitting the signal: uncheck its associated checkbox in a QListWidget if it becomes empty and leave it checked otherwise. The function I have so for is as follows: void MainWindow::changed() { QS...

Determining object types in Qt

I have a series of QTextEdits and QLineEdits connected to a slot through a QSignalMapper(which emits a textChanged(QWidget*) signal). When the connected slot is called (pasted below), I need to be able to differentiate between the two so I know whether to call the text() or toPlainText() function. What's the easiest way to determine the ...

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 the size policy of the line edit and the widget, to expand horizontally, but it doesn't ...

Showing tooltip of QLineEdit upon focus in Qt

I found that I can set a tooltip on a QLineEdit as such: equation = new QLineEdit(); equation->setToolTip("Example: a*b+c+~c"); However, I would like the tooltip to be displayed when that QLineEdit is focused. How do I do that? Thanks in advance. ...

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, and the user types 0011223344 I would like the line edit to display 00 11 22 33 44 Now if th...

How to know if a QLineEdit got focus ?

I want to be able to know if in the QLineEdit it was a click. So I guess I should reimplement the following function(??): void QLineEdit::focusInEvent ( QFocusEvent * e ) [virtual protected] How I should do that? Also, please tell me how to use focusInEvent() function in order to know if QLineEdit myEdit; object got focus. EDIT: H...

How to get text in QlineEdit when QpushButton is pressed in a string?

I have given my code below, have problem in implementing a function I want the text in lineedit with objectname 'host' in a string say 'shost'. when the user click the pushbutton with name 'connect'.How do i do it? I tried and failed. How to implement this function? import sys from PyQt4.QtCore import * from PyQt4.QtGui import * ...

Select text of QLineEdit on focus

Hi, I have created a dialog using qt designer. There is a QLineEdit object in the dialog with some default content. When dialog initializes focus goes to the QLineEdit, I want the default content to be auto selected so once user start writing previous content will be overwritten. Thanks, GG [EDIT] { in constructor } dialog->accept(); ...

PyQt4: AttributeError: 'QLineEdit' object has no attribute 'setPlaceholderText'

I have a QLineEdit, and I want to set a placeholder text. When I call setPlaceholderText(string) I get an AttributeError, but: >>> from PyQt4 import QtCore >>> QtCore.PYQT_VERSION_STR '4.7.4' >>> QtCore.QT_VERSION_STR '4.7.0' and from the QAssistant: This property holds the line edit's placeholder text. ... This property was...