Clear filter upon double clicking on filtered torrent list notice

This commit is contained in:
Mike Gelfand 2015-10-24 20:56:45 +00:00
parent 8392476b30
commit 000895322f
5 changed files with 25 additions and 1 deletions

View File

@ -276,6 +276,18 @@ FilterBar::~FilterBar ()
****
***/
void
FilterBar::clear ()
{
myActivityCombo->setCurrentIndex (0);
myTrackerCombo->setCurrentIndex (0);
myLineEdit->clear ();
}
/***
****
***/
void
FilterBar::refreshPref (int key)
{

View File

@ -30,6 +30,9 @@ class FilterBar: public QWidget
FilterBar (Prefs& prefs, const TorrentModel& torrents, const TorrentFilter& filter, QWidget * parent = nullptr);
virtual ~FilterBar ();
public slots:
void clear ();
private:
FilterBarComboBox * createTrackerCombo (QStandardItemModel *);
FilterBarComboBox * createActivityCombo ();

View File

@ -258,6 +258,7 @@ MainWindow::MainWindow (Session& session, Prefs& prefs, TorrentModel& model, boo
connect (&myModel, SIGNAL (rowsRemoved (QModelIndex, int, int)), SLOT (refreshTorrentViewHeader ()));
connect (&myFilterModel, SIGNAL (rowsInserted (QModelIndex, int, int)), SLOT (refreshTorrentViewHeader ()));
connect (&myFilterModel, SIGNAL (rowsRemoved (QModelIndex, int, int)), SLOT (refreshTorrentViewHeader ()));
connect (ui.listView, SIGNAL (headerDoubleClicked ()), myFilterBar, SLOT (clear ()));
QList<int> initKeys;
initKeys << Prefs::MAIN_WINDOW_X

View File

@ -16,7 +16,7 @@
class TorrentView::HeaderWidget: public QWidget
{
public:
HeaderWidget (QWidget * parent):
HeaderWidget (TorrentView * parent):
QWidget (parent),
myText ()
{
@ -56,6 +56,11 @@ class TorrentView::HeaderWidget: public QWidget
painter.drawItemText (option.rect, Qt::AlignCenter, option.palette, true, myText, QPalette::ButtonText);
}
virtual void mouseDoubleClickEvent (QMouseEvent * /*event*/)
{
emit static_cast<TorrentView *> (parent ())->headerDoubleClicked ();
}
private:
QString myText;
};

View File

@ -22,6 +22,9 @@ class TorrentView: public QListView
public slots:
void setHeaderText (const QString& text);
signals:
void headerDoubleClicked ();
protected:
virtual void resizeEvent (QResizeEvent * event);