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