mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
DiveListView tiny cleanup
* Change 'searchBox' member type from 'QLineEdit *' to 'QLineEdit' Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2d3e48f4ae
commit
bbac1438cf
2 changed files with 10 additions and 9 deletions
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false),
|
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));
|
setItemDelegate(new DiveListDelegate(this));
|
||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
|
@ -51,10 +51,10 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec
|
||||||
showSearchBox->setShortcutContext(Qt::WindowShortcut);
|
showSearchBox->setShortcutContext(Qt::WindowShortcut);
|
||||||
addAction(showSearchBox);
|
addAction(showSearchBox);
|
||||||
|
|
||||||
searchBox->installEventFilter(this);
|
searchBox.installEventFilter(this);
|
||||||
searchBox->hide();
|
searchBox.hide();
|
||||||
connect(showSearchBox, SIGNAL(triggered(bool)), this, SLOT(showSearchEdit()));
|
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();
|
setupUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ void DiveListView::selectDives(const QList< int >& newDiveSelection)
|
||||||
|
|
||||||
void DiveListView::showSearchEdit()
|
void DiveListView::showSearchEdit()
|
||||||
{
|
{
|
||||||
searchBox->show();
|
searchBox.show();
|
||||||
searchBox->setFocus();
|
searchBox.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiveListView::eventFilter(QObject* , QEvent* event)
|
bool DiveListView::eventFilter(QObject* , QEvent* event)
|
||||||
|
@ -287,8 +287,8 @@ bool DiveListView::eventFilter(QObject* , QEvent* event)
|
||||||
if (keyEv->key() != Qt::Key_Escape)
|
if (keyEv->key() != Qt::Key_Escape)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
searchBox->clear();
|
searchBox.clear();
|
||||||
searchBox->hide();
|
searchBox.hide();
|
||||||
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
|
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
|
||||||
m->setFilterFixedString(QString());
|
m->setFilterFixedString(QString());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
#include <QLineEdit>
|
||||||
#include "models.h"
|
#include "models.h"
|
||||||
|
|
||||||
class DiveListView : public QTreeView
|
class DiveListView : public QTreeView
|
||||||
|
@ -61,7 +62,7 @@ private:
|
||||||
int sortColumn;
|
int sortColumn;
|
||||||
Qt::SortOrder currentOrder;
|
Qt::SortOrder currentOrder;
|
||||||
DiveTripModel::Layout currentLayout;
|
DiveTripModel::Layout currentLayout;
|
||||||
QLineEdit *searchBox;
|
QLineEdit searchBox;
|
||||||
QModelIndex contextMenuIndex;
|
QModelIndex contextMenuIndex;
|
||||||
|
|
||||||
/* if dive_trip_t is null, there's no problem. */
|
/* if dive_trip_t is null, there's no problem. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue