blob: ac1360047c0a5db1af6c21cb3073d66cc0f8aa8e [file] [log] [blame]
Nicolas Jager97a21b42015-12-03 16:55:45 -05001/***************************************************************************
Anthony Léonard2fde81d2017-04-17 10:06:55 -04002 * Copyright (C) 2015-2017 by Savoir-faire Linux *
Nicolas Jager97a21b42015-12-03 16:55:45 -05003 * Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
Andreas Traczykb8b13ba2018-08-21 16:30:16 -04004 * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> *
Nicolas Jager97a21b42015-12-03 16:55:45 -05005 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 **************************************************************************/
19
20#pragma once
21
22#include <QTreeView>
23
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040024class SmartListView : public QTreeView
Nicolas Jager97a21b42015-12-03 16:55:45 -050025{
26 Q_OBJECT
27public:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040028 explicit SmartListView(QWidget* parent = 0);
29 ~SmartListView();
Nicolas Jager97a21b42015-12-03 16:55:45 -050030
31protected:
32 void enterEvent(QEvent* event);
33 void leaveEvent(QEvent* event);
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040034 void mousePressEvent(QMouseEvent *event);
Nicolas Jager41e4fcf2016-01-28 11:37:03 -050035 bool eventFilter(QObject* watched, QEvent* event);
Nicolas Jagere41bb582016-03-04 15:15:11 -050036 void drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
Nicolas Jager97a21b42015-12-03 16:55:45 -050037
38private:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040039 QModelIndex hoveredRow_;
Nicolas Jager97a21b42015-12-03 16:55:45 -050040
Andreas Traczyk55f92cb2018-10-23 12:26:25 -040041signals:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040042 void btnAcceptInviteClicked(const QModelIndex& index) const;
43 void btnBlockInviteClicked(const QModelIndex& index) const;
44 void btnIgnoreInviteClicked(const QModelIndex& index) const;
Nicolas Jager97a21b42015-12-03 16:55:45 -050045};