mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Update new composer item Rendering group box
- Set form layout to match others in composer - Add companion spin box for transparency slider - Add syncGroup property for collapsible group box functionality - Clean up some old commented-out code (replaced by QgsColorButton with alpha support)
This commit is contained in:
parent
bf0e8c516f
commit
facbff73b8
@ -48,6 +48,8 @@ QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem*
|
||||
setValuesForGuiElements();
|
||||
connect( mItem, SIGNAL( sizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) );
|
||||
|
||||
connect( mTransparencySlider, SIGNAL( valueChanged( int ) ), mTransparencySpnBx, SLOT( setValue( int ) ) );
|
||||
connect( mTransparencySpnBx, SIGNAL( valueChanged( int ) ), mTransparencySlider, SLOT( setValue( int ) ) );
|
||||
}
|
||||
|
||||
QgsComposerItemWidget::QgsComposerItemWidget(): QWidget( 0 ), mItem( 0 )
|
||||
@ -99,9 +101,7 @@ void QgsComposerItemWidget::on_mBackgroundColorButton_colorChanged( const QColor
|
||||
{
|
||||
return;
|
||||
}
|
||||
// QColor newColor( newBackgroundColor );
|
||||
mItem->beginCommand( tr( "Background color changed" ) );
|
||||
// newColor.setAlpha( 255 - ( mTransparencySpinBox->value() * 2.55 ) );
|
||||
mItem->setBackgroundColor( newBackgroundColor );
|
||||
|
||||
//if the item is a composer map, we need to regenerate the map image
|
||||
@ -115,40 +115,6 @@ void QgsComposerItemWidget::on_mBackgroundColorButton_colorChanged( const QColor
|
||||
mItem->endCommand();
|
||||
}
|
||||
|
||||
//void QgsComposerItemWidget::on_mTransparencySpinBox_valueChanged( int value )
|
||||
//{
|
||||
// if ( !mItem )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// mTransparencySlider->blockSignals( true );
|
||||
// mTransparencySlider->setValue( value );
|
||||
// mTransparencySlider->blockSignals( false );
|
||||
// changeItemTransparency( value );
|
||||
//}
|
||||
|
||||
//void QgsComposerItemWidget::on_mTransparencySlider_valueChanged( int value )
|
||||
//{
|
||||
// if ( !mItem )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// // do item updates only off of mTransparencySpinBox valueChanged
|
||||
// mTransparencySpinBox->setValue( value );
|
||||
//}
|
||||
|
||||
//void QgsComposerItemWidget::changeItemTransparency( int value )
|
||||
//{
|
||||
// mItem->beginCommand( tr( "Item transparency changed" ) );
|
||||
// QBrush itemBrush = mItem->brush();
|
||||
// QColor brushColor = itemBrush.color();
|
||||
// brushColor.setAlpha( 255 - ( value * 2.55 ) );
|
||||
// mItem->setBrush( QBrush( brushColor ) );
|
||||
// mItem->update();
|
||||
// mItem->endCommand();
|
||||
//}
|
||||
|
||||
void QgsComposerItemWidget::changeItemPosition()
|
||||
{
|
||||
mItem->beginCommand( tr( "Item position changed" ) );
|
||||
@ -358,7 +324,6 @@ void QgsComposerItemWidget::setValuesForGuiElements()
|
||||
|
||||
setValuesForGuiPositionElements();
|
||||
|
||||
// mTransparencySlider->blockSignals( true );
|
||||
mOutlineWidthSpinBox->blockSignals( true );
|
||||
mFrameGroupBox->blockSignals( true );
|
||||
mBackgroundGroupBox->blockSignals( true );
|
||||
@ -366,15 +331,11 @@ void QgsComposerItemWidget::setValuesForGuiElements()
|
||||
mItemUuidLineEdit->blockSignals( true );
|
||||
mBlendModeCombo->blockSignals( true );
|
||||
mTransparencySlider->blockSignals( true );
|
||||
// mTransparencySpinBox->blockSignals( true );
|
||||
mTransparencySpnBx->blockSignals( true );
|
||||
|
||||
mBackgroundColorButton->setColor( mItem->brush().color() );
|
||||
mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
|
||||
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
|
||||
// int alphaPercent = ( 255 - mItem->brush().color().alpha() ) / 2.55;
|
||||
// mTransparencySpinBox->setValue( alphaPercent );
|
||||
// mTransparencySlider->setValue( alphaPercent );
|
||||
|
||||
mFrameColorButton->setColor( mItem->pen().color() );
|
||||
mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) );
|
||||
mFrameColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
|
||||
@ -385,8 +346,8 @@ void QgsComposerItemWidget::setValuesForGuiElements()
|
||||
mBackgroundGroupBox->setChecked( mItem->hasBackground() );
|
||||
mBlendModeCombo->setBlendMode( mItem->blendMode() );
|
||||
mTransparencySlider->setValue( mItem->transparency() );
|
||||
mTransparencySpnBx->setValue( mItem->transparency() );
|
||||
|
||||
// mTransparencySlider->blockSignals( false );
|
||||
mOutlineWidthSpinBox->blockSignals( false );
|
||||
mFrameGroupBox->blockSignals( false );
|
||||
mBackgroundGroupBox->blockSignals( false );
|
||||
@ -394,7 +355,7 @@ void QgsComposerItemWidget::setValuesForGuiElements()
|
||||
mItemUuidLineEdit->blockSignals( false );
|
||||
mBlendModeCombo->blockSignals( false );
|
||||
mTransparencySlider->blockSignals( false );
|
||||
// mTransparencySpinBox->blockSignals( false );
|
||||
mTransparencySpnBx->blockSignals( false );
|
||||
}
|
||||
|
||||
void QgsComposerItemWidget::on_mBlendModeCombo_currentIndexChanged( int index )
|
||||
|
@ -345,7 +345,16 @@
|
||||
<property name="collapsed" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="syncGroup" stdset="0">
|
||||
<string notr="true">composeritem</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelBlendMode">
|
||||
<property name="text">
|
||||
@ -364,14 +373,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="mTransparencySlider">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSlider" name="mTransparencySlider">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="mTransparencySpnBx">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -400,17 +420,17 @@
|
||||
<extends>QPushButton</extends>
|
||||
<header>qgscolorbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsBlendModeComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>qgsblendmodecombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsCollapsibleGroupBoxBasic</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header location="global">qgscollapsiblegroupbox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsBlendModeComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>qgsblendmodecombobox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user