smartlistview.h 2.04 KB
Newer Older
1
/***************************************************************************
2
 * Copyright (C) 2015-2017 by Savoir-faire Linux                           *
3
 * Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com>              *
4
 * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>          *
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *                                                                         *
 * This program is free software; you can redistribute it and/or modify    *
 * it under the terms of the GNU General Public License as published by    *
 * the Free Software Foundation; either version 3 of the License, or       *
 * (at your option) any later version.                                     *
 *                                                                         *
 * This program is distributed in the hope that it will be useful,         *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
 * GNU General Public License for more details.                            *
 *                                                                         *
 * You should have received a copy of the GNU General Public License       *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 **************************************************************************/

#pragma once

#include <QTreeView>

24
class SmartListView : public QTreeView
25 26 27
{
    Q_OBJECT
public:
28 29
    explicit SmartListView(QWidget* parent = 0);
    ~SmartListView();
30 31 32 33

protected:
    void enterEvent(QEvent* event);
    void leaveEvent(QEvent* event);
34
    void mousePressEvent(QMouseEvent *event);
35
    bool eventFilter(QObject* watched, QEvent* event);
36
    void drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
37 38

private:
39 40
    QModelIndex hoveredRow_;

41
signals:
42 43 44
    void btnAcceptInviteClicked(const QModelIndex& index) const;
    void btnBlockInviteClicked(const QModelIndex& index) const;
    void btnIgnoreInviteClicked(const QModelIndex& index) const;
45
};