diff --git a/glabels/ObjectEditor.cpp b/glabels/ObjectEditor.cpp index 7181c8e..37a3efb 100644 --- a/glabels/ObjectEditor.cpp +++ b/glabels/ObjectEditor.cpp @@ -62,6 +62,7 @@ ObjectEditor::ObjectEditor( QWidget *parent ) textColorButton->init( "Default", QColor(0,0,0,255), QColor(0,0,0,255) ); shadowColorButton->init( "Default", QColor(0,0,0,255), QColor(0,0,0,255) ); + textInsertFieldCombo->setName( "Insert Field" ); imageFieldCombo->setName( "Key" ); setEnabled( false ); @@ -420,6 +421,7 @@ void ObjectEditor::onMergeSourceChanged() QStringList keys = mModel->merge()->keys(); lineColorButton->setKeys( keys ); fillColorButton->setKeys( keys ); + textInsertFieldCombo->setKeys( keys ); imageFieldCombo->setKeys( keys ); shadowColorButton->setKeys( keys ); } @@ -501,7 +503,7 @@ void ObjectEditor::onImageFileButtonClicked() } -void ObjectEditor::onImageKeySelected(QString key ) +void ObjectEditor::onImageKeySelected( QString key ) { qDebug() << "Key = " << key; } @@ -601,6 +603,12 @@ void ObjectEditor::onTextControlsChanged() } +void ObjectEditor::onTextInsertFieldKeySelected( QString key ) +{ + textEdit->insertPlainText( "${" + key + "}" ); +} + + void ObjectEditor::onShadowControlsChanged() { if ( !mBlocked ) diff --git a/glabels/ObjectEditor.h b/glabels/ObjectEditor.h index 84c43c0..f6c7f58 100644 --- a/glabels/ObjectEditor.h +++ b/glabels/ObjectEditor.h @@ -81,11 +81,12 @@ private slots: void onLineControlsChanged(); void onFillControlsChanged(); void onImageFileButtonClicked(); - void onImageKeySelected(QString key ); + void onImageKeySelected( QString key ); void onPositionControlsChanged(); void onRectSizeControlsChanged(); void onLineSizeControlsChanged(); void onTextControlsChanged(); + void onTextInsertFieldKeySelected( QString key ); void onShadowControlsChanged(); void onChanged(); diff --git a/glabels/ui/ObjectEditor.ui b/glabels/ui/ObjectEditor.ui index 23cb08e..f87bbd0 100644 --- a/glabels/ui/ObjectEditor.ui +++ b/glabels/ui/ObjectEditor.ui @@ -486,11 +486,7 @@ - - - - - + @@ -1749,7 +1745,7 @@ onTextControlsChanged() - 180 + 173 389 @@ -1758,22 +1754,6 @@ - - textInsertFieldButton - keySelected() - ObjectEditor - onChanged() - - - 215 - 652 - - - 396 - 638 - - - barcodeTypeCombo currentIndexChanged(int) @@ -2190,6 +2170,22 @@ + + textInsertFieldCombo + keySelected(QString) + ObjectEditor + onTextInsertFieldKeySelected(QString) + + + 231 + 653 + + + 395 + 645 + + + onChanged() @@ -2203,5 +2199,6 @@ onImageFileButtonClicked() onImageKeySelected(QString) onTextControlsChanged() + onTextInsertFieldKeySelected(QString)