Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 1 | /*************************************************************************** |
Anthony Léonard | 2fde81d | 2017-04-17 10:06:55 -0400 | [diff] [blame] | 2 | * Copyright (C) 2015-2017 by Savoir-faire Linux * |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 3 | * Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> * |
Andreas Traczyk | b8b13ba | 2018-08-21 16:30:16 -0400 | [diff] [blame] | 4 | * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> * |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 5 | * * |
| 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 Traczyk | b8b13ba | 2018-08-21 16:30:16 -0400 | [diff] [blame] | 24 | class ConversationItemDelegate; |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 25 | |
Andreas Traczyk | b8b13ba | 2018-08-21 16:30:16 -0400 | [diff] [blame] | 26 | class SmartListView : public QTreeView |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 27 | { |
| 28 | Q_OBJECT |
| 29 | public: |
Andreas Traczyk | b8b13ba | 2018-08-21 16:30:16 -0400 | [diff] [blame] | 30 | explicit SmartListView(QWidget* parent = 0); |
| 31 | ~SmartListView(); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 32 | |
| 33 | protected: |
| 34 | void enterEvent(QEvent* event); |
| 35 | void leaveEvent(QEvent* event); |
Andreas Traczyk | b8b13ba | 2018-08-21 16:30:16 -0400 | [diff] [blame] | 36 | void mousePressEvent(QMouseEvent *event); |
Nicolas Jager | 41e4fcf | 2016-01-28 11:37:03 -0500 | [diff] [blame] | 37 | bool eventFilter(QObject* watched, QEvent* event); |
Nicolas Jager | e41bb58 | 2016-03-04 15:15:11 -0500 | [diff] [blame] | 38 | void drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 39 | |
| 40 | private: |
Andreas Traczyk | b8b13ba | 2018-08-21 16:30:16 -0400 | [diff] [blame] | 41 | void hideButtonsWidgets(); |
| 42 | QModelIndex hoveredRow_; |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 43 | |
Andreas Traczyk | 55f92cb | 2018-10-23 12:26:25 -0400 | [diff] [blame^] | 44 | signals: |
Andreas Traczyk | b8b13ba | 2018-08-21 16:30:16 -0400 | [diff] [blame] | 45 | void btnAcceptInviteClicked(const QModelIndex& index) const; |
| 46 | void btnBlockInviteClicked(const QModelIndex& index) const; |
| 47 | void btnIgnoreInviteClicked(const QModelIndex& index) const; |
| 48 | |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 49 | }; |