Hooked up position controls in object editor. Added recursion block.
This commit is contained in:
@@ -35,7 +35,7 @@ namespace glabels
|
||||
/// Constructor
|
||||
///
|
||||
ObjectEditor::ObjectEditor( QWidget *parent )
|
||||
: mModel(0), mObject(0)
|
||||
: mModel(0), mObject(0), mBlocked(false)
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
@@ -51,8 +51,10 @@ namespace glabels
|
||||
{
|
||||
mModel = model;
|
||||
|
||||
connect( mModel, SIGNAL(sizeChanged()), this, SLOT(onLabelSizeChanged()) );
|
||||
connect( mModel, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()) );
|
||||
|
||||
onLabelSizeChanged();
|
||||
onSelectionChanged();
|
||||
}
|
||||
|
||||
@@ -70,9 +72,44 @@ namespace glabels
|
||||
|
||||
void ObjectEditor::loadLineFillPage()
|
||||
{
|
||||
if ( mObject )
|
||||
{
|
||||
mBlocked = true;
|
||||
|
||||
lineWidthSpin->setValue( mObject->lineWidth() );
|
||||
lineColorButton->setColorNode( mObject->lineColorNode() );
|
||||
fillColorButton->setColorNode( mObject->fillColorNode() );
|
||||
|
||||
mBlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObjectEditor::loadPositionPage()
|
||||
{
|
||||
if ( mObject )
|
||||
{
|
||||
mBlocked = true;
|
||||
|
||||
posXSpin->setValue( mObject->x0() );
|
||||
posYSpin->setValue( mObject->y0() );
|
||||
|
||||
mBlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObjectEditor::onLabelSizeChanged()
|
||||
{
|
||||
if ( mModel )
|
||||
{
|
||||
mBlocked = true;
|
||||
|
||||
posXSpin->setRange( -mModel->w(), 2*mModel->w() );
|
||||
posYSpin->setRange( -mModel->h(), 2*mModel->h() );
|
||||
|
||||
mBlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +140,7 @@ namespace glabels
|
||||
sizeLineFrame->setVisible( false );
|
||||
|
||||
loadLineFillPage();
|
||||
loadPositionPage();
|
||||
|
||||
setEnabled( true );
|
||||
}
|
||||
@@ -127,26 +165,58 @@ namespace glabels
|
||||
|
||||
void ObjectEditor::onObjectChanged()
|
||||
{
|
||||
qDebug() << "Object changed.";
|
||||
if ( !mBlocked )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObjectEditor::onObjectMoved()
|
||||
{
|
||||
qDebug() << "Object moved.";
|
||||
if ( !mBlocked )
|
||||
{
|
||||
loadPositionPage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObjectEditor::onLineControlsChanged()
|
||||
{
|
||||
if ( !mBlocked )
|
||||
{
|
||||
mBlocked = true;
|
||||
|
||||
mObject->setLineWidth( lineWidthSpin->value() );
|
||||
mObject->setLineColorNode( lineColorButton->colorNode() );
|
||||
|
||||
mBlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObjectEditor::onFillControlsChanged()
|
||||
{
|
||||
if ( !mBlocked )
|
||||
{
|
||||
mBlocked = true;
|
||||
|
||||
mObject->setFillColorNode( fillColorButton->colorNode() );
|
||||
|
||||
mBlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObjectEditor::onPositionControlsChanged()
|
||||
{
|
||||
if ( !mBlocked )
|
||||
{
|
||||
mBlocked = true;
|
||||
|
||||
mObject->setPosition( posXSpin->value(), posYSpin->value() );
|
||||
|
||||
mBlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,17 +57,20 @@ namespace glabels
|
||||
private:
|
||||
void hidePages();
|
||||
void loadLineFillPage();
|
||||
void loadPositionPage();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onLabelSizeChanged();
|
||||
void onSelectionChanged();
|
||||
void onObjectChanged();
|
||||
void onObjectMoved();
|
||||
void onLineControlsChanged();
|
||||
void onFillControlsChanged();
|
||||
void onPositionControlsChanged();
|
||||
void onChanged();
|
||||
|
||||
|
||||
@@ -77,6 +80,7 @@ namespace glabels
|
||||
private:
|
||||
LabelModel* mModel;
|
||||
LabelModelObject* mObject;
|
||||
bool mBlocked;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QTabWidget" name="notebook">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="textPage">
|
||||
<attribute name="title">
|
||||
@@ -1855,15 +1855,15 @@
|
||||
<sender>posXSpin</sender>
|
||||
<signal>valueChanged(double)</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onChanged()</slot>
|
||||
<slot>onPositionControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>90</x>
|
||||
<y>112</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>400</x>
|
||||
<y>90</y>
|
||||
<x>399</x>
|
||||
<y>89</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -1871,7 +1871,7 @@
|
||||
<sender>posYSpin</sender>
|
||||
<signal>valueChanged(double)</signal>
|
||||
<receiver>ObjectEditor</receiver>
|
||||
<slot>onChanged()</slot>
|
||||
<slot>onPositionControlsChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>112</x>
|
||||
@@ -2065,5 +2065,6 @@
|
||||
<slot>onResetImageSize()</slot>
|
||||
<slot>onLineControlsChanged()</slot>
|
||||
<slot>onFillControlsChanged()</slot>
|
||||
<slot>onPositionControlsChanged()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user