#ifndef QMTREEVIEW_H
#define QMTREEVIEW_H

#include <QTreeView>

class QMTreeView : public QTreeView
{

    Q_OBJECT

public:
    QMTreeView(QWidget *parent = Q_NULLPTR);
    void moveTo(int r, int c);


    void insertChild();
    void addRow();
    void insertRow();
    void removeRow();
private:
    void resizeEvent(QResizeEvent *event) override;
protected:
    //void drawTree(QPainter *painter, const QRegion &region) const override;
    void drawRow(QPainter *painter, const QStyleOptionViewItem &options,
                         const QModelIndex &index) const override;
    void drawBranches(QPainter *painter, const QRect &rect,
                              const QModelIndex &index) const override;

    void keyPressEvent(QKeyEvent *e) override;
    int nextVisibleIndex(int c);
    bool addNewRecord(const QModelIndex &index);

    void dragEnterEvent(QDragEnterEvent *event) override;
    void dragMoveEvent(QDragMoveEvent *event) override;
    void dropEvent(QDropEvent *event) override;

private slots:
    void onCornerButtonRelease();
};

#endif // QMTREEVIEW_H
