Skip to content

Commit

Permalink
Start modernising diagram ui
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 22, 2015
1 parent 12d92e4 commit 7ce618a
Show file tree
Hide file tree
Showing 5 changed files with 1,705 additions and 1,037 deletions.
162 changes: 110 additions & 52 deletions src/app/qgsdiagramproperties.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare


setupUi( this ); setupUi( this );


int tabIdx = QSettings().value( "/Windows/VectorLayerProperties/diagram/tab", 0 ).toInt(); // get rid of annoying outer focus rect on Mac
mDiagramOptionsListWidget->setAttribute( Qt::WA_MacShowFocusRect, false );


mDiagramPropertiesTabWidget->setCurrentIndex( tabIdx ); connect( mEnableDiagramsCheckBox, SIGNAL( toggled( bool ) ), mDiagramTypeFrame, SLOT( setEnabled( bool ) ) );
connect( mEnableDiagramsCheckBox, SIGNAL( toggled( bool ) ), mDiagramFrame, SLOT( setEnabled( bool ) ) );


mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) ); mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
mBackgroundColorButton->setAllowAlpha( true ); mBackgroundColorButton->setAllowAlpha( true );
Expand All @@ -74,12 +76,14 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
QGis::GeometryType layerType = layer->geometryType(); QGis::GeometryType layerType = layer->geometryType();
if ( layerType == QGis::UnknownGeometry || layerType == QGis::NoGeometry ) if ( layerType == QGis::UnknownGeometry || layerType == QGis::NoGeometry )
{ {
mDisplayDiagramsGroupBox->setChecked( false ); mEnableDiagramsCheckBox->setChecked( false );
mDisplayDiagramsGroupBox->setEnabled( false ); mEnableDiagramsCheckBox->setEnabled( false );
mDiagramTypeFrame->setEnabled( false );
mDiagramFrame->setEnabled( false );
} }


//insert placement options //insert placement options

mPlacementComboBox->blockSignals( true );
if ( layerType == QGis::Point || layerType == QGis::Polygon ) if ( layerType == QGis::Point || layerType == QGis::Polygon )
{ {
mPlacementComboBox->addItem( tr( "Around Point" ), QgsDiagramLayerSettings::AroundPoint ); mPlacementComboBox->addItem( tr( "Around Point" ), QgsDiagramLayerSettings::AroundPoint );
Expand All @@ -96,6 +100,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
{ {
mPlacementComboBox->addItem( tr( "Free" ), QgsDiagramLayerSettings::Free ); mPlacementComboBox->addItem( tr( "Free" ), QgsDiagramLayerSettings::Free );
} }
mPlacementComboBox->blockSignals( false );


if ( layerType == QGis::Line ) if ( layerType == QGis::Line )
{ {
Expand All @@ -110,12 +115,14 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
mLineOptionsLabel->setVisible( false ); mLineOptionsLabel->setVisible( false );
} }


mDiagramTypeComboBox->blockSignals( true );
QPixmap pix = QgsApplication::getThemePixmap( "pie-chart" ); QPixmap pix = QgsApplication::getThemePixmap( "pie-chart" );
mDiagramTypeComboBox->addItem( pix, tr( "Pie chart" ), DIAGRAM_NAME_PIE ); mDiagramTypeComboBox->addItem( pix, tr( "Pie chart" ), DIAGRAM_NAME_PIE );
pix = QgsApplication::getThemePixmap( "text" ); pix = QgsApplication::getThemePixmap( "text" );
mDiagramTypeComboBox->addItem( pix, tr( "Text diagram" ), DIAGRAM_NAME_TEXT ); mDiagramTypeComboBox->addItem( pix, tr( "Text diagram" ), DIAGRAM_NAME_TEXT );
pix = QgsApplication::getThemePixmap( "histogram" ); pix = QgsApplication::getThemePixmap( "histogram" );
mDiagramTypeComboBox->addItem( pix, tr( "Histogram" ), DIAGRAM_NAME_HISTOGRAM ); mDiagramTypeComboBox->addItem( pix, tr( "Histogram" ), DIAGRAM_NAME_HISTOGRAM );
mDiagramTypeComboBox->blockSignals( false );


mLabelPlacementComboBox->addItem( tr( "Height" ), QgsDiagramSettings::Height ); mLabelPlacementComboBox->addItem( tr( "Height" ), QgsDiagramSettings::Height );
mLabelPlacementComboBox->addItem( tr( "x-height" ), QgsDiagramSettings::XHeight ); mLabelPlacementComboBox->addItem( tr( "x-height" ), QgsDiagramSettings::XHeight );
Expand All @@ -131,6 +138,25 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
mAngleOffsetComboBox->addItem( tr( "Bottom" ), 270 * 16 ); mAngleOffsetComboBox->addItem( tr( "Bottom" ), 270 * 16 );
mAngleOffsetComboBox->addItem( tr( "Left" ), 180 * 16 ); mAngleOffsetComboBox->addItem( tr( "Left" ), 180 * 16 );


QSettings settings;

// reset horiz strech of left side of options splitter (set to 1 for previewing in Qt Designer)
QSizePolicy policy( mDiagramOptionsListFrame->sizePolicy() );
policy.setHorizontalStretch( 0 );
mDiagramOptionsListFrame->setSizePolicy( policy );
if ( !settings.contains( QString( "/Windows/Diagrams/OptionsSplitState" ) ) )
{
// set left list widget width on intial showing
QList<int> splitsizes;
splitsizes << 115;
mDiagramOptionsSplitter->setSizes( splitsizes );
}

// restore dialog, splitters and current tab
mDiagramOptionsSplitter->restoreState( settings.value( QString( "/Windows/Diagrams/OptionsSplitState" ) ).toByteArray() );
mDiagramOptionsListWidget->setCurrentRow( settings.value( QString( "/Windows/Diagrams/Tab" ), 0 ).toInt() );


//insert all attributes into the combo boxes //insert all attributes into the combo boxes
const QgsFields& layerFields = layer->pendingFields(); const QgsFields& layerFields = layer->pendingFields();
for ( int idx = 0; idx < layerFields.count(); ++idx ) for ( int idx = 0; idx < layerFields.count(); ++idx )
Expand All @@ -153,11 +179,17 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
const QgsDiagramRendererV2* dr = layer->diagramRenderer(); const QgsDiagramRendererV2* dr = layer->diagramRenderer();
if ( !dr ) //no diagram renderer yet, insert reasonable default if ( !dr ) //no diagram renderer yet, insert reasonable default
{ {
mDisplayDiagramsGroupBox->setChecked( false ); mEnableDiagramsCheckBox->setChecked( false );
mFixedSizeCheckBox->setChecked( true ); mDiagramTypeFrame->setEnabled( false );
mDiagramFrame->setEnabled( false );
mFixedSizeRadio->setChecked( true );
mDiagramUnitComboBox->setCurrentIndex( mDiagramUnitComboBox->findText( tr( "mm" ) ) ); mDiagramUnitComboBox->setCurrentIndex( mDiagramUnitComboBox->findText( tr( "mm" ) ) );
mLabelPlacementComboBox->setCurrentIndex( mLabelPlacementComboBox->findText( tr( "x-height" ) ) ); mLabelPlacementComboBox->setCurrentIndex( mLabelPlacementComboBox->findText( tr( "x-height" ) ) );
mDiagramSizeSpinBox->setEnabled( true );
mDiagramSizeSpinBox->setValue( 30 ); mDiagramSizeSpinBox->setValue( 30 );
mLinearScaleFrame->setEnabled( false );
mIncreaseMinimumSizeSpinBox->setEnabled( false );
mIncreaseMinimumSizeLabel->setEnabled( false );
mBarWidthSpinBox->setValue( 5 ); mBarWidthSpinBox->setValue( 5 );
mVisibilityGroupBox->setChecked( layer->hasScaleBasedVisibility() ); mVisibilityGroupBox->setChecked( layer->hasScaleBasedVisibility() );
mShowAllCheckBox->setChecked( true ); mShowAllCheckBox->setChecked( true );
Expand All @@ -181,17 +213,33 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
break; break;
} }
mBackgroundColorButton->setColor( QColor( 255, 255, 255, 255 ) ); mBackgroundColorButton->setColor( QColor( 255, 255, 255, 255 ) );
mDiagramTypeComboBox->blockSignals( true );
mDiagramTypeComboBox->setCurrentIndex( 0 );
mDiagramTypeComboBox->blockSignals( false );
//force a refresh of widget status to match diagram type
on_mDiagramTypeComboBox_currentIndexChanged( mDiagramTypeComboBox->currentIndex() );
} }
else // already a diagram renderer present else // already a diagram renderer present
{ {
//single category renderer or interpolated one? //single category renderer or interpolated one?
mFixedSizeCheckBox->setChecked( dr->rendererName() == "SingleCategory" ); if ( dr->rendererName() == "SingleCategory" )
{
mFixedSizeRadio->setChecked( true );
}
else
{
mAttributeBasedScalingRadio->setChecked( true );
}
mDiagramSizeSpinBox->setEnabled( mFixedSizeRadio->isChecked() );
mLinearScaleFrame->setEnabled( mAttributeBasedScalingRadio->isChecked() );


//assume single category or linearly interpolated diagram renderer for now //assume single category or linearly interpolated diagram renderer for now
QList<QgsDiagramSettings> settingList = dr->diagramSettings(); QList<QgsDiagramSettings> settingList = dr->diagramSettings();
if ( settingList.size() > 0 ) if ( settingList.size() > 0 )
{ {
mDisplayDiagramsGroupBox->setChecked( settingList.at( 0 ).enabled ); mEnableDiagramsCheckBox->setChecked( settingList.at( 0 ).enabled );
mDiagramTypeFrame->setEnabled( mEnableDiagramsCheckBox->isChecked() );
mDiagramFrame->setEnabled( mEnableDiagramsCheckBox->isChecked() );
mDiagramFont = settingList.at( 0 ).font; mDiagramFont = settingList.at( 0 ).font;
QSizeF size = settingList.at( 0 ).size; QSizeF size = settingList.at( 0 ).size;
mBackgroundColorButton->setColor( settingList.at( 0 ).backgroundColor ); mBackgroundColorButton->setColor( settingList.at( 0 ).backgroundColor );
Expand Down Expand Up @@ -248,7 +296,10 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare


mBarWidthSpinBox->setValue( settingList.at( 0 ).barWidth ); mBarWidthSpinBox->setValue( settingList.at( 0 ).barWidth );


mIncreaseSmallDiagramsGroupBox->setChecked( settingList.at( 0 ).minimumSize != 0 ); mIncreaseSmallDiagramsCheck->setChecked( settingList.at( 0 ).minimumSize != 0 );
mIncreaseMinimumSizeSpinBox->setEnabled( mIncreaseSmallDiagramsCheck->isChecked() );
mIncreaseMinimumSizeLabel->setEnabled( mIncreaseSmallDiagramsCheck->isChecked() );

mIncreaseMinimumSizeSpinBox->setValue( settingList.at( 0 ).minimumSize ); mIncreaseMinimumSizeSpinBox->setValue( settingList.at( 0 ).minimumSize );


if ( settingList.at( 0 ).scaleByArea ) if ( settingList.at( 0 ).scaleByArea )
Expand Down Expand Up @@ -282,6 +333,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
if ( lidr ) if ( lidr )
{ {
mDiagramSizeSpinBox->setEnabled( false ); mDiagramSizeSpinBox->setEnabled( false );
mLinearScaleFrame->setEnabled( true );
mValueLineEdit->setText( QString::number( lidr->upperValue(), 'f' ) ); mValueLineEdit->setText( QString::number( lidr->upperValue(), 'f' ) );
mSizeSpinBox->setValue(( lidr->upperSize().width() + lidr->upperSize().height() ) / 2 ); mSizeSpinBox->setValue(( lidr->upperSize().width() + lidr->upperSize().height() ) / 2 );
if ( lidr->classificationAttributeIsExpression() ) if ( lidr->classificationAttributeIsExpression() )
Expand Down Expand Up @@ -315,7 +367,11 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
if ( dr->diagram() ) if ( dr->diagram() )
{ {
QString diagramName = dr->diagram()->diagramName(); QString diagramName = dr->diagram()->diagramName();
mDiagramTypeComboBox->blockSignals( true );
mDiagramTypeComboBox->setCurrentIndex( mDiagramTypeComboBox->findData( diagramName ) ); mDiagramTypeComboBox->setCurrentIndex( mDiagramTypeComboBox->findData( diagramName ) );
mDiagramTypeComboBox->blockSignals( false );
//force a refresh of widget status to match diagram type
on_mDiagramTypeComboBox_currentIndexChanged( mDiagramTypeComboBox->currentIndex() );
if ( mDiagramTypeComboBox->currentIndex() == -1 ) if ( mDiagramTypeComboBox->currentIndex() == -1 )
{ {
QMessageBox::warning( this, tr( "Unknown diagram type." ), QMessageBox::warning( this, tr( "Unknown diagram type." ),
Expand All @@ -325,29 +381,31 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
} }
} // if ( !dr ) } // if ( !dr )


// Trigger a clicked event, so all the items get properly enabled and disabled
on_mDisplayDiagramsGroupBox_toggled( mDisplayDiagramsGroupBox->isChecked() );

connect( mSizeAttributeExpression, SIGNAL( clicked() ), this, SLOT( showSizeAttributeExpressionDialog() ) ); connect( mSizeAttributeExpression, SIGNAL( clicked() ), this, SLOT( showSizeAttributeExpressionDialog() ) );
connect( mAddAttributeExpression, SIGNAL( clicked() ), this, SLOT( showAddAttributeExpressionDialog() ) ); connect( mAddAttributeExpression, SIGNAL( clicked() ), this, SLOT( showAddAttributeExpressionDialog() ) );
} }


QgsDiagramProperties::~QgsDiagramProperties()
{
QSettings settings;
settings.setValue( QString( "/Windows/Diagrams/OptionsSplitState" ), mDiagramOptionsSplitter->saveState() );
settings.setValue( QString( "/Windows/Diagrams/Tab" ), mDiagramOptionsListWidget->currentRow() );
}

void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int index ) void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int index )
{ {
QString diagramType = mDiagramTypeComboBox->itemData( index ).toString(); QString diagramType = mDiagramTypeComboBox->itemData( index ).toString();


if ( DIAGRAM_NAME_TEXT == diagramType ) if ( DIAGRAM_NAME_TEXT == diagramType )
{ {
mLabelPlacementComboBox->show(); mTextOptionsFrame->show();
mLabelPlacementLabel->show();
mBackgroundColorLabel->show(); mBackgroundColorLabel->show();
mBackgroundColorButton->show(); mBackgroundColorButton->show();
mDiagramFontButton->show(); mDiagramFontButton->show();
} }
else else
{ {
mLabelPlacementComboBox->hide(); mTextOptionsFrame->hide();
mLabelPlacementLabel->hide();
mBackgroundColorLabel->hide(); mBackgroundColorLabel->hide();
mBackgroundColorButton->hide(); mBackgroundColorButton->hide();
mDiagramFontButton->hide(); mDiagramFontButton->hide();
Expand All @@ -357,30 +415,21 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int inde
{ {
mBarWidthLabel->show(); mBarWidthLabel->show();
mBarWidthSpinBox->show(); mBarWidthSpinBox->show();
mOrientationFrame->show(); mBarOptionsFrame->show();
mFixedSizeCheckBox->setChecked( false ); mAttributeBasedScalingRadio->setChecked( true );
mFixedSizeCheckBox->setVisible( false ); mFixedSizeRadio->setEnabled( false );
mDiagramSizeSpinBox->setVisible( false ); mDiagramSizeSpinBox->setEnabled( false );
mLinearlyScalingLabel->setText( tr( "Bar length: Scale linearly, such as the following value matches the specified size." ) ); mLinearlyScalingLabel->setText( tr( "Bar length: Scale linearly, such as the following value matches the specified size." ) );
} }
else else
{ {
mBarWidthLabel->hide(); mBarWidthLabel->hide();
mBarWidthSpinBox->hide(); mBarWidthSpinBox->hide();
mOrientationFrame->hide(); mBarOptionsFrame->hide();
mLinearlyScalingLabel->setText( tr( "Scale linearly between 0 and the following attribute value / diagram size:" ) ); mLinearlyScalingLabel->setText( tr( "Scale linearly between 0 and the following attribute value / diagram size:" ) );
mAttributeBasedScalingOptions->show(); mAttributeBasedScalingRadio->setEnabled( true );
mFixedSizeCheckBox->setVisible( true ); mFixedSizeRadio->setEnabled( true );
mDiagramSizeSpinBox->setVisible( true ); mDiagramSizeSpinBox->setEnabled( mFixedSizeRadio->isChecked() );
}

if ( DIAGRAM_NAME_HISTOGRAM == diagramType || DIAGRAM_NAME_TEXT == diagramType )
{
mDiagramPropertiesTabWidget->setTabEnabled( 3, true );
}
else
{
mDiagramPropertiesTabWidget->setTabEnabled( 3, false );
} }


if ( DIAGRAM_NAME_TEXT == diagramType || DIAGRAM_NAME_PIE == diagramType ) if ( DIAGRAM_NAME_TEXT == diagramType || DIAGRAM_NAME_PIE == diagramType )
Expand Down Expand Up @@ -481,16 +530,6 @@ void QgsDiagramProperties::on_mFindMaximumValueButton_clicked()
mValueLineEdit->setText( QString( "%1" ).arg( maxValue ) ); mValueLineEdit->setText( QString( "%1" ).arg( maxValue ) );
} }


void QgsDiagramProperties::on_mDisplayDiagramsGroupBox_toggled( bool checked )
{
// if enabled show diagram specific options
if ( checked )
{
on_mDiagramTypeComboBox_currentIndexChanged( mDiagramTypeComboBox->currentIndex() );
// Update enabled/disabled state
}
}

void QgsDiagramProperties::on_mDiagramFontButton_clicked() void QgsDiagramProperties::on_mDiagramFontButton_clicked()
{ {
bool ok; bool ok;
Expand Down Expand Up @@ -518,10 +557,7 @@ void QgsDiagramProperties::on_mEngineSettingsButton_clicked()


void QgsDiagramProperties::apply() void QgsDiagramProperties::apply()
{ {
QSettings().setValue( "/Windows/VectorLayerProperties/diagram/tab", bool diagramsEnabled = mEnableDiagramsCheckBox->isChecked();
mDiagramPropertiesTabWidget->currentIndex() );

bool diagramsEnabled = mDisplayDiagramsGroupBox->isChecked();


QgsDiagram* diagram = 0; QgsDiagram* diagram = 0;
int index = mDiagramTypeComboBox->currentIndex(); int index = mDiagramTypeComboBox->currentIndex();
Expand All @@ -539,7 +575,7 @@ void QgsDiagramProperties::apply()
// Check if a (usable) scale attribute value is inserted // Check if a (usable) scale attribute value is inserted
mValueLineEdit->text().toDouble( &scaleAttributeValueOk ); mValueLineEdit->text().toDouble( &scaleAttributeValueOk );


if ( !mFixedSizeCheckBox->isChecked() && !scaleAttributeValueOk ) if ( !mFixedSizeRadio->isChecked() && !scaleAttributeValueOk )
{ {
double maxVal = DBL_MIN; double maxVal = DBL_MIN;
QgsVectorDataProvider* provider = mLayer->dataProvider(); QgsVectorDataProvider* provider = mLayer->dataProvider();
Expand Down Expand Up @@ -596,7 +632,7 @@ void QgsDiagramProperties::apply()
} }


QgsDiagramSettings ds; QgsDiagramSettings ds;
ds.enabled = mDisplayDiagramsGroupBox->isChecked(); ds.enabled = mEnableDiagramsCheckBox->isChecked();
ds.font = mDiagramFont; ds.font = mDiagramFont;
ds.transparency = mTransparencySlider->value(); ds.transparency = mTransparencySlider->value();


Expand All @@ -616,7 +652,7 @@ void QgsDiagramProperties::apply()
ds.labelPlacementMethod = static_cast<QgsDiagramSettings::LabelPlacementMethod>( mLabelPlacementComboBox->itemData( mLabelPlacementComboBox->currentIndex() ).toInt() ); ds.labelPlacementMethod = static_cast<QgsDiagramSettings::LabelPlacementMethod>( mLabelPlacementComboBox->itemData( mLabelPlacementComboBox->currentIndex() ).toInt() );
ds.scaleByArea = mScaleDependencyComboBox->itemData( mScaleDependencyComboBox->currentIndex() ).toBool(); ds.scaleByArea = mScaleDependencyComboBox->itemData( mScaleDependencyComboBox->currentIndex() ).toBool();


if ( mIncreaseSmallDiagramsGroupBox->isChecked() ) if ( mIncreaseSmallDiagramsCheck->isChecked() )
{ {
ds.minimumSize = mIncreaseMinimumSizeSpinBox->value(); ds.minimumSize = mIncreaseMinimumSizeSpinBox->value();
} }
Expand Down Expand Up @@ -647,7 +683,7 @@ void QgsDiagramProperties::apply()


ds.barWidth = mBarWidthSpinBox->value(); ds.barWidth = mBarWidthSpinBox->value();


if ( mFixedSizeCheckBox->isChecked() ) if ( mFixedSizeRadio->isChecked() )
{ {
QgsSingleCategoryDiagramRenderer* dr = new QgsSingleCategoryDiagramRenderer(); QgsSingleCategoryDiagramRenderer* dr = new QgsSingleCategoryDiagramRenderer();
dr->setDiagram( diagram ); dr->setDiagram( diagram );
Expand Down Expand Up @@ -768,3 +804,25 @@ void QgsDiagramProperties::showAddAttributeExpressionDialog()
} }
activateWindow(); // set focus back parent activateWindow(); // set focus back parent
} }

void QgsDiagramProperties::on_mDiagramStackedWidget_currentChanged( int index )
{
mDiagramOptionsListWidget->blockSignals( true );
mDiagramOptionsListWidget->setCurrentRow( index );
mDiagramOptionsListWidget->blockSignals( false );
}

void QgsDiagramProperties::on_mPlacementComboBox_currentIndexChanged( int index )
{
QgsDiagramLayerSettings::Placement currentPlacement = ( QgsDiagramLayerSettings::Placement )mPlacementComboBox->itemData( index ).toInt();
if ( currentPlacement == QgsDiagramLayerSettings::OverPoint )
{
mDiagramDistanceLabel->setEnabled( false );
mDiagramDistanceSpinBox->setEnabled( false );
}
else
{
mDiagramDistanceLabel->setEnabled( true );
mDiagramDistanceSpinBox->setEnabled( true );
}
}
7 changes: 6 additions & 1 deletion src/app/qgsdiagramproperties.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class APP_EXPORT QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPr


public: public:
QgsDiagramProperties( QgsVectorLayer* layer, QWidget* parent ); QgsDiagramProperties( QgsVectorLayer* layer, QWidget* parent );

~QgsDiagramProperties();

/**Adds an attribute from the list of available attributes to the assigned attributes with a random color.*/ /**Adds an attribute from the list of available attributes to the assigned attributes with a random color.*/
void addAttribute( QTreeWidgetItem * item ); void addAttribute( QTreeWidgetItem * item );


Expand All @@ -39,13 +42,14 @@ class APP_EXPORT QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPr
void on_mAddCategoryPushButton_clicked(); void on_mAddCategoryPushButton_clicked();
void on_mAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem * item, int column ); void on_mAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem * item, int column );
void on_mFindMaximumValueButton_clicked(); void on_mFindMaximumValueButton_clicked();
void on_mDisplayDiagramsGroupBox_toggled( bool checked );
void on_mRemoveCategoryPushButton_clicked(); void on_mRemoveCategoryPushButton_clicked();
void on_mDiagramFontButton_clicked(); void on_mDiagramFontButton_clicked();
void on_mDiagramAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem * item, int column ); void on_mDiagramAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem * item, int column );
void on_mEngineSettingsButton_clicked(); void on_mEngineSettingsButton_clicked();
void showSizeAttributeExpressionDialog(); void showSizeAttributeExpressionDialog();
void showAddAttributeExpressionDialog(); void showAddAttributeExpressionDialog();
void on_mDiagramStackedWidget_currentChanged( int index );
void on_mPlacementComboBox_currentIndexChanged( int index );


protected: protected:
QFont mDiagramFont; QFont mDiagramFont;
Expand All @@ -54,6 +58,7 @@ class APP_EXPORT QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPr


private: private:
int mAvailableAttributes; int mAvailableAttributes;

}; };


#endif // QGSDIAGRAMPROPERTIES_H #endif // QGSDIAGRAMPROPERTIES_H
10 changes: 6 additions & 4 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -239,11 +239,13 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(


mOldJoins = layer->vectorJoins(); mOldJoins = layer->vectorJoins();


QVBoxLayout* diagLayout = new QVBoxLayout( mDiagramFrame );
diagLayout->setMargin( 0 );
diagramPropertiesDialog = new QgsDiagramProperties( layer, mDiagramFrame ); diagramPropertiesDialog = new QgsDiagramProperties( layer, mDiagramFrame );
diagramPropertiesDialog->layout()->setMargin( 0 ); diagramPropertiesDialog->layout()->setContentsMargins( -1, 0, -1, 0 );
mDiagramFrame->setLayout( new QVBoxLayout( mDiagramFrame ) ); diagLayout->addWidget( diagramPropertiesDialog );
mDiagramFrame->layout()->setMargin( 0 ); mDiagramFrame->setLayout( diagLayout );
mDiagramFrame->layout()->addWidget( diagramPropertiesDialog );


//layer title and abstract //layer title and abstract
mLayerTitleLineEdit->setText( layer->title() ); mLayerTitleLineEdit->setText( layer->title() );
Expand Down
Loading

0 comments on commit 7ce618a

Please sign in to comment.