63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
/***************************************************************************
|
|
|
|
source::worx xtree
|
|
Copyright © 2024-2025 c.holzheuer
|
|
christoph.holzheuer@gmail.com
|
|
|
|
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 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
#ifndef XQTREEVIEW_H
|
|
#define XQTREEVIEW_H
|
|
|
|
#include <QTreeView>
|
|
#include <QMouseEvent>
|
|
#include <QDebug>
|
|
|
|
class XQItem;
|
|
class XQModel;
|
|
|
|
/**
|
|
* @brief A specialized QTreeView that will handle the drawing of
|
|
* empty or non-existing items in the future.
|
|
*/
|
|
|
|
class XQTreeView : public QTreeView
|
|
{
|
|
Q_OBJECT
|
|
Q_DECLARE_PRIVATE(QTreeView)
|
|
|
|
public:
|
|
|
|
XQTreeView(QWidget* parent = nullptr );
|
|
virtual ~XQTreeView();
|
|
|
|
XQModel* modelView();
|
|
XQItem& xqItemFromIndex(const QModelIndex& index );
|
|
|
|
protected:
|
|
|
|
void currentChanged(const QModelIndex& current, const QModelIndex& previous) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent* event) override;
|
|
//! Mouse press event.used to emulate the behavior of a QHeaderView in the first line of the view
|
|
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
|
//! Mouse release event.used to emulate the behavior of a QHeaderView in the first line of the view
|
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
|
//! Mouse press event.used to emulate the behavior of a QHeaderView in the first line of the view
|
|
void mousePressEvent(QMouseEvent* event) override;
|
|
void mouseResizeHeaderEntry(int xpos);
|
|
//! Mouse wheel event.
|
|
void wheelEvent(QWheelEvent* event) override;
|
|
|
|
//! used by the mouse events
|
|
QModelIndex _indexToResize;
|
|
};
|
|
|
|
#endif // XQTREEVIEW_H
|