Skip to content
Permalink
Browse files
Moved symbol levels button under renderer's advanced menu
  • Loading branch information
wonder-sk committed Nov 26, 2011
1 parent 56525c2 commit 54c65ede0f6b135b2d920fa49db79fc7249b6b04
@@ -42,8 +42,6 @@ public slots:
void apply();
void onOK();

void showSymbolLevels();

protected:

//! Reimplements dialog keyPress event so we can ignore it
@@ -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 ) ) );
@@ -429,3 +432,8 @@ QList<QgsSymbolV2*> QgsCategorizedSymbolRendererV2Widget::selectedSymbols()
}
return selectedSymbols;
}

void QgsCategorizedSymbolRendererV2Widget::showSymbolLevels()
{
showSymbolLevelsDialog( mRenderer );
}
@@ -35,6 +35,8 @@ class GUI_EXPORT QgsCategorizedSymbolRendererV2Widget : public QgsRendererV2Widg
void rotationFieldChanged( QString fldName );
void sizeScaleFieldChanged( QString fldName );

void showSymbolLevels();

protected:

void updateUiFromRenderer();
@@ -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 ) ) );
@@ -391,4 +394,7 @@ void QgsGraduatedSymbolRendererV2Widget::refreshSymbolView()
populateRanges();
}


void QgsGraduatedSymbolRendererV2Widget::showSymbolLevels()
{
showSymbolLevelsDialog( mRenderer );
}
@@ -36,6 +36,8 @@ class GUI_EXPORT QgsGraduatedSymbolRendererV2Widget : public QgsRendererV2Widget
void rotationFieldChanged( QString fldName );
void sizeScaleFieldChanged( QString fldName );

void showSymbolLevels();

protected:
void updateUiFromRenderer();

@@ -11,8 +11,6 @@
#include "qgsrulebasedrendererv2widget.h"
#include "qgspointdisplacementrendererwidget.h"

#include "qgssymbollevelsv2dialog.h"

#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgsvectorlayer.h"
@@ -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
@@ -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 );
}

}
@@ -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()
@@ -28,8 +28,6 @@ class GUI_EXPORT QgsRendererV2PropertiesDialog : public QDialog, private Ui::Qgs
void apply();
void onOK();

void showSymbolLevels();

void useOldSymbology();

signals:
@@ -5,6 +5,8 @@
#include <QInputDialog>
#include <QMenu>

#include "qgssymbollevelsv2dialog.h"


QgsRendererV2Widget::QgsRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style )
: QWidget(), mLayer( layer ), mStyle( style )
@@ -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() );
}
}


////////////
@@ -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;
@@ -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 ) ) );
@@ -85,3 +87,8 @@ void QgsSingleSymbolRendererV2Widget::sizeScaleFieldChanged( QString fldName )
{
mRenderer->setSizeScaleField( fldName );
}

void QgsSingleSymbolRendererV2Widget::showSymbolLevels()
{
showSymbolLevelsDialog( mRenderer );
}
@@ -27,6 +27,8 @@ class GUI_EXPORT QgsSingleSymbolRendererV2Widget : public QgsRendererV2Widget
void rotationFieldChanged( QString fldName );
void sizeScaleFieldChanged( QString fldName );

void showSymbolLevels();

protected:

QgsSingleSymbolRendererV2* mRenderer;
@@ -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">
@@ -86,7 +79,6 @@
</widget>
<tabstops>
<tabstop>cboRenderers</tabstop>
<tabstop>btnSymbolLevels</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>

0 comments on commit 54c65ed

Please sign in to comment.