Skip to content

Commit

Permalink
upgraded to collapsible groupboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierdalang committed Jan 29, 2013
1 parent 45a5fe7 commit b642722
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 61 deletions.
44 changes: 11 additions & 33 deletions src/app/composer/qgscomposeritemwidget.cpp
Expand Up @@ -140,46 +140,28 @@ void QgsComposerItemWidget::on_mOutlineWidthSpinBox_valueChanged( double d )
mItem->endCommand();
}

void QgsComposerItemWidget::on_mFrameCheckBox_stateChanged( int state )
void QgsComposerItemWidget::on_mFrameGroupBox_toggled( bool state )
{
if ( !mItem )
{
return;
}

mItem->beginCommand( tr( "Item frame toggled" ) );
if ( state == Qt::Checked )
{
mFrameBox->setEnabled( true );
mItem->setFrameEnabled( true );
}
else
{
mFrameBox->setEnabled( false );
mItem->setFrameEnabled( false );
}
mItem->setFrameEnabled( state );
mItem->update();
mItem->endCommand();
}

void QgsComposerItemWidget::on_mBackgroundCheckBox_stateChanged( int state )
void QgsComposerItemWidget::on_mBackgroundGroupBox_toggled( bool state )
{
if ( !mItem )
{
return;
}

mItem->beginCommand( tr( "Item background toggled" ) );
if ( state == Qt::Checked )
{
mBackgroundBox->setEnabled( true );
mItem->setBackgroundEnabled( true );
}
else
{
mBackgroundBox->setEnabled( false );
mItem->setBackgroundEnabled( false );
}
mItem->setBackgroundEnabled( state );
mItem->update();
mItem->endCommand();
}
Expand All @@ -193,26 +175,22 @@ void QgsComposerItemWidget::setValuesForGuiElements()

mOpacitySlider->blockSignals( true );
mOutlineWidthSpinBox->blockSignals( true );
mFrameCheckBox->blockSignals( true );
mFrameGroupBox->blockSignals( true );
mBackgroundGroupBox->blockSignals( true );
mItemIdLineEdit->blockSignals( true );
mOpacitySpinBox->blockSignals( true );

mOpacitySpinBox->setValue( mItem->brush().color().alpha() );
mOpacitySlider->setValue( mItem->brush().color().alpha() );
mOutlineWidthSpinBox->setValue( mItem->pen().widthF() );
mItemIdLineEdit->setText( mItem->id() );
if ( mItem->hasFrame() )
{
mFrameCheckBox->setCheckState( Qt::Checked );
}
else
{
mFrameCheckBox->setCheckState( Qt::Unchecked );
}

mFrameGroupBox->setChecked( mItem->hasFrame() );
mBackgroundGroupBox->setChecked( mItem->hasBackground() );

mOpacitySlider->blockSignals( false );
mOutlineWidthSpinBox->blockSignals( false );
mFrameCheckBox->blockSignals( false );
mFrameGroupBox->blockSignals( false );
mBackgroundGroupBox->blockSignals( false );
mItemIdLineEdit->blockSignals( false );
mOpacitySpinBox->blockSignals( false );
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/composer/qgscomposeritemwidget.h
Expand Up @@ -37,8 +37,8 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa
void on_mOpacitySlider_sliderReleased();
void on_mOpacitySpinBox_valueChanged( int value );
void on_mOutlineWidthSpinBox_valueChanged( double d );
void on_mFrameCheckBox_stateChanged( int state );
void on_mBackgroundCheckBox_stateChanged( int state );
void on_mFrameGroupBox_toggled( bool state );
void on_mBackgroundGroupBox_toggled( bool state );
void on_mPositionButton_clicked();
void on_mItemIdLineEdit_textChanged( const QString& text );

Expand Down
61 changes: 35 additions & 26 deletions src/ui/qgscomposeritemwidgetbase.ui
Expand Up @@ -14,17 +14,23 @@
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="1" column="0">
<widget class="QCheckBox" name="mFrameCheckBox">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="mPositionButton">
<property name="text">
<string>Show frame</string>
<string>Position and size...</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="mFrameBox">
<item row="1" column="0" colspan="2">
<widget class="QgsCollapsibleGroupBox" name="mFrameGroupBox">
<property name="title">
<string>Frame settings</string>
<string>Show frame</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
Expand Down Expand Up @@ -53,17 +59,19 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="mBackgroundCheckBox">
<property name="text">
<item row="2" column="0" colspan="2">
<widget class="QgsCollapsibleGroupBox" name="mBackgroundGroupBox">
<property name="title">
<string>Show background</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="mBackgroundBox">
<property name="title">
<string>Background settings</string>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
Expand Down Expand Up @@ -106,20 +114,20 @@
</layout>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout"/>
</item>
<item row="7" column="0">
<item row="5" column="0">
<widget class="QLabel" name="mIdLabel">
<property name="text">
<string>Item ID</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="5" column="1">
<widget class="QLineEdit" name="mItemIdLineEdit"/>
</item>
<item row="8" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand All @@ -132,15 +140,16 @@
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="mPositionButton">
<property name="text">
<string>Position and size...</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QGroupBox</extends>
<header>qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
Expand Down

0 comments on commit b642722

Please sign in to comment.