Ctrl+F now opens the Tag Filter

And old code for the old searchbar removed.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-10-31 14:17:01 -02:00 committed by Dirk Hohndel
parent 1876bec08b
commit 063e6d9fbf
4 changed files with 4 additions and 33 deletions

View file

@ -32,7 +32,7 @@
static int defaultWidth[] = { 70, 140, 90, 50, 50, 50, 50, 70, 50, 50, 70, 50, 50, 500};
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false), sortColumn(0),
currentOrder(Qt::DescendingOrder), searchBox(this), dontEmitDiveChangedSignal(false), selectionSaved(false)
currentOrder(Qt::DescendingOrder), dontEmitDiveChangedSignal(false), selectionSaved(false)
{
setItemDelegate(new DiveListDelegate(this));
setUniformRowHeights(true);
@ -100,15 +100,6 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec
header()->setStretchLastSection(true);
QAction *showSearchBox = new QAction(tr("Show search box"), this);
showSearchBox->setShortcut(Qt::CTRL + Qt::Key_F);
showSearchBox->setShortcutContext(Qt::WindowShortcut);
addAction(showSearchBox);
searchBox.installEventFilter(this);
searchBox.hide();
// connect(showSearchBox, SIGNAL(triggered(bool)), this, SLOT(showSearchEdit()));
// connect(&searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString)));
}
DiveListView::~DiveListView()
@ -322,12 +313,6 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection)
return;
}
void DiveListView::showSearchEdit()
{
searchBox.show();
searchBox.setFocus();
}
bool DiveListView::eventFilter(QObject *, QEvent *event)
{
if (event->type() != QEvent::KeyPress)
@ -335,11 +320,6 @@ bool DiveListView::eventFilter(QObject *, QEvent *event)
QKeyEvent *keyEv = static_cast<QKeyEvent *>(event);
if (keyEv->key() != Qt::Key_Escape)
return false;
searchBox.clear();
searchBox.hide();
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel *>(model());
m->setFilterFixedString(QString());
return true;
}
@ -882,9 +862,3 @@ void DiveListView::updateLastImageTimeOffset(const int offset)
s.beginGroup("MainWindow");
s.setValue("LastImageTimeOffset", offset);
}
void DiveListView::endSearch()
{
searchBox.clear();
searchBox.hide();
}

View file

@ -36,7 +36,6 @@ slots:
void toggleColumnVisibilityByIndex();
void reloadHeaderActions();
void headerClicked(int);
void showSearchEdit();
void removeFromTrip();
void deleteDive();
void markDiveInvalid();
@ -52,7 +51,6 @@ slots:
void shiftTimes();
void loadImages();
static QString lastUsedImageDir();
void endSearch();
signals:
void currentDiveChanged(int divenr);
@ -63,7 +61,6 @@ private:
int sortColumn;
Qt::SortOrder currentOrder;
DiveTripModel::Layout currentLayout;
QLineEdit searchBox;
QModelIndex contextMenuIndex;
bool dontEmitDiveChangedSignal;
bool selectionSaved;

View file

@ -457,7 +457,6 @@ void MainWindow::on_actionReplanDive_triggered()
qDebug() << "trying to replan a dive that's not a planned dive:" << current_dive->dc.model;
return;
}
ui.ListWidget->endSearch();
// put us in PLAN mode
DivePlannerPointsModel::instance()->clear();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
@ -479,7 +478,6 @@ void MainWindow::on_actionDivePlanner_triggered()
if (!plannerStateClean())
return;
ui.ListWidget->endSearch();
// put us in PLAN mode
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
@ -509,7 +507,6 @@ void MainWindow::on_actionAddDive_triggered()
dive_list()->clearSelection();
}
ui.ListWidget->endSearch();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
// setup things so we can later create our starting dive

View file

@ -835,6 +835,9 @@ p, li { white-space: pre-wrap; }
<property name="text">
<string>&amp;Filter by Tags</string>
</property>
<property name="shortcut">
<string>Ctrl+F</string>
</property>
</action>
<action name="profTissues">
<property name="checkable">