Add initial support of texts group

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5117 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2017-11-27 19:37:39 +00:00
parent d31d360340
commit 2bf4e330f4
18 changed files with 1266 additions and 87 deletions

View File

@@ -26,6 +26,7 @@
#include "qeticons.h"
#include "dynamicelementtextitemeditor.h"
#include "dynamicelementtextitem.h"
#include "elementtextitemgroup.h"
#include <QVBoxLayout>
#include <QLabel>
@@ -68,6 +69,28 @@ ElementPropertiesWidget::ElementPropertiesWidget(DynamicElementTextItem *text, Q
}
}
/**
* @brief ElementPropertiesWidget::ElementPropertiesWidget
* Same as default constructor, the edited element, is the parent element of @group.
* The only difference with default constructor, is that the current tab is the tab for dynamic texts,
* and the item in the tree that represent @group is expanded and selected.
* @param group
* @param parent
*/
ElementPropertiesWidget::ElementPropertiesWidget(ElementTextItemGroup *group, QWidget *parent) :
AbstractElementPropertiesEditorWidget (parent),
m_tab (nullptr),
m_general_widget(nullptr)
{
if(group->parentItem() && group->parentItem()->type() == Element::Type)
{
Element *elmt = static_cast<Element *>(group->parentItem());
m_diagram = elmt->diagram();
buildGui();
setTextsGroup(group);
}
}
/**
* @brief ElementPropertiesWidget::setElement
* Set @element to be the edited element
@@ -118,6 +141,29 @@ void ElementPropertiesWidget::setDynamicText(DynamicElementTextItem *text)
}
}
/**
* @brief ElementPropertiesWidget::setTextsGroup
* Conveniance function : same as call : ElementPropertiesWidget::setElement, with parameter the parent element of @group.
* Set the dynamics text tab as current tab, expand and select the item that represent @group
* @param group
*/
void ElementPropertiesWidget::setTextsGroup(ElementTextItemGroup *group)
{
if(group->parentItem() && group->parentItem()->type() == Element::Type)
{
setElement(static_cast<Element *>(group->parentItem()));
for(AbstractElementPropertiesEditorWidget *aepew : m_list_editor)
{
if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor")
{
DynamicElementTextItemEditor *detie = static_cast<DynamicElementTextItemEditor *>(aepew);
m_tab->setCurrentWidget(detie);
detie->setCurrentGroup(group);
}
}
}
}
/**
* @brief ElementPropertiesWidget::apply
* Apply the new properties by pushing an undo command