Multipaste : auto-num of element work, even if the option "erase label on copy /paste" is enable.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5337 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-04-21 17:48:22 +00:00
parent f4a7de8f37
commit 5e15c597c1
4 changed files with 20 additions and 7 deletions

View File

@@ -237,7 +237,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed"; bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
bool zoom_out_folio = settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool(); bool zoom_out_folio = settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool();
bool use_trackpad = settings.value("diagramview/gestures", false).toBool(); bool use_trackpad = settings.value("diagramview/gestures", false).toBool();
bool save_label_paste = settings.value("diagramcommands/save-label", true).toBool(); bool save_label_paste = settings.value("diagramcommands/erase-label-on-copy", true).toBool();
bool panel_folio = settings.value("genericpanel/folio", true).toBool(); bool panel_folio = settings.value("genericpanel/folio", true).toBool();
bool highlight_integrated_elements = settings.value("diagrameditor/highlight-integrated-elements", true).toBool(); bool highlight_integrated_elements = settings.value("diagrameditor/highlight-integrated-elements", true).toBool();
bool terminal_exportlist = settings.value("nomenclature-exportlist", true).toBool(); bool terminal_exportlist = settings.value("nomenclature-exportlist", true).toBool();
@@ -386,7 +386,7 @@ void GeneralConfigurationPage::applyConf()
settings.setValue("diagrameditor/highlight-integrated-elements", highlight_integrated_elements_ -> isChecked()); settings.setValue("diagrameditor/highlight-integrated-elements", highlight_integrated_elements_ -> isChecked());
settings.setValue("elementeditor/default-informations", default_element_infos_textfield_ -> toPlainText()); settings.setValue("elementeditor/default-informations", default_element_infos_textfield_ -> toPlainText());
settings.setValue("diagramview/gestures", use_trackpad_ -> isChecked()); settings.setValue("diagramview/gestures", use_trackpad_ -> isChecked());
settings.setValue("diagramcommands/save-label", save_label_paste_ -> isChecked()); settings.setValue("diagramcommands/erase-label-on-copy", save_label_paste_ -> isChecked());
settings.setValue("diagrameditor/zoom-out-beyond-of-folio", m_zoom_out_beyond_folio->isChecked()); settings.setValue("diagrameditor/zoom-out-beyond-of-folio", m_zoom_out_beyond_folio->isChecked());
settings.setValue("genericpanel/folio",folio_panel_->isChecked()); settings.setValue("genericpanel/folio",folio_panel_->isChecked());
settings.setValue("nomenclature/terminal-exportlist",terminal_exportlist_->isChecked()); settings.setValue("nomenclature/terminal-exportlist",terminal_exportlist_->isChecked());

View File

@@ -100,7 +100,7 @@ void PasteDiagramCommand::redo()
//make new uuid, because old uuid are the uuid of the copied element //make new uuid, because old uuid are the uuid of the copied element
e -> newUuid(); e -> newUuid();
if (settings.value("diagramcommands/save-label", true).toBool()) if (settings.value("diagramcommands/erase-label-on-copy", true).toBool())
{ {
//Reset the information about the label, the comment and location //Reset the information about the label, the comment and location
e -> rElementInformations().addValue("formula", ""); e -> rElementInformations().addValue("formula", "");

View File

@@ -4,6 +4,7 @@
#include "diagramcommands.h" #include "diagramcommands.h"
#include "element.h" #include "element.h"
#include "conductorautonumerotation.h" #include "conductorautonumerotation.h"
#include <QSettings>
MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) : MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) :
QDialog(parent), QDialog(parent),
@@ -75,6 +76,17 @@ void MultiPasteDialog::on_m_button_box_accepted()
{ {
if(m_pasted_content.count()) if(m_pasted_content.count())
{ {
QSettings settings;
bool erase_label = settings.value("diagramcommands/erase-label-on-copy", true).toBool();
//Ensure when 'auto_num' is checked, the settings 'save_label' is to true.
//Because in the class PasteDiagramCommand, if the settings 'save_label' is to false,
//the function redo of PasteDiagramCommand, clear the formula and the label of the pasted element
//and so the auto_num below do nothing (there is not a formula to compare)
if(ui->m_auto_num_cb->isChecked())
settings.setValue("diagramcommands/erase-label-on-copy", false);
m_diagram->clearSelection(); m_diagram->clearSelection();
QUndoCommand *undo = new QUndoCommand(tr("Multi-collage")); QUndoCommand *undo = new QUndoCommand(tr("Multi-collage"));
@@ -132,5 +144,6 @@ void MultiPasteDialog::on_m_button_box_accepted()
} }
m_diagram->adjustSceneRect(); m_diagram->adjustSceneRect();
m_accept = true; m_accept = true;
settings.setValue("diagramcommands/erase-label-on-copy", erase_label);
} }
} }

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>261</width> <width>304</width>
<height>136</height> <height>162</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -90,14 +90,14 @@
<item> <item>
<widget class="QCheckBox" name="m_auto_connection_cb"> <widget class="QCheckBox" name="m_auto_connection_cb">
<property name="text"> <property name="text">
<string>Auto-connection</string> <string>Auto-connexion</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="m_auto_num_cb"> <widget class="QCheckBox" name="m_auto_num_cb">
<property name="text"> <property name="text">
<string>Auto-numérotation des éléments (experimental)</string> <string>Auto-numérotation des éléments</string>
</property> </property>
</widget> </widget>
</item> </item>