B
B
Baizel2019-06-20 08:23:46
Python
Baizel, 2019-06-20 08:23:46

How to highlight a QLineEdit cell and display an invalid input message?

I am intercepting the text change signal in a cell. The input must be within a certain range. When out of range, I deactivate the button, I would like to highlight the cell and show a message about invalid input. How can this be done? The function code for interception is given.

def on_text_changed_tapv(self, text):
        if text == "":
            pass
        elif float(text.replace(',', '.')) < 0.16 or float(text.replace(',', '.')) > 1.0:
            self.ui.lineEdit_tapv.setModified(False)
            self.ui.pushButton.setEnabled(False)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bbkmzzzz, 2019-06-20
@Baizel

you can use setStyleSheet
styleSheet syntax almost completely repeats css, it is set by a line
for example:
For a message, you can use QMessageBox

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question