Prepare: On changeCurrentTitleBlockTemplate combobox load the fields of the template to additional_fields_

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2114 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
cfdev
2013-04-15 20:44:19 +00:00
parent f8f4dbaaca
commit e7ac7c9c40
4 changed files with 43 additions and 0 deletions

View File

@@ -19,6 +19,8 @@
#include "diagramcontextwidget.h"
#include "qeticons.h"
#include "templatescollection.h"
#include "titleblocktemplate.h"
/**
Constructeur
@param titleblock TitleBlockProperties a afficher
@@ -248,6 +250,26 @@ void TitleBlockPropertiesWidget::duplicateCurrentTitleBlockTemplate() {
emit(editTitleBlockTemplate(currentTitleBlockTemplateName(), true));
}
/**
* @brief changeCurrentTitleBlockTemplate load the fields of the template to additional_fields_
* @param text
*/
void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(QString text) {
// delete all entry
additional_fields_ -> clear() ;
// get template
TitleBlockTemplate *tpl = tbt_collection_ -> getTemplate( text );
if(tpl != 0) {
// get all template fields
QStringList fields = tpl -> listOfVariables();
// set fields to additional_fields_ widget
DiagramContext templateContext;
for(int i =0; i<fields.count(); i++)
templateContext.addValue(fields.at(i), "");
setDiagramContext(templateContext);
}
}
/**
Builds the various child widgets for this widget
*/
@@ -267,6 +289,7 @@ void TitleBlockPropertiesWidget::initWidgets(const TitleBlockProperties &titlebl
// widgets
titleblock_template_label = new QLabel(tr("Mod\350le :"), this);
titleblock_template_name = new QComboBox(this);
connect(titleblock_template_name, SIGNAL(currentIndexChanged(QString)),this, SLOT(changeCurrentTitleBlockTemplate(QString)) );
titleblock_template_button_ = new QPushButton(QET::Icons::TitleBlock, QString());
titleblock_template_button_ -> setMenu(titleblock_template_menu_);