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

#include <qettemplateeditor.h>

Inheritance diagram for QETTitleBlockTemplateEditor:
Inheritance graph
Collaboration diagram for QETTitleBlockTemplateEditor:
Collaboration graph

Public Slots

void readSettings ()
 QETTitleBlockTemplateEditor::readSettings Read settings.
void readSettingsState ()
 QETTitleBlockTemplateEditor::readSettingsState Restore the window state (docks, toolbars). Must be called AFTER show() in Qt6 for restoreState() to work correctly – callers are responsible for calling this after show(), since this window isn't shown by its own constructor.
void writeSettings ()
 QETTitleBlockTemplateEditor::writeSettings Write the settings.
void selectedCellsChanged (const QList< TitleBlockCell * > &)
void duplicateCurrentLocation ()
bool edit (const TitleBlockTemplateLocation &)
bool edit (QETProject *, const QString &)
bool edit (const QString &)
bool editCopyOf (const TitleBlockTemplate *)
bool edit (TitleBlockTemplate *)
void editLogos ()
void newTemplate ()
void open ()
void openFromFile ()
bool save ()
bool saveAs ()
bool saveAsFile ()
void setReadOnly (bool)
void quit ()
void savePreviewWidthToApplicationSettings (int, int)
 QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings Save the new preview width to application settings.
void editTemplateInformation ()
Public Slots inherited from QETMainWindow
void toggleFullScreen ()
void updateFullScreenAction ()
void checkToolbarsmenu ()

Public Member Functions

 QETTitleBlockTemplateEditor (QWidget *=nullptr)
 ~QETTitleBlockTemplateEditor () override
TitleBlockTemplateLocation location () const
bool isEditing (const QString &ilepath)
void setOpenForDuplication (bool)
 QETTitleBlockTemplateEditor::setOpenForDuplication.
bool openForDuplication () const
Public Member Functions inherited from QETMainWindow
 QETMainWindow (QWidget *=nullptr, Qt::WindowFlags=Qt::Widget)
 ~QETMainWindow () override

Protected Member Functions

bool canClose ()
void firstActivation (QEvent *) override
void closeEvent (QCloseEvent *) override
Protected Member Functions inherited from QETMainWindow
void initCommonActions ()
void initCommonMenus ()
void insertMenu (QMenu *, QMenu *, bool=true)
QAction * actionForMenu (QMenu *)
bool event (QEvent *) override
void dragEnterEvent (QDragEnterEvent *e) override
void dropEvent (QDropEvent *e) override

Private Slots

TitleBlockTemplateLocation getTitleBlockTemplateLocationFromUser (const QString &=QString(), bool existing_only=true)
void pushCellUndoCommand (ModifyTitleBlockCellCommand *)
void pushGridUndoCommand (TitleBlockTemplateCommand *)
void pushUndoCommand (QUndoCommand *)
void updateEditorTitle ()
void updateActions ()
bool saveAs (const TitleBlockTemplateLocation &)
bool saveAs (const QString &)

Private Member Functions

 QETTitleBlockTemplateEditor (const QETTitleBlockTemplateEditor &)
void initActions ()
void initMenus ()
void initToolbars ()
void initWidgets ()
void initLogoManager ()
QString currentlyEditedTitle () const

Private Attributes

QMenu * file_menu_
 menus TODO
QMenu * edit_menu_
QMenu * display_menu_
QAction * new_
 actions
QAction * open_
QAction * open_from_file_
QAction * save_
QAction * save_as_
QAction * save_as_file_
QAction * quit_
QAction * undo_
QAction * redo_
QAction * cut_
QAction * copy_
QAction * paste_
QAction * edit_logos_
QAction * edit_info_
QAction * add_row_
QAction * add_col_
QAction * merge_cells_
QAction * split_cell_
QAction * zoom_in_
QAction * zoom_out_
QAction * zoom_fit_
QAction * zoom_reset_
TitleBlockTemplateLocation location_
 Location of the currently edited template.
QString filepath_
 Filepath of the currently edited template, if opened from a file.
bool opened_from_file_
 Whether to consider the location or the filepath.
bool read_only_
 whether the currently edited template is considered read only
bool duplicate_
bool first_activation_
 Used to track the first activation of the editor main window.
TitleBlockTemplatetb_template_
 Template Object edited.
QGraphicsScene * template_edition_area_scene_
 Template preview.
TitleBlockTemplateViewtemplate_edition_area_view_
QDockWidget * template_cell_editor_dock_widget_
 Individual cell widget edition.
TitleBlockTemplateCellWidgettemplate_cell_editor_widget_
TitleBlockTemplateLogoManagerlogo_manager_
 Logo manager widget.
QUndoStack * undo_stack_
 Undo interface.
QUndoView * undo_view_
QDockWidget * undo_dock_widget_

Additional Inherited Members

Protected Attributes inherited from QETMainWindow
QAction * configure_action_
 Launch the QElectroTech configuration dialog.
QAction * fullscreen_action_
 Toggle full screen.
QAction * whatsthis_action_
 Toggle "What's this" mode.
QAction * about_qet_
 Launch the "About QElectroTech" dialog.
QAction * manual_online_
 Launch browser on QElectroTech online manual.
QAction * youtube_
 Launch browser on QElectroTech Youtube channel.
QAction * upgrade_
 Launch browser on QElectroTech Windows Nightly builds.
QAction * upgrade_M
 Launch browser on QElectroTech MAC_OS_X builds.
QAction * donate_
 Launch browser to donate link.
QAction * about_qt_
 launch the "About Qt" dialog
QAction * diagnostics_action_
 Open the diagnostics report dialog (discussion #644, step 5).
QMenu * settings_menu_
 Settings menu.
QMenu * help_menu_
 Help menu.
QMenu * display_toolbars_
 Show/hide toolbars/docks.
QHash< QMenu *, QAction * > menu_actions_
 Store actions retrieved when inserting menus.
bool first_activation_
 Used to detect whether the window is activated for the first time.

Detailed Description

This class implements the main window of QElectroTech's titleblock template editor. This editor aims at allowing users to easily create their own title block templates.

Constructor & Destructor Documentation

◆ QETTitleBlockTemplateEditor() [1/2]

QETTitleBlockTemplateEditor::QETTitleBlockTemplateEditor ( QWidget * parent = nullptr)
Parameters
parentparent QWidget of this window
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~QETTitleBlockTemplateEditor()

QETTitleBlockTemplateEditor::~QETTitleBlockTemplateEditor ( )
override

Destructor

◆ QETTitleBlockTemplateEditor() [2/2]

QETTitleBlockTemplateEditor::QETTitleBlockTemplateEditor ( const QETTitleBlockTemplateEditor & )
private
Here is the call graph for this function:

Member Function Documentation

◆ canClose()

bool QETTitleBlockTemplateEditor::canClose ( )
protected
Returns
true if the currently edited template can be closed. A template can be closed if it has not been modified. If the template has been modified, this method asks the user what he wants to do.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closeEvent()

void QETTitleBlockTemplateEditor::closeEvent ( QCloseEvent * qce)
overrideprotected

Handle the closing of the main window

Parameters
qceThe QCloseEvent event
Here is the call graph for this function:

◆ currentlyEditedTitle()

QString QETTitleBlockTemplateEditor::currentlyEditedTitle ( ) const
private
Returns
a string describing what is being edited, along with [Changed] or [Read only] tags. Useful to compose the window title.
Here is the caller graph for this function:

◆ duplicateCurrentLocation

void QETTitleBlockTemplateEditor::duplicateCurrentLocation ( )
slot

Ask the user for a new template name in order to duplicate the currently edited template.

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

◆ edit [1/4]

bool QETTitleBlockTemplateEditor::edit ( const QString & file_path)
slot
Parameters
file_pathPath of the template file to edit.
Returns
false if a problem occurred while opening the template, true otherwise.

TODO the file opening failed, warn the user?

TODO the file editing failed, warn the user?

Here is the call graph for this function:

◆ edit [2/4]

bool QETTitleBlockTemplateEditor::edit ( const TitleBlockTemplateLocation & location)
slot
Parameters
locationLocation of the tile block template to be edited.

TODO The TBT does not exist, manage error

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

◆ edit [3/4]

bool QETTitleBlockTemplateEditor::edit ( QETProject * project,
const QString & template_name )
slot

Edit the given template.

Parameters
projectParent project of the template to edit.
template_nameName of the template to edit within its parent project.
Returns
true if this editor was able to edit the given template, false otherwise

TODO The TBT does not exist, manage error

Here is the call graph for this function:

◆ edit [4/4]

bool QETTitleBlockTemplateEditor::edit ( TitleBlockTemplate * tbt)
slot
Parameters
tbtTitle block template to be directly edited
Returns
false if a problem occurred while opening the template, true otherwise.
Here is the call graph for this function:

◆ editCopyOf

bool QETTitleBlockTemplateEditor::editCopyOf ( const TitleBlockTemplate * tbt)
slot
Parameters
tbtTitle block template to be edited
Returns
false if a problem occurred while opening the template, true otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ editLogos

void QETTitleBlockTemplateEditor::editLogos ( )
slot

Launches the logo manager widget, which allows the user to manage the logos embedded within the edited template.

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

◆ editTemplateInformation

void QETTitleBlockTemplateEditor::editTemplateInformation ( )
slot

Edit extra information attached to the template.

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

◆ firstActivation()

void QETTitleBlockTemplateEditor::firstActivation ( QEvent * event)
overrideprotectedvirtual
Parameters
eventObject describing the received event.

Reimplemented from QETMainWindow.

Here is the call graph for this function:

◆ getTitleBlockTemplateLocationFromUser

TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLocationFromUser ( const QString & title = QString(),
bool existing_only = true )
privateslot

Ask the user for a title block template location

Parameters
titleTitle displayed by the dialog window
existing_onlyTrue for the user to be forced to choose an existing template, false if he may specify the template name
Returns
The location chosen by the user, or an empty TitleBlockTemplateLocation if the user cancelled the dialog
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initActions()

void QETTitleBlockTemplateEditor::initActions ( )
private

Initialize the various actions.

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

◆ initLogoManager()

void QETTitleBlockTemplateEditor::initLogoManager ( )
private

Initialize the logo manager

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

◆ initMenus()

void QETTitleBlockTemplateEditor::initMenus ( )
private

Initialize the various menus.

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

◆ initToolbars()

void QETTitleBlockTemplateEditor::initToolbars ( )
private

Initialize toolbars.

Here is the caller graph for this function:

◆ initWidgets()

void QETTitleBlockTemplateEditor::initWidgets ( )
private

Initialize layouts and widgets

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

◆ isEditing()

bool QETTitleBlockTemplateEditor::isEditing ( const QString & filepath)
Returns
true if the provided filepath matches the currently edited template.
Parameters
filepathpath of a title block template on the filesystem
Here is the call graph for this function:

◆ location()

TitleBlockTemplateLocation QETTitleBlockTemplateEditor::location ( ) const
Returns
the location of the currently edited template
Here is the caller graph for this function:

◆ newTemplate

void QETTitleBlockTemplateEditor::newTemplate ( )
slot

Launch a new title block template editor.

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

◆ open

void QETTitleBlockTemplateEditor::open ( )
slot

Ask the user to choose a title block template from the known collections then open it for edition.

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

◆ openForDuplication()

bool QETTitleBlockTemplateEditor::openForDuplication ( ) const
Returns
true if this editor will prompt the user for a new template name as soon as the window appears in order to duplicate the edited one.

◆ openFromFile

void QETTitleBlockTemplateEditor::openFromFile ( )
slot

Ask the user to choose a file supposed to contain a title block template, then open it for edition.

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

◆ pushCellUndoCommand

void QETTitleBlockTemplateEditor::pushCellUndoCommand ( ModifyTitleBlockCellCommand * command)
privateslot

Configure an undo Command before adding it to the undo stack.

Parameters
commandto be added to the undo stack
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pushGridUndoCommand

void QETTitleBlockTemplateEditor::pushGridUndoCommand ( TitleBlockTemplateCommand * command)
privateslot

Add an undo Command to the undo stack.

Parameters
commandQUndoCommand to be added to the undo stack
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pushUndoCommand

void QETTitleBlockTemplateEditor::pushUndoCommand ( QUndoCommand * command)
privateslot

Add an undo Command to the undo stack.

Parameters
commandQUndoCommand to be added to the undo stack
Here is the caller graph for this function:

◆ quit

void QETTitleBlockTemplateEditor::quit ( )
slot

Close the current editor.

Here is the caller graph for this function:

◆ readSettings

void QETTitleBlockTemplateEditor::readSettings ( )
slot

QETTitleBlockTemplateEditor::readSettings Read settings.

Here is the caller graph for this function:

◆ readSettingsState

void QETTitleBlockTemplateEditor::readSettingsState ( )
slot

QETTitleBlockTemplateEditor::readSettingsState Restore the window state (docks, toolbars). Must be called AFTER show() in Qt6 for restoreState() to work correctly – callers are responsible for calling this after show(), since this window isn't shown by its own constructor.

Here is the caller graph for this function:

◆ save

bool QETTitleBlockTemplateEditor::save ( )
slot

Save the currently edited title block template back to its parent project.

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

◆ saveAs [1/3]

bool QETTitleBlockTemplateEditor::saveAs ( )
slot

Ask the user where he wishes to save the currently edited template.

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

◆ saveAs [2/3]

bool QETTitleBlockTemplateEditor::saveAs ( const QString & filepath)
privateslot

Save the template in the provided filepath.

See also
TitleBlockTemplate::saveToXmlFile()
Parameters
filepathlocation Location where the title block template should be saved.
Here is the call graph for this function:

◆ saveAs [3/3]

bool QETTitleBlockTemplateEditor::saveAs ( const TitleBlockTemplateLocation & location)
privateslot

Save the template under the provided location.

See also
QETProject::setTemplateXmlDescription()
Parameters
locationLocation where the title block template should be saved.
Here is the call graph for this function:

◆ saveAsFile

bool QETTitleBlockTemplateEditor::saveAsFile ( )
slot

Ask the user where on the filesystem he wishes to save the currently edited template.

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

◆ savePreviewWidthToApplicationSettings

void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings ( int former_preview_width,
int new_preview_width )
slot

QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings Save the new preview width to application settings.

Parameters
former_preview_width: former_preview_width Unused, former preview width
new_preview_width: new_preview_width New preview width
Here is the caller graph for this function:

◆ selectedCellsChanged

void QETTitleBlockTemplateEditor::selectedCellsChanged ( const QList< TitleBlockCell * > & selected_cells)
slot

Update various things when user changes the selected cells.

Parameters
selected_cellsList of selected cells.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOpenForDuplication()

void QETTitleBlockTemplateEditor::setOpenForDuplication ( bool duplicate)

QETTitleBlockTemplateEditor::setOpenForDuplication.

Parameters
duplicate: true for this editor to prompt the user for a new template name as soon as the window appears in order to duplicate the edited one.

◆ setReadOnly

void QETTitleBlockTemplateEditor::setReadOnly ( bool read_only)
slot
Parameters
read_onlyTrue to restrict this editor to visualization of the currently edited template, false to allow full edition.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateActions

void QETTitleBlockTemplateEditor::updateActions ( )
privateslot

Ensure the user interface remains consistent by enabling or disabling adequate actions.

Here is the caller graph for this function:

◆ updateEditorTitle

void QETTitleBlockTemplateEditor::updateEditorTitle ( )
privateslot

Set the title of this editor.

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

◆ writeSettings

void QETTitleBlockTemplateEditor::writeSettings ( )
slot

QETTitleBlockTemplateEditor::writeSettings Write the settings.

Here is the caller graph for this function:

Member Data Documentation

◆ add_col_

QAction * QETTitleBlockTemplateEditor::add_col_
private

◆ add_row_

QAction * QETTitleBlockTemplateEditor::add_row_
private

◆ copy_

QAction * QETTitleBlockTemplateEditor::copy_
private

◆ cut_

QAction * QETTitleBlockTemplateEditor::cut_
private

◆ display_menu_

QMenu * QETTitleBlockTemplateEditor::display_menu_
private

◆ duplicate_

bool QETTitleBlockTemplateEditor::duplicate_
private

Whether to ask the user a new template name when the window appears in order to rename the edited template.

◆ edit_info_

QAction * QETTitleBlockTemplateEditor::edit_info_
private

◆ edit_logos_

QAction * QETTitleBlockTemplateEditor::edit_logos_
private

◆ edit_menu_

QMenu * QETTitleBlockTemplateEditor::edit_menu_
private

◆ file_menu_

QMenu* QETTitleBlockTemplateEditor::file_menu_
private

menus TODO

◆ filepath_

QString QETTitleBlockTemplateEditor::filepath_
private

Filepath of the currently edited template, if opened from a file.

◆ first_activation_

bool QETTitleBlockTemplateEditor::first_activation_
private

Used to track the first activation of the editor main window.

◆ location_

TitleBlockTemplateLocation QETTitleBlockTemplateEditor::location_
private

Location of the currently edited template.

◆ logo_manager_

TitleBlockTemplateLogoManager* QETTitleBlockTemplateEditor::logo_manager_
private

Logo manager widget.

◆ merge_cells_

QAction * QETTitleBlockTemplateEditor::merge_cells_
private

◆ new_

QAction* QETTitleBlockTemplateEditor::new_
private

actions

◆ open_

QAction * QETTitleBlockTemplateEditor::open_
private

◆ open_from_file_

QAction * QETTitleBlockTemplateEditor::open_from_file_
private

◆ opened_from_file_

bool QETTitleBlockTemplateEditor::opened_from_file_
private

Whether to consider the location or the filepath.

◆ paste_

QAction * QETTitleBlockTemplateEditor::paste_
private

◆ quit_

QAction * QETTitleBlockTemplateEditor::quit_
private

◆ read_only_

bool QETTitleBlockTemplateEditor::read_only_
private

whether the currently edited template is considered read only

◆ redo_

QAction * QETTitleBlockTemplateEditor::redo_
private

◆ save_

QAction * QETTitleBlockTemplateEditor::save_
private

◆ save_as_

QAction * QETTitleBlockTemplateEditor::save_as_
private

◆ save_as_file_

QAction * QETTitleBlockTemplateEditor::save_as_file_
private

◆ split_cell_

QAction * QETTitleBlockTemplateEditor::split_cell_
private

◆ tb_template_

TitleBlockTemplate* QETTitleBlockTemplateEditor::tb_template_
private

Template Object edited.

◆ template_cell_editor_dock_widget_

QDockWidget* QETTitleBlockTemplateEditor::template_cell_editor_dock_widget_
private

Individual cell widget edition.

◆ template_cell_editor_widget_

TitleBlockTemplateCellWidget* QETTitleBlockTemplateEditor::template_cell_editor_widget_
private

◆ template_edition_area_scene_

QGraphicsScene* QETTitleBlockTemplateEditor::template_edition_area_scene_
private

Template preview.

◆ template_edition_area_view_

TitleBlockTemplateView* QETTitleBlockTemplateEditor::template_edition_area_view_
private

◆ undo_

QAction* QETTitleBlockTemplateEditor::undo_
private

◆ undo_dock_widget_

QDockWidget* QETTitleBlockTemplateEditor::undo_dock_widget_
private

◆ undo_stack_

QUndoStack* QETTitleBlockTemplateEditor::undo_stack_
private

Undo interface.

◆ undo_view_

QUndoView* QETTitleBlockTemplateEditor::undo_view_
private

◆ zoom_fit_

QAction * QETTitleBlockTemplateEditor::zoom_fit_
private

◆ zoom_in_

QAction* QETTitleBlockTemplateEditor::zoom_in_
private

◆ zoom_out_

QAction * QETTitleBlockTemplateEditor::zoom_out_
private

◆ zoom_reset_

QAction * QETTitleBlockTemplateEditor::zoom_reset_
private

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