[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kviewshell
From: Wilfried Huss <Wilfried.Huss () gmx ! at>
Date: 2005-04-22 18:24:57
Message-ID: 20050422182457.B29755FA () office ! kde ! org
[Download RAW message or body]
CVS commit by whuss:
Escape closes the search panel.
Enter -> find next
Shift+Enter -> find previous
M +19 -6 searchWidget.cpp 1.2
M +4 -1 searchWidget.h 1.2
--- kdegraphics/kviewshell/searchWidget.cpp #1.1:1.2
@@ -42,5 +42,5 @@ SearchWidget::SearchWidget(QWidget* pare
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
- layout = new QHBoxLayout(this, 11, 6, "SearchWidgetLayout");
+ layout = new QHBoxLayout(this, 4, 6, "SearchWidgetLayout");
stopButton = new QPushButton(this, "stopButton");
@@ -69,5 +69,5 @@ SearchWidget::SearchWidget(QWidget* pare
layout->addWidget(caseSensitiveCheckBox);
- connect(stopButton, SIGNAL(clicked()), this, SLOT(stopClicked()));
+ connect(stopButton, SIGNAL(clicked()), this, SLOT(hide()));
connect(findNextButton, SIGNAL(clicked()), this, SIGNAL(findNextText()));
@@ -75,5 +75,4 @@ SearchWidget::SearchWidget(QWidget* pare
connect(searchText, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged()));
- connect(searchText, SIGNAL(returnPressed()), this, SIGNAL(findNextText()));
textChanged();
@@ -109,4 +108,10 @@ void SearchWidget::show()
}
+void SearchWidget::hide()
+{
+ QWidget::hide();
+ emit searchEnabled(false);
+}
+
void SearchWidget::setFocus()
{
@@ -114,8 +119,16 @@ void SearchWidget::setFocus()
}
-void SearchWidget::stopClicked()
+void SearchWidget::keyPressEvent(QKeyEvent* e)
{
+ if (e->key() == Qt::Key_Escape)
hide();
- emit searchEnabled(false);
+
+ if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter)
+ {
+ if (e->state() == Qt::ShiftButton)
+ emit findPrevText();
+ else
+ emit findNextText();
+ }
}
--- kdegraphics/kviewshell/searchWidget.h #1.1:1.2
@@ -45,4 +45,5 @@ public slots:
virtual void setFocus();
virtual void show();
+ virtual void hide();
signals:
@@ -51,7 +52,9 @@ signals:
void searchEnabled(bool);
+protected:
+ virtual void keyPressEvent(QKeyEvent*);
+
private slots:
void textChanged();
- void stopClicked();
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic