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 _KGRAPHEDITORELEMENTTREEWIDGET_H_
0020 #define _KGRAPHEDITORELEMENTTREEWIDGET_H_
0021 
0022 #include <QTreeWidget>
0023 
0024 /**
0025  * This is the widget used to list the attributes of an element and edit them
0026  *
0027  * @short Element attributes editing widget
0028  * @author Gael de Chalendar <kleag@free.fr>
0029  */
0030 class KGraphEditorElementTreeWidget : public QTreeWidget
0031 {
0032     Q_OBJECT
0033 public:
0034     /**
0035      * Default Constructor
0036      */
0037     explicit KGraphEditorElementTreeWidget(QWidget *parent = nullptr);
0038 
0039     /**
0040      * Default Destructor
0041      */
0042     ~KGraphEditorElementTreeWidget() override;
0043 
0044 protected:
0045     void contextMenuEvent(QContextMenuEvent *e) override;
0046 
0047 protected Q_SLOTS:
0048     void slotAddAttribute();
0049     void slotRemoveAttribute();
0050 
0051 Q_SIGNALS:
0052     void addAttribute(const QString &);
0053     void removeAttribute(const QString &);
0054 
0055 private:
0056     void setupPopup(const QPoint &point);
0057 
0058     QMenu *m_popup;
0059     QTreeWidgetItem *m_item;
0060 };
0061 
0062 #endif // _KGRAPHEDITORELEMENTTREEWIDGET_H_