mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Element panel widget : Add item to the QTreeView when create a new element or a new directory
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4556 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -367,9 +367,8 @@ void ElementsCollectionWidget::newDirectory()
|
|||||||
|
|
||||||
ElementsLocation location(feci->collectionPath());
|
ElementsLocation location(feci->collectionPath());
|
||||||
ElementsCategoryEditor new_dir_editor(location, false, this);
|
ElementsCategoryEditor new_dir_editor(location, false, this);
|
||||||
if (new_dir_editor.exec() == QDialog::Accepted) {
|
if (new_dir_editor.exec() == QDialog::Accepted)
|
||||||
reload();
|
m_model->addLocation(new_dir_editor.createdLocation());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -393,6 +392,9 @@ void ElementsCollectionWidget::newElement()
|
|||||||
ElementsLocation loc(feci->collectionPath());
|
ElementsLocation loc(feci->collectionPath());
|
||||||
elmt_wizard.preselectedLocation(loc);
|
elmt_wizard.preselectedLocation(loc);
|
||||||
elmt_wizard.exec();
|
elmt_wizard.exec();
|
||||||
|
|
||||||
|
foreach (QETElementEditor *element_editor, QETApp::instance()->elementEditors())
|
||||||
|
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -85,6 +85,15 @@ ElementsCategoryEditor::ElementsCategoryEditor(const ElementsLocation &location,
|
|||||||
ElementsCategoryEditor::~ElementsCategoryEditor() {
|
ElementsCategoryEditor::~ElementsCategoryEditor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ElementsCategoryEditor::createdLocation
|
||||||
|
* @return the location of the created directory
|
||||||
|
*/
|
||||||
|
ElementsLocation ElementsCategoryEditor::createdLocation() const
|
||||||
|
{
|
||||||
|
return m_created_location;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ElementsCategoryEditor::setUpWidget
|
* @brief ElementsCategoryEditor::setUpWidget
|
||||||
*/
|
*/
|
||||||
@@ -150,8 +159,8 @@ void ElementsCategoryEditor::acceptCreation()
|
|||||||
|
|
||||||
ElementCollectionHandler ech_;
|
ElementCollectionHandler ech_;
|
||||||
NamesList nl = m_names_list->names();
|
NamesList nl = m_names_list->names();
|
||||||
ElementsLocation loc = ech_.createDir(m_location, dirname, nl);
|
m_created_location = ech_.createDir(m_location, dirname, nl);
|
||||||
if (loc.isNull()) {
|
if (m_created_location.isNull()) {
|
||||||
QET::QetMessageBox::critical(this,
|
QET::QetMessageBox::critical(this,
|
||||||
tr("Erreur", "message box title"),
|
tr("Erreur", "message box title"),
|
||||||
tr("Impossible de créer la catégorie", "message box content"));
|
tr("Impossible de créer la catégorie", "message box content"));
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class ElementsCategoryEditor : public QDialog
|
|||||||
ElementsCategoryEditor(const ElementsLocation &location, bool edit = true, QWidget *parent = nullptr);
|
ElementsCategoryEditor(const ElementsLocation &location, bool edit = true, QWidget *parent = nullptr);
|
||||||
virtual ~ElementsCategoryEditor();
|
virtual ~ElementsCategoryEditor();
|
||||||
|
|
||||||
|
ElementsLocation createdLocation() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ElementsCategoryEditor(const ElementsCategoryEditor &);
|
ElementsCategoryEditor(const ElementsCategoryEditor &);
|
||||||
|
|
||||||
@@ -48,6 +50,7 @@ class ElementsCategoryEditor : public QDialog
|
|||||||
QFileNameEdit *m_file_line_edit;
|
QFileNameEdit *m_file_line_edit;
|
||||||
bool m_edit_mode;
|
bool m_edit_mode;
|
||||||
ElementsLocation m_location;
|
ElementsLocation m_location;
|
||||||
|
ElementsLocation m_created_location;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setUpWidget();
|
void setUpWidget();
|
||||||
|
|||||||
Reference in New Issue
Block a user