mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-18 15:49:58 +02:00
The title block template editor now save its geometry and state when closing.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1650 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1050,7 +1050,7 @@ void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location,
|
|||||||
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
||||||
qet_template_editor -> setOpenForDuplication(duplicate);
|
qet_template_editor -> setOpenForDuplication(duplicate);
|
||||||
qet_template_editor -> edit(location);
|
qet_template_editor -> edit(location);
|
||||||
qet_template_editor -> showMaximized();
|
qet_template_editor -> show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1060,7 +1060,7 @@ void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location,
|
|||||||
void QETApp::openTitleBlockTemplate(const QString &filepath) {
|
void QETApp::openTitleBlockTemplate(const QString &filepath) {
|
||||||
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
||||||
qet_template_editor -> edit(filepath);
|
qet_template_editor -> edit(filepath);
|
||||||
qet_template_editor -> showMaximized();
|
qet_template_editor -> show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ QETTitleBlockTemplateEditor::QETTitleBlockTemplateEditor(QWidget *parent) :
|
|||||||
initActions();
|
initActions();
|
||||||
initMenus();
|
initMenus();
|
||||||
initToolbars();
|
initToolbars();
|
||||||
|
readSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,6 +143,7 @@ void QETTitleBlockTemplateEditor::firstActivation(QEvent *event) {
|
|||||||
*/
|
*/
|
||||||
void QETTitleBlockTemplateEditor::closeEvent(QCloseEvent *qce) {
|
void QETTitleBlockTemplateEditor::closeEvent(QCloseEvent *qce) {
|
||||||
if (canClose()) {
|
if (canClose()) {
|
||||||
|
writeSettings();
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
qce -> accept();
|
qce -> accept();
|
||||||
} else qce -> ignore();
|
} else qce -> ignore();
|
||||||
@@ -301,7 +303,7 @@ void QETTitleBlockTemplateEditor::editLogos() {
|
|||||||
void QETTitleBlockTemplateEditor::newTemplate() {
|
void QETTitleBlockTemplateEditor::newTemplate() {
|
||||||
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
||||||
qet_template_editor -> edit(TitleBlockTemplateLocation());
|
qet_template_editor -> edit(TitleBlockTemplateLocation());
|
||||||
qet_template_editor -> showMaximized();
|
qet_template_editor -> show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -426,6 +428,7 @@ void QETTitleBlockTemplateEditor::initToolbars() {
|
|||||||
addToolBar(Qt::TopToolBarArea, main_toolbar);
|
addToolBar(Qt::TopToolBarArea, main_toolbar);
|
||||||
|
|
||||||
QToolBar *edit_toolbar = new QToolBar(tr("\311dition", "toolbar title"), this);
|
QToolBar *edit_toolbar = new QToolBar(tr("\311dition", "toolbar title"), this);
|
||||||
|
edit_toolbar -> setObjectName("tbt_edit_toolbar");
|
||||||
edit_toolbar -> addAction(undo_);
|
edit_toolbar -> addAction(undo_);
|
||||||
edit_toolbar -> addAction(redo_);
|
edit_toolbar -> addAction(redo_);
|
||||||
edit_toolbar -> addSeparator();
|
edit_toolbar -> addSeparator();
|
||||||
@@ -454,6 +457,7 @@ void QETTitleBlockTemplateEditor::initWidgets() {
|
|||||||
undo_view_ -> setEmptyLabel(tr("Aucune modification", "label displayed in the undo list when empty"));
|
undo_view_ -> setEmptyLabel(tr("Aucune modification", "label displayed in the undo list when empty"));
|
||||||
|
|
||||||
undo_dock_widget_ = new QDockWidget(tr("Annulations", "dock title"));
|
undo_dock_widget_ = new QDockWidget(tr("Annulations", "dock title"));
|
||||||
|
undo_dock_widget_ -> setObjectName("tbt_undo_dock");
|
||||||
undo_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
undo_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||||
undo_dock_widget_ -> setWidget(undo_view_);
|
undo_dock_widget_ -> setWidget(undo_view_);
|
||||||
undo_dock_widget_ -> setMinimumWidth(290);
|
undo_dock_widget_ -> setMinimumWidth(290);
|
||||||
@@ -472,6 +476,7 @@ void QETTitleBlockTemplateEditor::initWidgets() {
|
|||||||
// cell edition widget at the bottom
|
// cell edition widget at the bottom
|
||||||
template_cell_editor_widget_ = new TitleBlockTemplateCellWidget(tb_template_);
|
template_cell_editor_widget_ = new TitleBlockTemplateCellWidget(tb_template_);
|
||||||
template_cell_editor_dock_widget_ = new QDockWidget(tr("Propri\351t\351s de la cellule", "dock title"), this);
|
template_cell_editor_dock_widget_ = new QDockWidget(tr("Propri\351t\351s de la cellule", "dock title"), this);
|
||||||
|
template_cell_editor_dock_widget_ -> setObjectName("tbt_celleditor_dock");
|
||||||
template_cell_editor_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
template_cell_editor_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||||
template_cell_editor_dock_widget_ -> setWidget(template_cell_editor_widget_);
|
template_cell_editor_dock_widget_ -> setWidget(template_cell_editor_widget_);
|
||||||
template_cell_editor_dock_widget_ -> setMinimumWidth(180);
|
template_cell_editor_dock_widget_ -> setMinimumWidth(180);
|
||||||
@@ -554,6 +559,30 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const {
|
|||||||
return(titleblock_title);
|
return(titleblock_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Load template editor-related parameters.
|
||||||
|
*/
|
||||||
|
void QETTitleBlockTemplateEditor::readSettings() {
|
||||||
|
QSettings &settings = QETApp::settings();
|
||||||
|
|
||||||
|
// window size and position
|
||||||
|
QVariant geometry = settings.value("titleblocktemplateeditor/geometry");
|
||||||
|
if (geometry.isValid()) restoreGeometry(geometry.toByteArray());
|
||||||
|
|
||||||
|
// window state (toolbars, docks...)
|
||||||
|
QVariant state = settings.value("titleblocktemplateeditor/state");
|
||||||
|
if (state.isValid()) restoreState(state.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Save template editor-related parameters.
|
||||||
|
*/
|
||||||
|
void QETTitleBlockTemplateEditor::writeSettings() {
|
||||||
|
QSettings &settings = QETApp::settings();
|
||||||
|
settings.setValue("titleblocktemplateeditor/geometry", saveGeometry());
|
||||||
|
settings.setValue("titleblocktemplateeditor/state", saveState());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update various things when user changes the selected cells.
|
Update various things when user changes the selected cells.
|
||||||
@param selected_cells List of selected cells.
|
@param selected_cells List of selected cells.
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ class QETTitleBlockTemplateEditor : public QETMainWindow {
|
|||||||
QString currentlyEditedTitle() const;
|
QString currentlyEditedTitle() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
void selectedCellsChanged(QList<TitleBlockCell *>);
|
void selectedCellsChanged(QList<TitleBlockCell *>);
|
||||||
void duplicateCurrentLocation();
|
void duplicateCurrentLocation();
|
||||||
bool edit(const TitleBlockTemplateLocation &);
|
bool edit(const TitleBlockTemplateLocation &);
|
||||||
|
|||||||
Reference in New Issue
Block a user