From 33d5f7672ba5933f1f5892b7b986c374f8533b64 Mon Sep 17 00:00:00 2001 From: Ubbo Veentjer Date: Sun, 21 Feb 2016 16:39:56 +0100 Subject: color if nothing found --- findwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'findwidget.cpp') diff --git a/findwidget.cpp b/findwidget.cpp index ba0dd15..ff8de5a 100644 --- a/findwidget.cpp +++ b/findwidget.cpp @@ -34,7 +34,8 @@ void FindWidget::setBackground() QTextCursor cursor = mTextpage->textCursor(); // if match is found set background of QLineEdit to white, otherwise to red QPalette bgPalette( findEdit->palette() ); - if ((cursor.position() == -1) && (!findEdit->text().isEmpty())) { + + if (!findEdit->text().isEmpty() && mTextpage->document()->find(findEdit->text()).position() < 0 ) { bgPalette.setColor( QPalette::Base, "#ececba"); } else { bgPalette.setColor( QPalette::Base, Qt::white); -- cgit v1.2.3