| 40 | }; |
| 41 | |
| 42 | static void changeTextColorToRed(QLineEdit *lineEdit, const QColor &red) |
| 43 | { |
| 44 | if (!lineEdit) { |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | // Everything > 52 = red color |
| 49 | QList<QInputMethodEvent::Attribute> attributes; |
| 50 | if (lineEdit->text().length() > 52) { |
| 51 | int start = 52 - lineEdit->cursorPosition(); |
| 52 | int len = lineEdit->text().length() - start; |
| 53 | QInputMethodEvent::AttributeType type = QInputMethodEvent::TextFormat; |
| 54 | |
| 55 | QTextCharFormat fmt; |
| 56 | fmt.setForeground(red); |
| 57 | QVariant format = fmt; |
| 58 | |
| 59 | attributes.append(QInputMethodEvent::Attribute(type, start, len, format)); |
| 60 | } |
| 61 | QInputMethodEvent event(QString(), attributes); |
| 62 | QCoreApplication::sendEvent(lineEdit, &event); |
| 63 | } |
| 64 | |
| 65 | GitCommitDialog::GitCommitDialog(const QString &lastCommit, QWidget *parent, Qt::WindowFlags f) |
| 66 | : QDialog(parent, f) |
no test coverage detected