mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
The TitleBlockPropertiesWidget class was unable to load a diagram context apart from the one passed to the constructor.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1883 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -125,6 +125,32 @@ void TitleBlockPropertiesWidget::setTitleBlockProperties(const TitleBlockPropert
|
|||||||
titleblock_template_name -> setCurrentIndex(matching_index);
|
titleblock_template_name -> setCurrentIndex(matching_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDiagramContext(titleblock.context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clear the custom variables list.
|
||||||
|
*/
|
||||||
|
void TitleBlockPropertiesWidget::clearDiagramContext() {
|
||||||
|
additional_fields_table -> clearContents();
|
||||||
|
for (int i = 1 ; i < additional_fields_table -> rowCount() ; ++ i) {
|
||||||
|
additional_fields_table -> removeRow(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clear the custom variables table then add the key/value pairs from \a context to it.
|
||||||
|
*/
|
||||||
|
void TitleBlockPropertiesWidget::setDiagramContext(const DiagramContext &context) {
|
||||||
|
clearDiagramContext();
|
||||||
|
int i = 0;
|
||||||
|
foreach (QString key, context.keys()) {
|
||||||
|
additional_fields_table -> setItem(i, 0, new QTableWidgetItem(key));
|
||||||
|
additional_fields_table -> setItem(i, 1, new QTableWidgetItem(context[key].toString()));
|
||||||
|
++ i;
|
||||||
|
}
|
||||||
|
checkTableRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -348,17 +374,12 @@ void TitleBlockPropertiesWidget::initWidgets(const TitleBlockProperties &titlebl
|
|||||||
additional_fields_format_label -> setWordWrap(true);
|
additional_fields_format_label -> setWordWrap(true);
|
||||||
additional_fields_format_label -> setAlignment(Qt::AlignJustify);
|
additional_fields_format_label -> setAlignment(Qt::AlignJustify);
|
||||||
|
|
||||||
int num_rows = titleblock.context.keys().count() + 1;
|
additional_fields_table = new QTableWidget(0, 2);
|
||||||
additional_fields_table = new QTableWidget(num_rows, 2);
|
additional_fields_table -> setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
additional_fields_table -> setHorizontalHeaderLabels(QStringList() << tr("Nom") << tr("Valeur"));
|
additional_fields_table -> setHorizontalHeaderLabels(QStringList() << tr("Nom") << tr("Valeur"));
|
||||||
additional_fields_table -> horizontalHeader() -> setStretchLastSection(true);
|
additional_fields_table -> horizontalHeader() -> setStretchLastSection(true);
|
||||||
|
|
||||||
int i = 0;
|
setDiagramContext(titleblock.context);
|
||||||
foreach (QString key, titleblock.context.keys()) {
|
|
||||||
additional_fields_table -> setItem(i, 0, new QTableWidgetItem(key));
|
|
||||||
additional_fields_table -> setItem(i, 1, new QTableWidgetItem(titleblock.context[key].toString()));
|
|
||||||
++ i;
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshFieldsFormatLabel();
|
refreshFieldsFormatLabel();
|
||||||
connect(additional_fields_table, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(checkTableRows()));
|
connect(additional_fields_table, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(checkTableRows()));
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ class TitleBlockPropertiesWidget : public QWidget {
|
|||||||
public:
|
public:
|
||||||
TitleBlockProperties titleBlockProperties() const;
|
TitleBlockProperties titleBlockProperties() const;
|
||||||
void setTitleBlockProperties(const TitleBlockProperties &);
|
void setTitleBlockProperties(const TitleBlockProperties &);
|
||||||
|
void clearDiagramContext();
|
||||||
|
void setDiagramContext(const DiagramContext &);
|
||||||
bool displayCurrentDate() const;
|
bool displayCurrentDate() const;
|
||||||
bool isReadOnly() const;
|
bool isReadOnly() const;
|
||||||
void setReadOnly(bool);
|
void setReadOnly(bool);
|
||||||
|
|||||||
Reference in New Issue
Block a user