Implemented "Insert field" button.

This commit is contained in:
Jim Evins
2016-12-31 18:02:56 -05:00
parent aa11fcc4e6
commit d5508a2862
3 changed files with 30 additions and 24 deletions
+9 -1
View File
@@ -62,6 +62,7 @@ ObjectEditor::ObjectEditor( QWidget *parent )
textColorButton->init( "Default", QColor(0,0,0,255), QColor(0,0,0,255) ); 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) ); shadowColorButton->init( "Default", QColor(0,0,0,255), QColor(0,0,0,255) );
textInsertFieldCombo->setName( "Insert Field" );
imageFieldCombo->setName( "Key" ); imageFieldCombo->setName( "Key" );
setEnabled( false ); setEnabled( false );
@@ -420,6 +421,7 @@ void ObjectEditor::onMergeSourceChanged()
QStringList keys = mModel->merge()->keys(); QStringList keys = mModel->merge()->keys();
lineColorButton->setKeys( keys ); lineColorButton->setKeys( keys );
fillColorButton->setKeys( keys ); fillColorButton->setKeys( keys );
textInsertFieldCombo->setKeys( keys );
imageFieldCombo->setKeys( keys ); imageFieldCombo->setKeys( keys );
shadowColorButton->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; qDebug() << "Key = " << key;
} }
@@ -601,6 +603,12 @@ void ObjectEditor::onTextControlsChanged()
} }
void ObjectEditor::onTextInsertFieldKeySelected( QString key )
{
textEdit->insertPlainText( "${" + key + "}" );
}
void ObjectEditor::onShadowControlsChanged() void ObjectEditor::onShadowControlsChanged()
{ {
if ( !mBlocked ) if ( !mBlocked )
+2 -1
View File
@@ -81,11 +81,12 @@ private slots:
void onLineControlsChanged(); void onLineControlsChanged();
void onFillControlsChanged(); void onFillControlsChanged();
void onImageFileButtonClicked(); void onImageFileButtonClicked();
void onImageKeySelected(QString key ); void onImageKeySelected( QString key );
void onPositionControlsChanged(); void onPositionControlsChanged();
void onRectSizeControlsChanged(); void onRectSizeControlsChanged();
void onLineSizeControlsChanged(); void onLineSizeControlsChanged();
void onTextControlsChanged(); void onTextControlsChanged();
void onTextInsertFieldKeySelected( QString key );
void onShadowControlsChanged(); void onShadowControlsChanged();
void onChanged(); void onChanged();
+19 -22
View File
@@ -486,11 +486,7 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="textInsertFieldButton"> <widget class="FieldButton" name="textInsertFieldCombo"/>
<property name="text">
<string/>
</property>
</widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
@@ -1749,7 +1745,7 @@
<slot>onTextControlsChanged()</slot> <slot>onTextControlsChanged()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>180</x> <x>173</x>
<y>389</y> <y>389</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
@@ -1758,22 +1754,6 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>textInsertFieldButton</sender>
<signal>keySelected()</signal>
<receiver>ObjectEditor</receiver>
<slot>onChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>215</x>
<y>652</y>
</hint>
<hint type="destinationlabel">
<x>396</x>
<y>638</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>barcodeTypeCombo</sender> <sender>barcodeTypeCombo</sender>
<signal>currentIndexChanged(int)</signal> <signal>currentIndexChanged(int)</signal>
@@ -2190,6 +2170,22 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>textInsertFieldCombo</sender>
<signal>keySelected(QString)</signal>
<receiver>ObjectEditor</receiver>
<slot>onTextInsertFieldKeySelected(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>231</x>
<y>653</y>
</hint>
<hint type="destinationlabel">
<x>395</x>
<y>645</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>onChanged()</slot> <slot>onChanged()</slot>
@@ -2203,5 +2199,6 @@
<slot>onImageFileButtonClicked()</slot> <slot>onImageFileButtonClicked()</slot>
<slot>onImageKeySelected(QString)</slot> <slot>onImageKeySelected(QString)</slot>
<slot>onTextControlsChanged()</slot> <slot>onTextControlsChanged()</slot>
<slot>onTextInsertFieldKeySelected(QString)</slot>
</slots> </slots>
</ui> </ui>