Shortcut for filter

This commit is contained in:
Klaus Basan
2015-12-08 20:10:49 +01:00
parent c1b612e193
commit 3d96e2e332
2 changed files with 9 additions and 2 deletions

View File

@@ -22,6 +22,7 @@
#include <QLabel>
#include <QMovie>
#include <QPainter>
#include <QShortcut>
using namespace BlackMisc;
using namespace BlackGui;
@@ -43,6 +44,11 @@ namespace BlackGui
this->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
this->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
this->setWordWrap(true);
QShortcut *filter = new QShortcut(FilterKey, this);
bool c = connect(filter, &QShortcut::activated, this, &CViewBaseNonTemplate::ps_displayFilterDialog);
Q_ASSERT(c);
Q_UNUSED(c);
}
void CViewBaseNonTemplate::resizeToContents()
@@ -152,7 +158,7 @@ namespace BlackGui
if (this->m_withMenuFilter)
{
menu.addAction(BlackMisc::CIcons::tableSheet16(), "Filter", this, SLOT(ps_displayFilterDialog()));
menu.addAction(BlackMisc::CIcons::tableSheet16(), "Filter", this, SLOT(ps_displayFilterDialog()), FilterKey);
menu.addAction(BlackMisc::CIcons::tableSheet16(), "Remove Filter", this, SLOT(ps_removeFilter()));
}
if (!menu.isEmpty()) { menu.addSeparator(); }

View File

@@ -238,6 +238,7 @@ namespace BlackGui
bool m_displayAutomatically = true; //!< display directly when loaded
QWidget *m_filterWidget = nullptr; //!< filter widget if any
const QKeySequence FilterKey {Qt::CTRL + Qt::Key_F}; //!< shortcut filter
BlackGui::IMenuDelegate *m_menu = nullptr; //!< custom menu if any
BlackGui::CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if neeeded
@@ -374,7 +375,7 @@ namespace BlackGui
//! \copydoc CViewBaseNonTemplate::ps_filterWidgetChangedFilter(bool)
//! \remarks Actually a slot, but not defined as such as the template does not support Q_OBJECT
virtual bool ps_filterWidgetChangedFilter(bool enabled) override;
virtual bool ps_filterWidgetChangedFilter(bool enabled) override;
//! \copydoc CViewBaseNonTemplate::ps_removeFilter
//! \remarks Actually a slot, but not defined as such as the template does not support Q_OBJECT