QtHPConnect/include/hptreeitem.h

87 lines
2.3 KiB
C
Raw Normal View History

2020-02-02 18:13:27 +01:00
/*
* This file is part of the QtHPConnect distribution (https://github.com/Indy970/QtHPConnect.git).
* Copyright (c) 2020 Ian Gebbie.
*
* 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, version 3 or later.
*
* 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/>.
*/
2019-02-10 14:32:15 +01:00
#ifndef HPTREEITEM_H
#define HPTREEITEM_H
2019-02-10 14:43:00 +01:00
#include <QStandardItem>
2019-02-11 21:54:51 +01:00
#include <QMenu>
#include <QAction>
2019-02-10 14:43:00 +01:00
#include <QString>
#include "hpdata.h"
#include "mainwindow.h"
2019-02-10 14:32:15 +01:00
2019-02-10 14:43:00 +01:00
class hp_mdiVariableEdit;
class hp_mdiTextEdit;
2019-02-25 08:36:58 +01:00
//enum hp_DataType;
2019-02-10 14:43:00 +01:00
2019-02-11 21:54:51 +01:00
enum contextActionType {
CT_PREFERENCE
};
2019-02-10 14:43:00 +01:00
class hpTreeItem: public QObject, public QStandardItem
2019-02-10 14:32:15 +01:00
{
2019-02-10 14:43:00 +01:00
Q_OBJECT
2019-02-10 14:32:15 +01:00
public:
2019-02-10 14:43:00 +01:00
hpTreeItem();
hpTreeItem(const QString &,hpCalcData *, int);
virtual QStandardItem *clone() const;
void setGraphicTree();
2019-02-25 08:36:58 +01:00
void setType(hp_DataType);
2019-02-10 14:43:00 +01:00
void clickAction(QMdiArea * mwin);
2019-02-11 21:54:51 +01:00
void contextAction(QMdiArea * mdiwin, contextActionType cta );
2019-02-10 14:43:00 +01:00
void setDataStore(hpCalcData *);
hpCalcData * getDataStore();
2020-01-18 19:27:42 +01:00
QString getCalculatorName();
2019-02-25 19:28:45 +01:00
QString getGroupName();
QString getFileName();
2020-01-16 04:38:13 +01:00
bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
2019-03-09 21:11:43 +01:00
void setFileName(QString);
2019-02-25 08:36:58 +01:00
hp_DataType getType();
void refresh();
2019-02-25 19:28:45 +01:00
int findFile(QString);
void addFile(AbstractData *);
2019-02-25 08:36:58 +01:00
void addChild(AbstractData * obj);
2019-09-15 17:23:44 +02:00
virtual ~hpTreeItem();
2019-04-02 21:14:31 +02:00
2019-02-10 14:43:00 +01:00
public slots:
void dataChange(hp_Change hpchange);
private:
const static QString func_list[][2];
2019-02-25 08:36:58 +01:00
const static hp_DataType func_type[];
2020-01-29 08:49:27 +01:00
// QString filename;
2019-02-25 08:36:58 +01:00
hp_DataType type;
2019-02-10 14:43:00 +01:00
hpCalcData * hp_data=nullptr;
QMdiArea * mdiarea=nullptr;
hp_mdiVariableEdit * hpvaredit = nullptr;
hp_mdiTextEdit * hptextedit = nullptr;
int dt2int();
2019-02-17 17:24:52 +01:00
signals:
void dataChanged(hp_Change datachange);
2019-02-10 14:32:15 +01:00
};
2019-02-10 14:43:00 +01:00
Q_DECLARE_METATYPE(hpTreeItem *)
#endif // HPTREEITEM_H