Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
UI enable/disable works
  • Loading branch information
olivierdalang committed Jan 29, 2013
1 parent 94491b8 commit f150fb8
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 79 deletions.
40 changes: 40 additions & 0 deletions src/app/composer/qgscomposerlabelwidget.cpp
Expand Up @@ -32,13 +32,53 @@ QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QWidg
QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
toolBox->addItem( itemPropertiesWidget, tr( "General options" ) );


if ( mComposerLabel )
{
setGuiElementValues();
connect( mComposerLabel, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
}
}

void QgsComposerLabelWidget::on_mHtmlCheckBox_stateChanged( int state )
{
if ( mComposerLabel )
{
if (state)
{
mFontButton->setEnabled( false );
mFontColorButton->setEnabled( false );
mHorizontalAlignementGroup->setEnabled( false );
mVerticalAlignementGroup->setEnabled( false );
mMarginDoubleSpinBox->setEnabled( false );
mRotationSpinBox->setEnabled( false );
mComposerLabel->beginCommand( tr( "Label text HTML state changed" ), QgsComposerMergeCommand::ComposerLabelSetText );
mComposerLabel->blockSignals( true );
//mComposerLabel->setHtml(state);
mComposerLabel->setText( mTextEdit->toPlainText() );
mComposerLabel->update();
mComposerLabel->blockSignals( false );
mComposerLabel->endCommand();
}
else
{
mFontButton->setEnabled( true );
mFontColorButton->setEnabled( true );
mHorizontalAlignementGroup->setEnabled( true );
mVerticalAlignementGroup->setEnabled( true );
mMarginDoubleSpinBox->setEnabled( true );
mRotationSpinBox->setEnabled( true );
mComposerLabel->beginCommand( tr( "Label text HTML state changed" ), QgsComposerMergeCommand::ComposerLabelSetText );
mComposerLabel->blockSignals( true );
//mComposerLabel->setHtml(state);
mComposerLabel->setText( mTextEdit->toPlainText() );
mComposerLabel->update();
mComposerLabel->blockSignals( false );
mComposerLabel->endCommand();
}
}
}

void QgsComposerLabelWidget::on_mTextEdit_textChanged()
{
if ( mComposerLabel )
Expand Down
1 change: 1 addition & 0 deletions src/app/composer/qgscomposerlabelwidget.h
Expand Up @@ -32,6 +32,7 @@ class QgsComposerLabelWidget: public QWidget, private Ui::QgsComposerLabelWidget
QgsComposerLabelWidget( QgsComposerLabel* label );

public slots:
void on_mHtmlCheckBox_stateChanged( int i );
void on_mTextEdit_textChanged();
void on_mFontButton_clicked();
void on_mInsertExpressionButton_clicked();
Expand Down
31 changes: 22 additions & 9 deletions src/ui/qgscomposerhtmlwidgetbase.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>243</width>
<height>116</height>
<height>153</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -24,41 +24,54 @@
<rect>
<x>0</x>
<y>0</y>
<width>225</width>
<height>72</height>
<width>221</width>
<height>100</height>
</rect>
</property>
<attribute name="label">
<string>HTML</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<item row="2" column="2">
<widget class="QToolButton" name="mFileToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLineEdit" name="mUrlLineEdit"/>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="mUrlLabel">
<property name="text">
<string>URL</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="mResizeModeComboBox"/>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mResizeModeLabel">
<property name="text">
<string>Resize mode</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="mResizeModeComboBox"/>
</item>
</layout>
</widget>
</widget>
Expand Down

0 comments on commit f150fb8

Please sign in to comment.