diff options
-rw-r--r-- | qt-ui/divelistview.cpp | 16 | ||||
-rw-r--r-- | qt-ui/divelistview.h | 3 |
2 files changed, 10 insertions, 9 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 50d3a8bf3..014f00583 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -28,7 +28,7 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false), - sortColumn(0), currentOrder(Qt::DescendingOrder), searchBox(new QLineEdit(this)) + sortColumn(0), currentOrder(Qt::DescendingOrder), searchBox(this) { setItemDelegate(new DiveListDelegate(this)); setUniformRowHeights(true); @@ -51,10 +51,10 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec showSearchBox->setShortcutContext(Qt::WindowShortcut); addAction(showSearchBox); - searchBox->installEventFilter(this); - searchBox->hide(); + searchBox.installEventFilter(this); + searchBox.hide(); connect(showSearchBox, SIGNAL(triggered(bool)), this, SLOT(showSearchEdit())); - connect(searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString))); + connect(&searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString))); setupUi(); } @@ -275,8 +275,8 @@ void DiveListView::selectDives(const QList< int >& newDiveSelection) void DiveListView::showSearchEdit() { - searchBox->show(); - searchBox->setFocus(); + searchBox.show(); + searchBox.setFocus(); } bool DiveListView::eventFilter(QObject* , QEvent* event) @@ -287,8 +287,8 @@ bool DiveListView::eventFilter(QObject* , QEvent* event) if (keyEv->key() != Qt::Key_Escape) return false; - searchBox->clear(); - searchBox->hide(); + searchBox.clear(); + searchBox.hide(); QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model()); m->setFilterFixedString(QString()); return true; diff --git a/qt-ui/divelistview.h b/qt-ui/divelistview.h index 99b8fce23..02efac370 100644 --- a/qt-ui/divelistview.h +++ b/qt-ui/divelistview.h @@ -12,6 +12,7 @@ */ #include <QTreeView> +#include <QLineEdit> #include "models.h" class DiveListView : public QTreeView @@ -61,7 +62,7 @@ private: int sortColumn; Qt::SortOrder currentOrder; DiveTripModel::Layout currentLayout; - QLineEdit *searchBox; + QLineEdit searchBox; QModelIndex contextMenuIndex; /* if dive_trip_t is null, there's no problem. */ |