mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-27 04:24:13 +02:00
Compare commits
4 Commits
da1d7df662
...
487b22f483
| Author | SHA1 | Date | |
|---|---|---|---|
| 487b22f483 | |||
| 8f6f41ed19 | |||
| 61a160fa62 | |||
| f6afd87522 |
@@ -78,8 +78,9 @@ QETElementEditor::QETElementEditor(QWidget *parent) :
|
|||||||
//ui->m_display_menu->insertMenu(ui->m_zoom_in_action, menu);
|
//ui->m_display_menu->insertMenu(ui->m_zoom_in_action, menu);
|
||||||
|
|
||||||
setWindowState(Qt::WindowMaximized);
|
setWindowState(Qt::WindowMaximized);
|
||||||
readSettings();
|
readSettings(); // restoreGeometry before show()
|
||||||
show();
|
show();
|
||||||
|
readSettingsState(); // restoreState() must be called after show() in Qt6
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -951,16 +952,28 @@ void QETElementEditor::readSettings()
|
|||||||
restoreGeometry(geometry.toByteArray());
|
restoreGeometry(geometry.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant state = settings.value("elementeditor/state");
|
|
||||||
if (state.isValid()) {
|
|
||||||
restoreState(state.toByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
auto data = m_elmt_scene->elementData();
|
auto data = m_elmt_scene->elementData();
|
||||||
data.m_drawing_information = settings.value("elementeditor/default-informations", "").toString();
|
data.m_drawing_information = settings.value("elementeditor/default-informations", "").toString();
|
||||||
m_elmt_scene->setElementData(data);
|
m_elmt_scene->setElementData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETElementEditor::readSettingsState
|
||||||
|
* Restore the window state (docks, toolbars).
|
||||||
|
* Must be called AFTER show() in Qt6 for restoreState() to work correctly.
|
||||||
|
*/
|
||||||
|
void QETElementEditor::readSettingsState()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
QVariant state = settings.value("elementeditor/state");
|
||||||
|
if (state.isValid()) {
|
||||||
|
if (!restoreState(state.toByteArray())) {
|
||||||
|
settings.remove("elementeditor/state");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETElementEditor::writeSettings
|
* @brief QETElementEditor::writeSettings
|
||||||
* Write some setting of this widget in the
|
* Write some setting of this widget in the
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ class QETElementEditor : public QMainWindow
|
|||||||
private:
|
private:
|
||||||
bool canClose();
|
bool canClose();
|
||||||
void readSettings();
|
void readSettings();
|
||||||
|
void readSettingsState();
|
||||||
void writeSettings() const;
|
void writeSettings() const;
|
||||||
void setupActions();
|
void setupActions();
|
||||||
void updateAction();
|
void updateAction();
|
||||||
|
|||||||
@@ -1975,6 +1975,7 @@ void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location,
|
|||||||
qet_template_editor -> setOpenForDuplication(duplicate);
|
qet_template_editor -> setOpenForDuplication(duplicate);
|
||||||
qet_template_editor -> edit(location);
|
qet_template_editor -> edit(location);
|
||||||
qet_template_editor -> show();
|
qet_template_editor -> show();
|
||||||
|
qet_template_editor -> readSettingsState(); // must run after show() in Qt6
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1986,6 +1987,7 @@ 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 -> show();
|
qet_template_editor -> show();
|
||||||
|
qet_template_editor -> readSettingsState(); // must run after show() in Qt6
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -135,8 +135,9 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
|||||||
connect(&m_workspace, &QMdiArea::subWindowActivated, this, &QETDiagramEditor::subWindowActivated);
|
connect(&m_workspace, &QMdiArea::subWindowActivated, this, &QETDiagramEditor::subWindowActivated);
|
||||||
connect(QApplication::clipboard(), &QClipboard::dataChanged, this, &QETDiagramEditor::slot_updatePasteAction);
|
connect(QApplication::clipboard(), &QClipboard::dataChanged, this, &QETDiagramEditor::slot_updatePasteAction);
|
||||||
|
|
||||||
readSettings();
|
readSettings(); // restoreGeometry before show()
|
||||||
show();
|
show();
|
||||||
|
readSettingsState(); // restoreState() must be called after show() in Qt6
|
||||||
|
|
||||||
//If valid file path is given as arguments
|
//If valid file path is given as arguments
|
||||||
uint opened_projects = 0;
|
uint opened_projects = 0;
|
||||||
@@ -2227,10 +2228,6 @@ void QETDiagramEditor::readSettings()
|
|||||||
QVariant geometry = settings.value("diagrameditor/geometry");
|
QVariant geometry = settings.value("diagrameditor/geometry");
|
||||||
if (geometry.isValid()) restoreGeometry(geometry.toByteArray());
|
if (geometry.isValid()) restoreGeometry(geometry.toByteArray());
|
||||||
|
|
||||||
// etat de la fenetre (barres d'outils, docks...)
|
|
||||||
QVariant state = settings.value("diagrameditor/state");
|
|
||||||
if (state.isValid()) restoreState(state.toByteArray());
|
|
||||||
|
|
||||||
// gestion des projets (onglets ou fenetres)
|
// gestion des projets (onglets ou fenetres)
|
||||||
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
|
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
|
||||||
if (tabbed) {
|
if (tabbed) {
|
||||||
@@ -2240,6 +2237,24 @@ void QETDiagramEditor::readSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief QETDiagramEditor::readSettingsState
|
||||||
|
Restore the window state (docks, toolbars).
|
||||||
|
Must be called AFTER show() in Qt6 for restoreState() to work correctly.
|
||||||
|
*/
|
||||||
|
void QETDiagramEditor::readSettingsState()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
// etat de la fenetre (barres d'outils, docks...)
|
||||||
|
QVariant state = settings.value("diagrameditor/state");
|
||||||
|
if (state.isValid()) {
|
||||||
|
if (!restoreState(state.toByteArray())) {
|
||||||
|
settings.remove("diagrameditor/state");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QETDiagramEditor::writeSettings
|
@brief QETDiagramEditor::writeSettings
|
||||||
Write the settings
|
Write the settings
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ class QETDiagramEditor : public QETMainWindow
|
|||||||
void setWindowedMode();
|
void setWindowedMode();
|
||||||
void setTabbedMode();
|
void setTabbedMode();
|
||||||
void readSettings();
|
void readSettings();
|
||||||
|
void readSettingsState();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
void activateProject(QETProject *);
|
void activateProject(QETProject *);
|
||||||
void activateProject(ProjectView *);
|
void activateProject(ProjectView *);
|
||||||
|
|||||||
@@ -358,6 +358,7 @@ 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 -> show();
|
qet_template_editor -> show();
|
||||||
|
qet_template_editor -> readSettingsState(); // must run after show() in Qt6
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -645,10 +646,25 @@ void QETTitleBlockTemplateEditor::readSettings()
|
|||||||
// window size and position
|
// window size and position
|
||||||
QVariant geometry = settings.value("titleblocktemplateeditor/geometry");
|
QVariant geometry = settings.value("titleblocktemplateeditor/geometry");
|
||||||
if (geometry.isValid()) restoreGeometry(geometry.toByteArray());
|
if (geometry.isValid()) restoreGeometry(geometry.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief 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 QETTitleBlockTemplateEditor::readSettingsState()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
// window state (toolbars, docks...)
|
|
||||||
QVariant state = settings.value("titleblocktemplateeditor/state");
|
QVariant state = settings.value("titleblocktemplateeditor/state");
|
||||||
if (state.isValid()) restoreState(state.toByteArray());
|
if (state.isValid()) {
|
||||||
|
if (!restoreState(state.toByteArray())) {
|
||||||
|
settings.remove("titleblocktemplateeditor/state");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ class QETTitleBlockTemplateEditor : public QETMainWindow {
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readSettings();
|
void readSettings();
|
||||||
|
void readSettingsState();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
void selectedCellsChanged(const QList<TitleBlockCell *>&);
|
void selectedCellsChanged(const QList<TitleBlockCell *>&);
|
||||||
void duplicateCurrentLocation();
|
void duplicateCurrentLocation();
|
||||||
|
|||||||
Reference in New Issue
Block a user