#include <kiconloader.h>
#include <QEvent>
+#include <QKeyEvent>
#include <QHBoxLayout>
#include <QToolButton>
hLayout->setSpacing(0);
m_searchInput = new KLineEdit(this);
- m_searchInput->setLayoutDirection(Qt::LeftToRight);
m_searchInput->setClearButtonShown(true);
m_searchInput->setMinimumWidth(150);
+ m_searchInput->setClickMessage(i18nc("@label:textbox", "Search..."));
hLayout->addWidget(m_searchInput);
connect(m_searchInput, SIGNAL(returnPressed()),
this, SLOT(emitSearchSignal()));
m_searchButton = new QToolButton(this);
m_searchButton->setAutoRaise(true);
m_searchButton->setIcon(KIcon("edit-find"));
- m_searchButton->setToolTip(i18nc("@info:tooltip", "Search"));
+ m_searchButton->setToolTip(i18nc("@info:tooltip", "Click to begin the search"));
hLayout->addWidget(m_searchButton);
connect(m_searchButton, SIGNAL(clicked()),
this, SLOT(emitSearchSignal()));
{
if (event->type() == QEvent::Polish) {
m_searchInput->setFont(KGlobalSettings::generalFont());
+ } else if (event->type() == QEvent::KeyPress) {
+ if (static_cast<QKeyEvent *>(event)->key() == Qt::Key_Escape) {
+ m_searchInput->clear();
+ }
}
return QWidget::event(event);
}