qlineedit

inputRejected signal not found

余生颓废 提交于 2019-12-11 05:35:26
问题 ALL, connect(this, &QLineEdit::inputRejected, this, &this::my_handler); Qt 5.7.1 on Gentoo Linux error: 'inputRejected' is not a member of 'QLineEdit' Documentation doesn't give any restrictions on that signal. What is the problem? TIA! 回答1: inputRejected() has been recently introduced in Qt 5.12 so you'll have to update your version of Qt. [QTBUG-57448] Added inputRejected() signal for when a key press is not accepted by the QLineEdit. For instance, when an invalid key is pressed for a

pyside / pyqt: Getting values from dynamically created qlineedits on button clicked

半腔热情 提交于 2019-12-11 03:01:53
问题 I have a program that creates a number of qlineedits and buttons depending on the users input: On the image above 4 lines have been added with a button after the grayed out "Next" button was clicked. Now I want to get the input from the user into a function when the corresponding button is clicked (Click "Create Shot 1! --> goto a function with "exShot1" passed as an argument). The thing is I have no idea how to get the names of each qline and button when they are created in a loop. I guess I

Setting all QLineEdits to readOnly

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 01:26:48
问题 I am trying to make all of my QLineEdits(I have about 150) read-only, is there a way to do this without going through and setting each individually? I was hoping I could do something like QLineEdit::setReadOnly(true); in my constructor but I get a compiler error saying it is an illegal call of non-static member function. Thank you in advance! 回答1: Use QObject::findChildren() , like this: QList<QLineEdit*> l_lineEdits = ui->frame->findChildren<QLineEdit*>(); foreach (QLineEdit* l_lineEdit, l

Retrieve value of QTableWidget cells which are QLineEdit widgets

夙愿已清 提交于 2019-12-11 00:49:46
问题 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. Here's the code: int Calculator::calculatePricesSum(QTableWidget &moneyTableWidget){ double total = 0; QWidget *tmpLineEdit; QString *tmpString; for(int row=0; row<moneyTableWidget.rowCount(); row++){ tmpLineEdit = (QLineEdit*)moneyTableWidget

How to know if a QLineEdit got focus?

℡╲_俬逩灬. 提交于 2019-12-10 15:54:37
问题 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 should I do that? Also, please tell me how to use focusInEvent() function in order to know if QLineEdit myEdit; object got focus. EDIT: I have written the following function: bool LoginDialog::eventFilter(QObject *target, QEvent *event) { if (target == m_passwordLineEdit) { if (event->type() == QEvent

Select text of QLineEdit on focus

白昼怎懂夜的黑 提交于 2019-12-10 12:42:27
问题 I have created a dialog using QtDesigner. There is a QLineEdit object in the dialog with some default content. When the dialog initializes and the focus goes to the QLineEdit , I want the default content to be auto selected, so once the user start writing, the previous content will be overwritten. EDIT: In constructor: dialog->accept(); and connect( dialog, SIGNAL(accepted()), QlineObj, SLOT( selectAll() ) ); 回答1: Call lineEdit->selectAll(); after you set the default text. (In the dialog

Hide QLineEdit blinking cursor

跟風遠走 提交于 2019-12-07 03:35:46
问题 I am working on QT v5.2 I need to hide the blinking cursor (caret) of QLineEdit permanently. But at the same time, I want the QLineEdit to be editable (so readOnly and/or setting editable false is not an option for me). I am already changing the Background color of the QLineEdit when it is in focus, so I will know which QLineEdit widget is getting edited. For my requirement, cursor (the blinking text cursor) display should not be there. I have tried styleSheets , but I can't get the cursor

qlineedit auto resize to content

谁说我不能喝 提交于 2019-12-07 03:32:07
问题 I'm trying to do a small widget with a lineedit and a pushbutton. If the button is clicked, it should open a filedialog where I can select a file. The file name should then showed in the lineedit. Here is what i got so far: #include "widget_openimage.h" #include <QFontMetrics> Widget_openimage::Widget_openimage(QWidget *parent) : QWidget(parent) { // horizontal layout layout = new QHBoxLayout(); // linedit on the left which shows the path of the chosen file lineedit = new QLineEdit();

How to read out the text from QLineEdit in python?

∥☆過路亽.° 提交于 2019-12-07 01:54:05
问题 I have created for my plugin a start GUI with 3 buttons. This works very well and if I click on one of the buttons a specific action is started. So far this works. If I click on one of the buttons a new GUI with two buttons "ok" and "cancel" and a lineedit appears. If I push on cancel the GUI will be closed, if I push on ok, I want the program to read the text from the editline and store it in a variable. This doesnßt work so far. Here is the class containing the dialog: from PyQt4.QtCore

QValidator for hex input

拜拜、爱过 提交于 2019-12-07 01:48:56
问题 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 the user presses the backspace key 3 times, then I want it to display 00 11 22 3 . I almost have what i want, so far there is only one subtle bug involving