diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-09-21 22:29:02 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-09-21 22:29:02 +0000 |
commit | 1eaec12c5219e65378f10cb7eeb1eaf478f9628b (patch) | |
tree | 8f176cc2df3b5c0e9c8d4c3eed0f4968e21310ea | |
parent | more beautifying findwidget (diff) | |
download | gpg4usb-1eaec12c5219e65378f10cb7eeb1eaf478f9628b.tar.gz gpg4usb-1eaec12c5219e65378f10cb7eeb1eaf478f9628b.zip |
even more beautifying and added F3 as key for find next
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@964 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | findwidget.cpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/findwidget.cpp b/findwidget.cpp index 7147fef..23deb33 100644 --- a/findwidget.cpp +++ b/findwidget.cpp @@ -22,12 +22,12 @@ FindWidget::FindWidget(QWidget *parent, QTextEdit *edit) : void FindWidget::findNext() { cursor = mTextpage->document()->find(findEdit->text(), cursor, QTextDocument::FindCaseSensitively); - mTextpage->setTextCursor(cursor); // if end of document is reached, restart search from beginning if (cursor.position() == -1) { cursor.setPosition(0); cursor = mTextpage->document()->find(findEdit->text(), cursor, QTextDocument::FindCaseSensitively); } + mTextpage->setTextCursor(cursor); } void FindWidget::find() @@ -47,30 +47,8 @@ void FindWidget::keyPressEvent( QKeyEvent* e ) case Qt::Key_Escape: mTextpage->setFocus(); this->close(); - } -} + case Qt::Key_F3: + this->findNext(); -//QPalette bgPalette( findEdit->palette() ); -/* if ( start == -1 ) { - haveHit =true; - // set background of lineedit to red - bgPalette.setColor( QPalette::Base, "#ececba"); - QTextCharFormat format = cursor.charFormat(); - format.setBackground(QBrush(Qt::white)); - cursor.setCharFormat(format); - qDebug() << "cursor: " <<cursor.position(); -} else { - haveHit =true; - // set background of lineedit to white - bgPalette.setColor( QPalette::Base, QColor(Qt::white) ); - cursor.setPosition(start); - cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, findEdit->text().length()); - - qDebug() << "cursor: " <<cursor.position(); - - QTextCharFormat format = cursor.charFormat(); - format.setBackground(QBrush(Qt::yellow)); - cursor.setCharFormat(format); + } } -findEdit->setPalette(bgPalette); -*/ |