blob: 480109ccdf42a05c9870af09486ebbe4e8dcf270 [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 ConversationItemDelegate;
Nicolas Jager97a21b42015-12-03 16:55:45 -050025
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040026class SmartListView : public QTreeView
Nicolas Jager97a21b42015-12-03 16:55:45 -050027{
28 Q_OBJECT
29public:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040030 explicit SmartListView(QWidget* parent = 0);
31 ~SmartListView();
Nicolas Jager97a21b42015-12-03 16:55:45 -050032
33protected:
34 void enterEvent(QEvent* event);
35 void leaveEvent(QEvent* event);
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040036 void mousePressEvent(QMouseEvent *event);
Nicolas Jager41e4fcf2016-01-28 11:37:03 -050037 bool eventFilter(QObject* watched, QEvent* event);
Nicolas Jagere41bb582016-03-04 15:15:11 -050038 void drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
Nicolas Jager97a21b42015-12-03 16:55:45 -050039
40private:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040041 void hideButtonsWidgets();
42 QModelIndex hoveredRow_;
Nicolas Jager97a21b42015-12-03 16:55:45 -050043
Andreas Traczyk55f92cb2018-10-23 12:26:25 -040044signals:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040045 void btnAcceptInviteClicked(const QModelIndex& index) const;
46 void btnBlockInviteClicked(const QModelIndex& index) const;
47 void btnIgnoreInviteClicked(const QModelIndex& index) const;
48
Nicolas Jager97a21b42015-12-03 16:55:45 -050049};