mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Remove unused QgsRendererV2DataDefinedMenus
Was not exposed to python api, so not a PyQGIS api break
This commit is contained in:
parent
2893456189
commit
e72389601d
@ -52,6 +52,7 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
|
||||
<li>QgsMapCanvasMap. It is an internal class used by map canvas.</li>
|
||||
<li>QgsMapRenderer. It has been replaced by QgsMapRendererJob with subclasses and QgsMapSettings.</li>
|
||||
<li>QgsPseudoColorShader. This shader has been broken for some time and was replaced by QgsSingleBandPseudoColorRenderer.</li>
|
||||
<li>QgsRendererV2DataDefinedMenus was removed. Use QgsDataDefinedButton instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_global General changes
|
||||
|
@ -274,184 +274,9 @@ void QgsRendererV2Widget::applyChanges()
|
||||
apply();
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////
|
||||
|
||||
#include "qgsfield.h"
|
||||
|
||||
QgsRendererV2DataDefinedMenus::QgsRendererV2DataDefinedMenus( QMenu* menu, QgsVectorLayer* layer, const QString& rotationField, const QString& sizeScaleField, QgsSymbol::ScaleMethod scaleMethod )
|
||||
: QObject( menu )
|
||||
, mLayer( layer )
|
||||
{
|
||||
mRotationMenu = new QMenu( tr( "Rotation field" ) );
|
||||
mSizeScaleMenu = new QMenu( tr( "Size scale field" ) );
|
||||
|
||||
mRotationAttributeActionGroup = new QActionGroup( mRotationMenu );
|
||||
mSizeAttributeActionGroup = new QActionGroup( mSizeScaleMenu );
|
||||
mSizeMethodActionGroup = new QActionGroup( mSizeScaleMenu );
|
||||
|
||||
populateMenu( mRotationMenu, rotationField, mRotationAttributeActionGroup );
|
||||
populateMenu( mSizeScaleMenu, sizeScaleField, mSizeAttributeActionGroup );
|
||||
|
||||
mSizeScaleMenu->addSeparator();
|
||||
|
||||
QAction* aScaleByArea = new QAction( tr( "Scale area" ), mSizeMethodActionGroup );
|
||||
QAction* aScaleByDiameter = new QAction( tr( "Scale diameter" ), mSizeMethodActionGroup );
|
||||
|
||||
aScaleByArea->setCheckable( true );
|
||||
aScaleByDiameter->setCheckable( true );
|
||||
|
||||
if ( scaleMethod == QgsSymbol::ScaleDiameter )
|
||||
{
|
||||
aScaleByDiameter->setChecked( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
aScaleByArea->setChecked( true );
|
||||
}
|
||||
|
||||
mSizeScaleMenu->addActions( mSizeMethodActionGroup->actions() );
|
||||
|
||||
//@todo cleanup the class since Rotation and SizeScale are now
|
||||
//defined using QgsDataDefinedButton
|
||||
//
|
||||
//menu->addMenu( mRotationMenu );
|
||||
//menu->addMenu( mSizeScaleMenu );
|
||||
|
||||
connect( mSizeMethodActionGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( scaleMethodSelected( QAction* ) ) );
|
||||
connect( mRotationAttributeActionGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( rotationFieldSelected( QAction* ) ) );
|
||||
connect( mSizeAttributeActionGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( sizeScaleFieldSelected( QAction* ) ) );
|
||||
}
|
||||
|
||||
QgsRendererV2DataDefinedMenus::~QgsRendererV2DataDefinedMenus()
|
||||
{
|
||||
delete mSizeMethodActionGroup;
|
||||
delete mSizeAttributeActionGroup;
|
||||
delete mRotationAttributeActionGroup;
|
||||
delete mRotationMenu;
|
||||
delete mSizeScaleMenu;
|
||||
}
|
||||
|
||||
void QgsRendererV2DataDefinedMenus::populateMenu( QMenu* menu, const QString& fieldName, QActionGroup *actionGroup )
|
||||
{
|
||||
QAction* aExpr = new QAction( tr( "- expression -" ), actionGroup );
|
||||
aExpr->setCheckable( true );
|
||||
menu->addAction( aExpr );
|
||||
menu->addSeparator();
|
||||
QAction* aNo = new QAction( tr( "- no field -" ), actionGroup );
|
||||
aNo->setCheckable( true );
|
||||
menu->addAction( aNo );
|
||||
menu->addSeparator();
|
||||
|
||||
bool hasField = false;
|
||||
Q_FOREACH ( const QgsField& fld, mLayer->fields() )
|
||||
{
|
||||
if ( fld.type() == QVariant::Int || fld.type() == QVariant::Double )
|
||||
{
|
||||
QAction* a = new QAction( fld.name(), actionGroup );
|
||||
a->setCheckable( true );
|
||||
if ( fieldName == fld.name() )
|
||||
{
|
||||
a->setChecked( true );
|
||||
hasField = true;
|
||||
}
|
||||
menu->addAction( a );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !hasField )
|
||||
{
|
||||
if ( fieldName.isEmpty() )
|
||||
{
|
||||
aNo->setChecked( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
aExpr->setChecked( true );
|
||||
aExpr->setText( tr( "- expression -" ) + fieldName );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QgsRendererV2DataDefinedMenus::rotationFieldSelected( QAction* a )
|
||||
{
|
||||
if ( !a )
|
||||
return;
|
||||
|
||||
QString fldName = a->text();
|
||||
#if 0
|
||||
updateMenu( mRotationAttributeActionGroup, fldName );
|
||||
#endif
|
||||
if ( fldName == tr( "- no field -" ) )
|
||||
{
|
||||
fldName = QString();
|
||||
}
|
||||
else if ( fldName.startsWith( tr( "- expression -" ) ) )
|
||||
{
|
||||
QString expr( fldName );
|
||||
expr.replace( 0, tr( "- expression -" ).length(), "" );
|
||||
QgsExpressionBuilderDialog dialog( mLayer, expr );
|
||||
if ( !dialog.exec() ) return;
|
||||
fldName = dialog.expressionText();
|
||||
Q_ASSERT( !QgsExpression( fldName ).hasParserError() );
|
||||
a->setText( tr( "- expression -" ) + fldName );
|
||||
}
|
||||
|
||||
emit rotationFieldChanged( fldName );
|
||||
}
|
||||
|
||||
void QgsRendererV2DataDefinedMenus::sizeScaleFieldSelected( QAction* a )
|
||||
{
|
||||
if ( !a )
|
||||
return;
|
||||
|
||||
QString fldName = a->text();
|
||||
#if 0
|
||||
updateMenu( mSizeAttributeActionGroup, fldName );
|
||||
#endif
|
||||
if ( fldName == tr( "- no field -" ) )
|
||||
{
|
||||
fldName = QString();
|
||||
}
|
||||
else if ( fldName.startsWith( tr( "- expression -" ) ) )
|
||||
{
|
||||
QString expr( fldName );
|
||||
expr.replace( 0, tr( "- expression -" ).length(), "" );
|
||||
QgsExpressionBuilderDialog dialog( mLayer, expr );
|
||||
if ( !dialog.exec() ) return;
|
||||
fldName = dialog.expressionText();
|
||||
Q_ASSERT( !QgsExpression( fldName ).hasParserError() );
|
||||
a->setText( tr( "- expression -" ) + fldName );
|
||||
}
|
||||
|
||||
emit sizeScaleFieldChanged( fldName );
|
||||
}
|
||||
|
||||
void QgsRendererV2DataDefinedMenus::scaleMethodSelected( QAction* a )
|
||||
{
|
||||
if ( !a )
|
||||
return;
|
||||
|
||||
if ( a->text() == tr( "Scale area" ) )
|
||||
{
|
||||
emit scaleMethodChanged( QgsSymbol::ScaleArea );
|
||||
}
|
||||
else if ( a->text() == tr( "Scale diameter" ) )
|
||||
{
|
||||
emit scaleMethodChanged( QgsSymbol::ScaleDiameter );
|
||||
}
|
||||
}
|
||||
#if 0 // MK: is there any reason for this?
|
||||
void QgsRendererV2DataDefinedMenus::updateMenu( QActionGroup* actionGroup, QString fieldName )
|
||||
{
|
||||
Q_FOREACH ( QAction* a, actionGroup->actions() )
|
||||
{
|
||||
a->setChecked( a->text() == fieldName );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// QgsDataDefinedValueDialog
|
||||
//
|
||||
|
||||
QgsDataDefinedValueDialog::QgsDataDefinedValueDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer, const QString & label )
|
||||
: mSymbolList( symbolList )
|
||||
|
@ -132,49 +132,6 @@ class QMenu;
|
||||
class QgsField;
|
||||
class QgsFields;
|
||||
|
||||
|
||||
/** \ingroup gui
|
||||
Utility class for providing GUI for data-defined rendering.
|
||||
@deprecated unused, will be removed in QGIS 3.0
|
||||
@note not available in Python bindings
|
||||
*/
|
||||
class QgsRendererV2DataDefinedMenus : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
Q_DECL_DEPRECATED QgsRendererV2DataDefinedMenus( QMenu* menu, QgsVectorLayer* layer, const QString& rotationField, const QString& sizeScaleField, QgsSymbol::ScaleMethod scaleMethod );
|
||||
~QgsRendererV2DataDefinedMenus();
|
||||
|
||||
void populateMenu( QMenu* menu, const QString& fieldName, QActionGroup *actionGroup );
|
||||
#if 0
|
||||
void updateMenu( QActionGroup* actionGroup, QString fieldName );
|
||||
#endif
|
||||
public slots:
|
||||
|
||||
void rotationFieldSelected( QAction *a );
|
||||
void sizeScaleFieldSelected( QAction *a );
|
||||
void scaleMethodSelected( QAction *a );
|
||||
|
||||
signals:
|
||||
|
||||
void rotationFieldChanged( const QString& fldName );
|
||||
void sizeScaleFieldChanged( const QString& fldName );
|
||||
void scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod );
|
||||
|
||||
protected:
|
||||
QMenu* mRotationMenu;
|
||||
QMenu* mSizeScaleMenu;
|
||||
QActionGroup *mSizeMethodActionGroup;
|
||||
QActionGroup *mRotationAttributeActionGroup;
|
||||
QActionGroup *mSizeAttributeActionGroup;
|
||||
QgsVectorLayer* mLayer;
|
||||
};
|
||||
|
||||
////////////
|
||||
|
||||
#include "ui_widget_set_dd_value.h"
|
||||
#include "qgssizescalewidget.h"
|
||||
|
||||
|
@ -568,7 +568,6 @@ ACCEPTABLE_MISSING_DOCS = {
|
||||
"QgsNewNameDialog": ["matching(const QStringList &newNames, const QStringList &existingNames, Qt::CaseSensitivity cs=Qt::CaseSensitive)", "highlightText(const QString &text)", "fullNames(const QString &name, const QStringList &extensions)", "nameChanged()"],
|
||||
"QgsMapRendererJob": ["None", "drawNewLabeling(const QgsMapSettings &settings, QgsRenderContext &renderContext, QgsPalLabeling *labelingEngine)", "composeImage(const QgsMapSettings &settings, const LayerRenderJobs &jobs)", "drawOldLabeling(const QgsMapSettings &settings, QgsRenderContext &renderContext)", "QgsMapRendererJob(const QgsMapSettings &settings)", "needTemporaryImage(QgsMapLayer *ml)"],
|
||||
"QgsMapRendererQImageJob": ["QgsMapRendererQImageJob(const QgsMapSettings &settings)"],
|
||||
"QgsRendererV2DataDefinedMenus": ["sizeScaleFieldSelected(QAction *a)", "scaleMethodChanged(QgsSymbol::ScaleMethod scaleMethod)", "rotationFieldChanged(const QString &fldName)", "scaleMethodSelected(QAction *a)", "rotationFieldSelected(QAction *a)", "sizeScaleFieldChanged(const QString &fldName)", "populateMenu(QMenu *menu, const QString &fieldName, QActionGroup *actionGroup)"],
|
||||
"QgsHttpTransaction": ["transactionFinished(bool error)", "dataProgress(int done, int total)", "networkTimedOut()", "getAsynchronously()", "responseContentType()", "dataReceived(const QHttpResponseHeader &resp)", "dataStateChanged(int state)", "dataFinished(int id, bool error)", "dataHeaderReceived(const QHttpResponseHeader &resp)", "dataStarted(int id)"],
|
||||
"QgsColorWidgetFactory": ["QgsColorWidgetFactory(const QString &name)"],
|
||||
"QgsDateTimeEditConfig": ["QgsDateTimeEditConfig(QgsVectorLayer *vl, int fieldIdx, QWidget *parent=nullptr)"],
|
||||
@ -831,7 +830,6 @@ ACCEPTABLE_MISSING_ADDED_NOTE = [
|
||||
"QgsLayerTreeView",
|
||||
"QgsActionManager",
|
||||
"QgsSQLStatement::NodeColumnRef",
|
||||
"QgsRendererV2DataDefinedMenus",
|
||||
"QgsLocaleNumC",
|
||||
"QgsRasterChecker",
|
||||
"QgsNumericScaleBarStyle",
|
||||
|
Loading…
x
Reference in New Issue
Block a user