File indexing completed on 2024-05-05 16:27:22

0001 /* This file is part of KGraphViewer.
0002    Copyright (C) 2007 Gael de Chalendar <kleag@free.fr>
0003 
0004    KGraphViewer is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, version 2.
0007 
0008    This program is distributed in the hope that it will be useful,
0009    but WITHOUT ANY WARRANTY; without even the implied warranty of
0010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0011    General Public License for more details.
0012 
0013    You should have received a copy of the GNU General Public License
0014    along with this program; if not, write to the Free Software
0015    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0016    02110-1301, USA
0017 */
0018 
0019 #ifndef _KGRAPHEDITORNODESTREEWIDGET_H_
0020 #define _KGRAPHEDITORNODESTREEWIDGET_H_
0021 
0022 #include <QTreeWidget>
0023 
0024 /**
0025  * This is the widget used to list the nodes and and edit their attributes
0026  *
0027  * @short Nodes attributes editing widget
0028  * @author Gael de Chalendar <kleag@free.fr>
0029  */
0030 class KGraphEditorNodesTreeWidget : public QTreeWidget
0031 {
0032     Q_OBJECT
0033 public:
0034     /**
0035      * Default Constructor
0036      */
0037     explicit KGraphEditorNodesTreeWidget(QWidget *parent = nullptr);
0038 
0039     /**
0040      * Default Destructor
0041      */
0042     ~KGraphEditorNodesTreeWidget() override;
0043 
0044 protected:
0045     void contextMenuEvent(QContextMenuEvent *e) override;
0046 
0047 protected Q_SLOTS:
0048     void slotRemoveNode();
0049     void slotAddAttribute();
0050     void slotRemoveAttribute();
0051 
0052 public Q_SLOTS:
0053     void slotRemoveElement(const QString &id);
0054 
0055 Q_SIGNALS:
0056     void removeNode(const QString &);
0057     void addAttribute(const QString &);
0058     void removeAttribute(const QString &, const QString &);
0059 
0060 private:
0061     void setupPopup(const QPoint &point);
0062 
0063     QMenu *m_popup;
0064     QTreeWidgetItem *m_item;
0065 };
0066 
0067 #endif // _KGRAPHEDITORNODESTREEWIDGET_H_