Skip to content

Commit

Permalink
Moved symbol levels button under renderer's advanced menu
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Nov 26, 2011
1 parent 56525c2 commit 54c65ed
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 35 deletions.
2 changes: 0 additions & 2 deletions python/gui/symbology-ng-gui.sip
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public slots:
void apply();
void onOK();

void showSymbolLevels();

protected:

//! Reimplements dialog keyPress event so we can ignore it
Expand Down
8 changes: 8 additions & 0 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsV

// menus for data-defined rotation/size
QMenu* advMenu = new QMenu;

advMenu->addAction( tr( "Symbol levels..." ), this, SLOT( showSymbolLevels() ) );

mDataDefinedMenus = new QgsRendererV2DataDefinedMenus( advMenu, mLayer->pendingFields(),
mRenderer->rotationField(), mRenderer->sizeScaleField() );
connect( mDataDefinedMenus, SIGNAL( rotationFieldChanged( QString ) ), this, SLOT( rotationFieldChanged( QString ) ) );
Expand Down Expand Up @@ -429,3 +432,8 @@ QList<QgsSymbolV2*> QgsCategorizedSymbolRendererV2Widget::selectedSymbols()
}
return selectedSymbols;
}

void QgsCategorizedSymbolRendererV2Widget::showSymbolLevels()
{
showSymbolLevelsDialog( mRenderer );
}
2 changes: 2 additions & 0 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class GUI_EXPORT QgsCategorizedSymbolRendererV2Widget : public QgsRendererV2Widg
void rotationFieldChanged( QString fldName );
void sizeScaleFieldChanged( QString fldName );

void showSymbolLevels();

protected:

void updateUiFromRenderer();
Expand Down
8 changes: 7 additions & 1 deletion src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVecto

// menus for data-defined rotation/size
QMenu* advMenu = new QMenu;

advMenu->addAction( tr( "Symbol levels..." ), this, SLOT( showSymbolLevels() ) );

mDataDefinedMenus = new QgsRendererV2DataDefinedMenus( advMenu, mLayer->pendingFields(),
mRenderer->rotationField(), mRenderer->sizeScaleField() );
connect( mDataDefinedMenus, SIGNAL( rotationFieldChanged( QString ) ), this, SLOT( rotationFieldChanged( QString ) ) );
Expand Down Expand Up @@ -391,4 +394,7 @@ void QgsGraduatedSymbolRendererV2Widget::refreshSymbolView()
populateRanges();
}


void QgsGraduatedSymbolRendererV2Widget::showSymbolLevels()
{
showSymbolLevelsDialog( mRenderer );
}
2 changes: 2 additions & 0 deletions src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class GUI_EXPORT QgsGraduatedSymbolRendererV2Widget : public QgsRendererV2Widget
void rotationFieldChanged( QString fldName );
void sizeScaleFieldChanged( QString fldName );

void showSymbolLevels();

protected:
void updateUiFromRenderer();

Expand Down
22 changes: 0 additions & 22 deletions src/gui/symbology-ng/qgsrendererv2propertiesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "qgsrulebasedrendererv2widget.h"
#include "qgspointdisplacementrendererwidget.h"

#include "qgssymbollevelsv2dialog.h"

#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgsvectorlayer.h"
Expand Down Expand Up @@ -71,7 +69,6 @@ QgsRendererV2PropertiesDialog::QgsRendererV2PropertiesDialog( QgsVectorLayer* la
}

connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) );
connect( btnSymbolLevels, SIGNAL( clicked() ), this, SLOT( showSymbolLevels() ) );
connect( btnOldSymbology, SIGNAL( clicked() ), this, SLOT( useOldSymbology() ) );

// initialize registry's widget functions
Expand Down Expand Up @@ -146,15 +143,11 @@ void QgsRendererV2PropertiesDialog::rendererChanged()
mActiveWidget = w;
stackedWidget->addWidget( mActiveWidget );
stackedWidget->setCurrentWidget( mActiveWidget );

btnSymbolLevels->setEnabled( true );
}
else
{
// set default "no edit widget available" page
stackedWidget->setCurrentWidget( pageNoWidget );

btnSymbolLevels->setEnabled( false );
}

}
Expand Down Expand Up @@ -194,21 +187,6 @@ void QgsRendererV2PropertiesDialog::keyPressEvent( QKeyEvent * e )
}


void QgsRendererV2PropertiesDialog::showSymbolLevels()
{
if ( !mActiveWidget )
return;

QgsFeatureRendererV2* r = mActiveWidget->renderer();
QgsSymbolV2List symbols = r->symbols();

QgsSymbolLevelsV2Dialog dlg( symbols, r->usingSymbolLevels(), this );

if ( dlg.exec() )
{
r->setUsingSymbolLevels( dlg.usingLevels() );
}
}


void QgsRendererV2PropertiesDialog::useOldSymbology()
Expand Down
2 changes: 0 additions & 2 deletions src/gui/symbology-ng/qgsrendererv2propertiesdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class GUI_EXPORT QgsRendererV2PropertiesDialog : public QDialog, private Ui::Qgs
void apply();
void onOK();

void showSymbolLevels();

void useOldSymbology();

signals:
Expand Down
13 changes: 13 additions & 0 deletions src/gui/symbology-ng/qgsrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <QInputDialog>
#include <QMenu>

#include "qgssymbollevelsv2dialog.h"


QgsRendererV2Widget::QgsRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style )
: QWidget(), mLayer( layer ), mStyle( style )
Expand Down Expand Up @@ -137,6 +139,17 @@ void QgsRendererV2Widget::changeSymbolSize()
}
}

void QgsRendererV2Widget::showSymbolLevelsDialog( QgsFeatureRendererV2* r )
{
QgsSymbolV2List symbols = r->symbols();

QgsSymbolLevelsV2Dialog dlg( symbols, r->usingSymbolLevels(), this );

if ( dlg.exec() )
{
r->setUsingSymbolLevels( dlg.usingLevels() );
}
}


////////////
Expand Down
3 changes: 3 additions & 0 deletions src/gui/symbology-ng/qgsrendererv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class GUI_EXPORT QgsRendererV2Widget : public QWidget
//! return pointer to the renderer (no transfer of ownership)
virtual QgsFeatureRendererV2* renderer() = 0;

//! show a dialog with renderer's symbol level settings
void showSymbolLevelsDialog( QgsFeatureRendererV2* r );

protected:
QgsVectorLayer* mLayer;
QgsStyleV2* mStyle;
Expand Down
7 changes: 7 additions & 0 deletions src/gui/symbology-ng/qgssinglesymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ QgsSingleSymbolRendererV2Widget::QgsSingleSymbolRendererV2Widget( QgsVectorLayer
// advanced actions - data defined rendering
QMenu* advMenu = mSelector->advancedMenu();

advMenu->addAction( tr( "Symbol levels..." ), this, SLOT( showSymbolLevels() ) );

mDataDefinedMenus = new QgsRendererV2DataDefinedMenus( advMenu, mLayer->pendingFields(),
mRenderer->rotationField(), mRenderer->sizeScaleField() );
connect( mDataDefinedMenus, SIGNAL( rotationFieldChanged( QString ) ), this, SLOT( rotationFieldChanged( QString ) ) );
Expand Down Expand Up @@ -85,3 +87,8 @@ void QgsSingleSymbolRendererV2Widget::sizeScaleFieldChanged( QString fldName )
{
mRenderer->setSizeScaleField( fldName );
}

void QgsSingleSymbolRendererV2Widget::showSymbolLevels()
{
showSymbolLevelsDialog( mRenderer );
}
2 changes: 2 additions & 0 deletions src/gui/symbology-ng/qgssinglesymbolrendererv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class GUI_EXPORT QgsSingleSymbolRendererV2Widget : public QgsRendererV2Widget
void rotationFieldChanged( QString fldName );
void sizeScaleFieldChanged( QString fldName );

void showSymbolLevels();

protected:

QgsSingleSymbolRendererV2* mRenderer;
Expand Down
8 changes: 0 additions & 8 deletions src/ui/qgsrendererv2propsdialogbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnSymbolLevels">
<property name="text">
<string>Symbol levels</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnOldSymbology">
<property name="text">
Expand Down Expand Up @@ -86,7 +79,6 @@
</widget>
<tabstops>
<tabstop>cboRenderers</tabstop>
<tabstop>btnSymbolLevels</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
Expand Down

0 comments on commit 54c65ed

Please sign in to comment.