qlineedit

Can QWidget detect mouse events on behalf of a QLineEdit?

白昼怎懂夜的黑 提交于 2019-12-02 02:26:00
问题 I have a QWidget that contains QLabels and QLineEdits side by side. When I click on a QLabel, I can use the mousePressEvent in QWidget. But when I click on QLineEdit, I can't detect the mousePressEvent in QWidget - only in the QLineEdit. I think that it is related to how QLineEdit works - I don't know the way to get mouse events within the whole region. EDIT : I have made a custom channel box for Maya like above. I try to select multiple channels by dragging the mouse. But as I mentioned, in

Add a click on QLineEdit

笑着哭i 提交于 2019-12-01 11:10:47
I am working on set a click() event to QLineEdit, I already successfully did it. But I want to go back to Mainwindow when the QLine Edit is clicked because I need the data in Mainwindow to further process the data. But I failed to let it go back, neither nor to cite the Mainwindow as parent, I hope someone can point it out. Thank you so much. MainWindow { ... self.tc = MyLineEdit(self.field[con.ConfigFields.VALUE])#self.tc = wx.TextCtrl(self.parent, -1, str(field[con.ConfigFields.VALUE]), pos=(x+220, y-3), size=(200, -1)) ... } class MyLineEdit(QtGui.QLineEdit): def __init__(self, parent

Editable multi-color QLineEdit

寵の児 提交于 2019-12-01 04:51:49
I know that you can change the color of a line edit, so long as all the text is the same color, but is it possible to assign different colors to characters? That is, some characters are red, and some are black, or simply every character has a different color. There is a similar question here - How can I change color of part of the text in QLineEdit? , but in my case there is an additional constraint - the QLineEdit must preserve color positions when edited, while new text that is entered assumes some default color. The other question does not have that constraint. It does have an answer that

Editable multi-color QLineEdit

旧时模样 提交于 2019-12-01 01:37:14
问题 I know that you can change the color of a line edit, so long as all the text is the same color, but is it possible to assign different colors to characters? That is, some characters are red, and some are black, or simply every character has a different color. There is a similar question here - How can I change color of part of the text in QLineEdit?, but in my case there is an additional constraint - the QLineEdit must preserve color positions when edited, while new text that is entered

How to accomplish drop down word suggestions in Qt?

眉间皱痕 提交于 2019-11-30 09:46:41
Say I have 10 names in a QListWidget (which is hidden) and an a QLineEdit . Now if I type the letter "a" in the line Edit it should display a drop down of all those name in the list widget that begin with the letter "A". the user could select using a mouse or a keyboard (since there will be a vertical scroll-bar). I am not sure if a QLineEdit could do this. But I would like to know what is out there to accomplish this. Nejat You can use QCompleter which provides a way for autocompletion in widgets like QLineEdit and QComboBox . When the user starts typing a word, QCompleter suggests possible

How to set Input Mask and QValidator to a QLineEdit at a time in Qt?

狂风中的少年 提交于 2019-11-30 09:25:44
I want a line edit which accepts an ip address. If I give input mask as: ui->lineEdit->setInputMask("000.000.000.000"); It is accepting values greater than 255. If I give a validator then we have to give a dot(.) after every three digits. What would the best way to handle it? lpapp It is accepting value greater than 255. Absolutely, because '0' means this : ASCII digit permitted but not required. As you can see, this is not your cup of tea. There are at least the following ways to circumvent it: Write a custom validator Use regex Split the input into four entries and validate each entry on its

Qt Set Background Color of QLineEdit

…衆ロ難τιáo~ 提交于 2019-11-30 08:58:14
问题 I'm trying to change the background color of the QLineEdit and I can't figure it out at all. I tried using stylesheets originally like this QLineEdit *le = new QLineEdit(); le->setStyleSheet("background:#000;"); but that didn't do anything. I tried using QPalette like this QPalette palette; palette.setColor(QPalette::Base, Qt::black); palette.setColor(QPalette::Background, Qt::black); le.setPalette(palette); but this didn't do anything either. I've been looking all day and can't find anything

Allow entry in QLineEdit only within range of QDoubleValidator

感情迁移 提交于 2019-11-30 07:14:44
问题 I have a set of QLineEdits that are supposed to accept double values within a certain range, (e.g., -15 to 15). I have something along these lines when setting up each: lineEdit->setValidator(new QDoubleValidator(minVal, maxVal, 5, lineEdit)); Ideally, the line edits would work such that only values in range can be entered. When I tried this out, I noticed that only numbers could be typed, as desired, but that they could still go out of range. How can I dynamically force the input to fit into

python QLineEdit Text Color

柔情痞子 提交于 2019-11-30 03:48:14
问题 I am trying to create a demonstration app to show how to change font colors. I can do it in QLabel and QTextEdit I have found no way to change the foreground text color for a QLineEdit. The only thing I've tried that does not throw an error is: color = QColorDialog.getColor(defaultHost.textColor(), pWidget, 'Get Text Color') myPalette.setColor(myPalette.WindowText, QColor(color)) But, the text color remains black... Is it or is it not possible to do this? 回答1: You can do it by setting the

Qt Set Background Color of QLineEdit

▼魔方 西西 提交于 2019-11-29 13:34:46
I'm trying to change the background color of the QLineEdit and I can't figure it out at all. I tried using stylesheets originally like this QLineEdit *le = new QLineEdit(); le->setStyleSheet("background:#000;"); but that didn't do anything. I tried using QPalette like this QPalette palette; palette.setColor(QPalette::Base, Qt::black); palette.setColor(QPalette::Background, Qt::black); le.setPalette(palette); but this didn't do anything either. I've been looking all day and can't find anything. am I doing something wrong or is there another way to do it? Works fine for me: QLineEdit *le = new