QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
QETElementEditor Class Reference

#include <qetelementeditor.h>

Inherits QMainWindow.

Collaboration diagram for QETElementEditor:
Collaboration graph

Signals

void saveToLocation (ElementsLocation loc)

Public Member Functions

 QETElementEditor (QWidget *parent=nullptr)
 QETElementEditor::QETElementEditor.
 ~QETElementEditor () override
 QETElementEditor::~QETElementEditor.
void contextMenu (QPoint p, QList< QAction * > actions=QList< QAction * >())
 QETElementEditor::contextMenu Display a context menu, with all available action.
void setNames (const NamesList &name_list)
 QETElementEditor::setNames Set the names list of the edited element.
void setLocation (const ElementsLocation &location)
 QETElementEditor::setLocation Set the location to edit.
ElementsLocation location () const
 QETElementEditor::location.
void setFileName (const QString &file_name)
 QETElementEditor::setFileName Set the file name of the edited element.
QString fileName () const
 QETElementEditor::fileName.
void setReadOnly (bool ro)
bool isReadOnly () const
void fromFile (const QString &filepath)
 QETElementEditor::fromFile Open an element from @filepath.
bool toFile (const QString &filepath)
 QETElementEditor::toFile Save to a file the current edited element.
void fromLocation (const ElementsLocation &location)
 QETElementEditor::fromLocation Location of an element to edit.
bool toLocation (const ElementsLocation &location)
 QETElementEditor::toLocation Save the edited element into @location.
bool isEditing (const ElementsLocation &location)
 QETElementEditor::isEditing.
bool isEditing (const QString &filepath)
 QETElementEditor::isEditing.
ElementSceneelementScene () const
 QETElementEditor::elementScene.
ElementViewelementView () const
 QETElementEditor::elementView.
void updateTitle ()
 QETElementEditor::updateTitle Update the title of the windows.
void fillPartsList ()
 QETElementEditor::fillPartsList.
void UncheckAddPrimitive ()
 QETElementEditor::UncheckAddPrimitive.
void updateCurrentPartEditor ()
 QETElementEditor::updateCurrentPartEditor.
void updateInformations ()
 QETElementEditor::updateInformations Update the information and editor dock.
void updatePartsList ()
 QETElementEditor::updatePartsList.
void updateSelectionFromPartsList ()
 QETElementEditor::updateSelectionFromPartsList.
void openElement (const QString &filepath)
 QETElementEditor::openElement OPen an element from @filepath.
bool checkElement ()
 QETElementEditor::checkElement Do several check about element.

Static Public Member Functions

static QPointF pasteOffset ()
 QETElementEditor::pasteOffset.
static QString getOpenElementFileName (QWidget *parent=nullptr, const QString &dir=QString())
 QETElementEditor::getOpenElementFileName Ask user to open a file who must be an element.

Protected Member Functions

bool event (QEvent *event) override
 QETElementEditor::event.
void closeEvent (QCloseEvent *) override
 QETElementEditor::closeEvent.

Private Slots

bool on_m_save_action_triggered ()
 QETElementEditor::on_m_save_action_triggered.
bool on_m_save_as_action_triggered ()
 QETElementEditor::on_m_save_as_action_triggered Ask a location to user and save the current edited element to this location.
void on_m_select_all_act_triggered ()
void on_m_edit_element_properties_action_triggered ()
void on_m_new_action_triggered ()
void on_m_open_action_triggered ()
void on_m_open_from_file_action_triggered ()
bool on_m_save_as_file_action_triggered ()
bool on_m_export_svg_action_triggered ()
 QETElementEditor::on_m_export_svg_action_triggered Export the element currently open in this editor to a standalone SVG file.
void on_m_reload_action_triggered ()
void on_m_quit_action_triggered ()
void on_m_deselect_all_action_triggered ()
void on_m_cut_action_triggered ()
void on_m_copy_action_triggered ()
void on_m_paste_action_triggered ()
void on_m_paste_in_area_action_triggered ()
void on_m_paste_from_file_action_triggered ()
void on_m_paste_from_element_action_triggered ()
void on_m_revert_selection_action_triggered ()
void on_m_delete_action_triggered ()
void on_m_edit_names_action_triggered ()
void on_m_edit_author_action_triggered ()
void on_m_zoom_in_action_triggered ()
void on_m_zoom_out_action_triggered ()
void on_m_zoom_fit_best_action_triggered ()
void on_m_zoom_original_action_triggered ()
void on_m_about_qet_action_triggered ()
void on_m_online_manual_triggered ()
void on_m_youtube_action_triggered ()
void on_m_donate_action_triggered ()
void on_m_about_qt_action_triggered ()
void on_m_import_dxf_triggered ()
void on_m_import_scaled_element_triggered ()

Private Member Functions

bool canClose ()
 QETElementEditor::canClose.
void readSettings ()
 QETElementEditor::readSettings Read some setting about this widget in the QSetting of qelectrotech.
void readSettingsState ()
 QETElementEditor::readSettingsState Restore the window state (docks, toolbars). Must be called AFTER show() in Qt6 for restoreState() to work correctly.
void writeSettings () const
 QETElementEditor::writeSettings Write some setting of this widget in the QSetting of qelectrotech.
void setupActions ()
 QETElementEditor::setupActions.
void updateAction ()
 QETElementEditor::updateAction Update actions.
void setupConnection ()
 QETElementEditor::setupConnection.
void initGui ()
 QETElementEditor::initGui.
QWidget * clearToolsDock ()
 QETElementEditor::clearToolsDock Remove and hide the widget displayed by the dock used to edit primitives.
void copyAndPasteXml (const QDomDocument &xml_document)
 QETElementEditor::copyAndPasteXml Copy the content of @xml_document to the clipboard and call pasteInArea method of elementView.

Private Attributes

Ui::QETElementEditor * ui
bool m_read_only = false
bool m_opened_from_file = false
bool m_first_activation = true
ElementScenem_elmt_scene = nullptr
QActionGroup * m_add_part_action_grp = nullptr
QActionGroup * m_depth_action_group = nullptr
QList< QAction * > m_context_menu_action_list
QAction * m_undo_action = nullptr
QAction * m_redo_action = nullptr
QHash< QString, ElementItemEditor * > m_editors
 Hash associating primitive names with their matching edition widget.
ElementsLocation m_location
QString m_file_name
QString m_min_title
ElementViewm_view = nullptr
QListWidget * m_parts_list = nullptr
QStackedWidget * m_tools_dock_stack = nullptr
QLabel * m_default_informations = nullptr
QLabel * m_position_label = nullptr

Constructor & Destructor Documentation

◆ QETElementEditor()

QETElementEditor::QETElementEditor ( QWidget * parent = nullptr)
explicit

QETElementEditor::QETElementEditor.

Parameters
parent
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~QETElementEditor()

QETElementEditor::~QETElementEditor ( )
override

Member Function Documentation

◆ canClose()

bool QETElementEditor::canClose ( )
private

QETElementEditor::canClose.

Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkElement()

bool QETElementEditor::checkElement ( )

QETElementEditor::checkElement Do several check about element.

Returns
true if there is no error
Here is the caller graph for this function:

◆ clearToolsDock()

QWidget * QETElementEditor::clearToolsDock ( )
private

QETElementEditor::clearToolsDock Remove and hide the widget displayed by the dock used to edit primitives.

Returns
Return the removed widget or nullptr if there is no widget to remove.
Here is the caller graph for this function:

◆ closeEvent()

void QETElementEditor::closeEvent ( QCloseEvent * qce)
overrideprotected

QETElementEditor::closeEvent.

Parameters
qce
Here is the call graph for this function:

◆ contextMenu()

void QETElementEditor::contextMenu ( QPoint p,
QList< QAction * > actions = QList<QAction *>() )

QETElementEditor::contextMenu Display a context menu, with all available action.

Parameters
p: the pos of the menu, in screen coordinate
actions: a list of actions who can be prepended to the context menu.
Here is the caller graph for this function:

◆ copyAndPasteXml()

void QETElementEditor::copyAndPasteXml ( const QDomDocument & xml_document)
private

QETElementEditor::copyAndPasteXml Copy the content of @xml_document to the clipboard and call pasteInArea method of elementView.

Parameters
xml_document
Here is the caller graph for this function:

◆ elementScene()

ElementScene * QETElementEditor::elementScene ( ) const

QETElementEditor::elementScene.

Returns
Here is the caller graph for this function:

◆ elementView()

ElementView * QETElementEditor::elementView ( ) const

◆ event()

bool QETElementEditor::event ( QEvent * event)
overrideprotected

QETElementEditor::event.

Parameters
event
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fileName()

QString QETElementEditor::fileName ( ) const

QETElementEditor::fileName.

Returns
the file name of this element

◆ fillPartsList()

void QETElementEditor::fillPartsList ( )

QETElementEditor::fillPartsList.

Here is the caller graph for this function:

◆ fromFile()

void QETElementEditor::fromFile ( const QString & filepath)

QETElementEditor::fromFile Open an element from @filepath.

Parameters
filepath
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromLocation()

void QETElementEditor::fromLocation ( const ElementsLocation & location)

QETElementEditor::fromLocation Location of an element to edit.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOpenElementFileName()

QString QETElementEditor::getOpenElementFileName ( QWidget * parent = nullptr,
const QString & dir = QString() )
static

QETElementEditor::getOpenElementFileName Ask user to open a file who must be an element.

Parameters
parent
dir
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initGui()

void QETElementEditor::initGui ( )
private

QETElementEditor::initGui.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEditing() [1/2]

bool QETElementEditor::isEditing ( const ElementsLocation & location)

QETElementEditor::isEditing.

Parameters
location
Returns
true if this editor is currently editing element of location
Here is the call graph for this function:

◆ isEditing() [2/2]

bool QETElementEditor::isEditing ( const QString & filepath)

QETElementEditor::isEditing.

Parameters
filepath
Returns
true if this editor is currently editing element at filepath.
Here is the call graph for this function:

◆ isReadOnly()

bool QETElementEditor::isReadOnly ( ) const
Here is the caller graph for this function:

◆ location()

ElementsLocation QETElementEditor::location ( ) const

QETElementEditor::location.

Returns
The location of the edited element
Here is the caller graph for this function:

◆ on_m_about_qet_action_triggered

void QETElementEditor::on_m_about_qet_action_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_about_qt_action_triggered

void QETElementEditor::on_m_about_qt_action_triggered ( )
privateslot

◆ on_m_copy_action_triggered

void QETElementEditor::on_m_copy_action_triggered ( )
privateslot

◆ on_m_cut_action_triggered

void QETElementEditor::on_m_cut_action_triggered ( )
privateslot

◆ on_m_delete_action_triggered

void QETElementEditor::on_m_delete_action_triggered ( )
privateslot

◆ on_m_deselect_all_action_triggered

void QETElementEditor::on_m_deselect_all_action_triggered ( )
privateslot

◆ on_m_donate_action_triggered

void QETElementEditor::on_m_donate_action_triggered ( )
privateslot

◆ on_m_edit_author_action_triggered

void QETElementEditor::on_m_edit_author_action_triggered ( )
privateslot

◆ on_m_edit_element_properties_action_triggered

void QETElementEditor::on_m_edit_element_properties_action_triggered ( )
privateslot

◆ on_m_edit_names_action_triggered

void QETElementEditor::on_m_edit_names_action_triggered ( )
privateslot

◆ on_m_export_svg_action_triggered

bool QETElementEditor::on_m_export_svg_action_triggered ( )
privateslot

QETElementEditor::on_m_export_svg_action_triggered Export the element currently open in this editor to a standalone SVG file.

Renders the live ElementScene directly, the same way ExportDialog::generateSvg() renders the live Diagram for the diagram editor's own SVG export – not ElementPictureFactory's cached picture. That cache is keyed by the element's saved-to-disk uuid and is never invalidated on edit (nothing in this editor ever tells it to), so it would silently export stale content for any element already previewed once in the elements panel, and nothing at all for one that has never been saved. Rendering the scene directly has neither problem and always reflects exactly what is currently on screen, saved or not.

Returns
true if the file was written
Here is the call graph for this function:

◆ on_m_import_dxf_triggered

void QETElementEditor::on_m_import_dxf_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_import_scaled_element_triggered

void QETElementEditor::on_m_import_scaled_element_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_new_action_triggered

void QETElementEditor::on_m_new_action_triggered ( )
privateslot

◆ on_m_online_manual_triggered

void QETElementEditor::on_m_online_manual_triggered ( )
privateslot

◆ on_m_open_action_triggered

void QETElementEditor::on_m_open_action_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_open_from_file_action_triggered

void QETElementEditor::on_m_open_from_file_action_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_paste_action_triggered

void QETElementEditor::on_m_paste_action_triggered ( )
privateslot

◆ on_m_paste_from_element_action_triggered

void QETElementEditor::on_m_paste_from_element_action_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_paste_from_file_action_triggered

void QETElementEditor::on_m_paste_from_file_action_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_paste_in_area_action_triggered

void QETElementEditor::on_m_paste_in_area_action_triggered ( )
privateslot

◆ on_m_quit_action_triggered

void QETElementEditor::on_m_quit_action_triggered ( )
privateslot

◆ on_m_reload_action_triggered

void QETElementEditor::on_m_reload_action_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_revert_selection_action_triggered

void QETElementEditor::on_m_revert_selection_action_triggered ( )
privateslot

◆ on_m_save_action_triggered

bool QETElementEditor::on_m_save_action_triggered ( )
privateslot

QETElementEditor::on_m_save_action_triggered.

Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_m_save_as_action_triggered

bool QETElementEditor::on_m_save_as_action_triggered ( )
privateslot

QETElementEditor::on_m_save_as_action_triggered Ask a location to user and save the current edited element to this location.

Returns
true is success
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_m_save_as_file_action_triggered

bool QETElementEditor::on_m_save_as_file_action_triggered ( )
privateslot
Here is the call graph for this function:

◆ on_m_select_all_act_triggered

void QETElementEditor::on_m_select_all_act_triggered ( )
privateslot

◆ on_m_youtube_action_triggered

void QETElementEditor::on_m_youtube_action_triggered ( )
privateslot

◆ on_m_zoom_fit_best_action_triggered

void QETElementEditor::on_m_zoom_fit_best_action_triggered ( )
privateslot

◆ on_m_zoom_in_action_triggered

void QETElementEditor::on_m_zoom_in_action_triggered ( )
privateslot

◆ on_m_zoom_original_action_triggered

void QETElementEditor::on_m_zoom_original_action_triggered ( )
privateslot

◆ on_m_zoom_out_action_triggered

void QETElementEditor::on_m_zoom_out_action_triggered ( )
privateslot

◆ openElement()

void QETElementEditor::openElement ( const QString & filepath)

QETElementEditor::openElement OPen an element from @filepath.

Parameters
filepath
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pasteOffset()

QPointF QETElementEditor::pasteOffset ( )
static

QETElementEditor::pasteOffset.

Returns
the vertical and horizontal paste offset

◆ readSettings()

void QETElementEditor::readSettings ( )
private

QETElementEditor::readSettings Read some setting about this widget in the QSetting of qelectrotech.

Here is the caller graph for this function:

◆ readSettingsState()

void QETElementEditor::readSettingsState ( )
private

QETElementEditor::readSettingsState Restore the window state (docks, toolbars). Must be called AFTER show() in Qt6 for restoreState() to work correctly.

Here is the caller graph for this function:

◆ saveToLocation

void QETElementEditor::saveToLocation ( ElementsLocation loc)
signal
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFileName()

void QETElementEditor::setFileName ( const QString & file_name)

QETElementEditor::setFileName Set the file name of the edited element.

Parameters
file_name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLocation()

void QETElementEditor::setLocation ( const ElementsLocation & location)

QETElementEditor::setLocation Set the location to edit.

Parameters
location
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNames()

void QETElementEditor::setNames ( const NamesList & name_list)

QETElementEditor::setNames Set the names list of the edited element.

Parameters
name_list

◆ setReadOnly()

void QETElementEditor::setReadOnly ( bool ro)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupActions()

void QETElementEditor::setupActions ( )
private

QETElementEditor::setupActions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupConnection()

void QETElementEditor::setupConnection ( )
private

QETElementEditor::setupConnection.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toFile()

bool QETElementEditor::toFile ( const QString & filepath)

QETElementEditor::toFile Save to a file the current edited element.

Parameters
filepath: path of the file
Returns
true if success
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toLocation()

bool QETElementEditor::toLocation ( const ElementsLocation & location)

QETElementEditor::toLocation Save the edited element into @location.

Parameters
location
Returns
true if successfully saved
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UncheckAddPrimitive()

void QETElementEditor::UncheckAddPrimitive ( )

QETElementEditor::UncheckAddPrimitive.

Here is the caller graph for this function:

◆ updateAction()

void QETElementEditor::updateAction ( )
private

QETElementEditor::updateAction Update actions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateCurrentPartEditor()

void QETElementEditor::updateCurrentPartEditor ( )

◆ updateInformations()

void QETElementEditor::updateInformations ( )

QETElementEditor::updateInformations Update the information and editor dock.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePartsList()

void QETElementEditor::updatePartsList ( )

QETElementEditor::updatePartsList.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateSelectionFromPartsList()

void QETElementEditor::updateSelectionFromPartsList ( )

QETElementEditor::updateSelectionFromPartsList.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTitle()

void QETElementEditor::updateTitle ( )

QETElementEditor::updateTitle Update the title of the windows.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeSettings()

void QETElementEditor::writeSettings ( ) const
private

QETElementEditor::writeSettings Write some setting of this widget in the QSetting of qelectrotech.

Here is the caller graph for this function:

Member Data Documentation

◆ m_add_part_action_grp

QActionGroup* QETElementEditor::m_add_part_action_grp = nullptr
private

◆ m_context_menu_action_list

QList<QAction *> QETElementEditor::m_context_menu_action_list
private

◆ m_default_informations

QLabel* QETElementEditor::m_default_informations = nullptr
private

◆ m_depth_action_group

QActionGroup * QETElementEditor::m_depth_action_group = nullptr
private

◆ m_editors

QHash<QString, ElementItemEditor *> QETElementEditor::m_editors
private

Hash associating primitive names with their matching edition widget.

◆ m_elmt_scene

ElementScene* QETElementEditor::m_elmt_scene = nullptr
private

◆ m_file_name

QString QETElementEditor::m_file_name
private

◆ m_first_activation

bool QETElementEditor::m_first_activation = true
private

◆ m_location

ElementsLocation QETElementEditor::m_location
private

◆ m_min_title

QString QETElementEditor::m_min_title
private

◆ m_opened_from_file

bool QETElementEditor::m_opened_from_file = false
private

◆ m_parts_list

QListWidget* QETElementEditor::m_parts_list = nullptr
private

◆ m_position_label

QLabel* QETElementEditor::m_position_label = nullptr
private

◆ m_read_only

bool QETElementEditor::m_read_only = false
private

◆ m_redo_action

QAction * QETElementEditor::m_redo_action = nullptr
private

◆ m_tools_dock_stack

QStackedWidget* QETElementEditor::m_tools_dock_stack = nullptr
private

◆ m_undo_action

QAction* QETElementEditor::m_undo_action = nullptr
private

◆ m_view

ElementView* QETElementEditor::m_view = nullptr
private

◆ ui

Ui::QETElementEditor* QETElementEditor::ui
private

The documentation for this class was generated from the following files: