2014-02-22 17:24:20 +00:00
|
|
|
/*
|
2020-06-15 17:42:37 +02:00
|
|
|
Copyright 2006-2020 The QElectroTech Team
|
2014-02-22 17:24:20 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech 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.
|
|
|
|
|
|
|
|
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2014-02-18 20:44:54 +00:00
|
|
|
#ifndef MASTERPROPERTIESWIDGET_H
|
|
|
|
#define MASTERPROPERTIESWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2014-09-20 18:26:13 +00:00
|
|
|
#include <QHash>
|
2015-05-25 10:22:00 +00:00
|
|
|
#include "abstractelementpropertieseditorwidget.h"
|
2014-07-21 20:44:32 +00:00
|
|
|
|
2014-09-20 18:26:13 +00:00
|
|
|
class Element;
|
2014-12-11 20:10:28 +00:00
|
|
|
class QUndoCommand;
|
2015-05-19 21:41:05 +00:00
|
|
|
class QETProject;
|
|
|
|
class Diagram;
|
2017-01-22 13:48:58 +00:00
|
|
|
class QTreeWidgetItem;
|
|
|
|
class QMenu;
|
|
|
|
class QAction;
|
2014-02-18 20:44:54 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class MasterPropertiesWidget;
|
|
|
|
}
|
|
|
|
|
2014-02-26 23:57:22 +00:00
|
|
|
/**
|
2020-07-19 13:58:08 +02:00
|
|
|
@brief The MasterPropertiesWidget class
|
|
|
|
This class is a widget for make link between a master element
|
|
|
|
with several slave element.
|
|
|
|
This class embenddedthe undo/redo command when apply new connection.
|
|
|
|
*/
|
2015-05-25 10:22:00 +00:00
|
|
|
class MasterPropertiesWidget : public AbstractElementPropertiesEditorWidget
|
2014-02-18 20:44:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-08-05 02:06:59 +00:00
|
|
|
explicit MasterPropertiesWidget(Element *elmt, QWidget *parent = nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
~MasterPropertiesWidget() override;
|
2014-02-18 20:44:54 +00:00
|
|
|
|
2017-08-05 02:10:01 +00:00
|
|
|
void setElement (Element *element) override;
|
|
|
|
void apply() override;
|
|
|
|
void reset() override;
|
|
|
|
QUndoCommand *associatedUndo () const override;
|
2020-07-19 13:58:08 +02:00
|
|
|
/**
|
|
|
|
* @brief title
|
|
|
|
* @return QString title
|
|
|
|
*/
|
|
|
|
QString title() const override {
|
|
|
|
return tr("Référence croisée (maître)");}
|
2017-08-05 02:10:01 +00:00
|
|
|
bool setLiveEdit(bool live_edit) override;
|
2015-05-29 07:28:58 +00:00
|
|
|
|
|
|
|
public slots:
|
2017-08-05 02:10:01 +00:00
|
|
|
void updateUi() override;
|
2014-02-26 23:57:22 +00:00
|
|
|
|
2014-02-22 17:24:20 +00:00
|
|
|
private slots:
|
2017-01-30 14:29:01 +00:00
|
|
|
void headerCustomContextMenuRequested(const QPoint &pos);
|
2015-05-07 22:15:00 +00:00
|
|
|
void on_link_button_clicked();
|
|
|
|
void on_unlink_button_clicked();
|
2017-01-22 13:48:58 +00:00
|
|
|
void showElementFromTWI(QTreeWidgetItem *qtwi, int column);
|
2015-05-07 22:15:00 +00:00
|
|
|
void showedElementWasDeleted ();
|
2015-05-19 21:41:05 +00:00
|
|
|
void diagramWasdeletedFromProject();
|
2017-01-22 13:48:58 +00:00
|
|
|
void customContextMenu(const QPoint &pos, int i=0);
|
2014-02-22 17:24:20 +00:00
|
|
|
|
2014-02-18 20:44:54 +00:00
|
|
|
private:
|
|
|
|
Ui::MasterPropertiesWidget *ui;
|
2017-01-22 13:48:58 +00:00
|
|
|
QHash <QTreeWidgetItem *, Element *> m_qtwi_hash;
|
|
|
|
QTreeWidgetItem *m_qtwi_at_context_menu = nullptr;
|
2017-08-06 11:35:01 +00:00
|
|
|
QPointer <Element> m_showed_element;
|
2015-05-19 21:41:05 +00:00
|
|
|
QETProject *m_project;
|
2017-01-22 13:48:58 +00:00
|
|
|
QMenu *m_context_menu;
|
|
|
|
QAction *m_link_action,
|
|
|
|
*m_unlink_action,
|
|
|
|
*m_show_qtwi,
|
2017-01-30 14:29:01 +00:00
|
|
|
*m_show_element,
|
|
|
|
*m_save_header_state;
|
2014-02-18 20:44:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MASTERPROPERTIESWIDGET_H
|