Skip to content

Commit e723896

Browse files
committed
Remove unused QgsRendererV2DataDefinedMenus
Was not exposed to python api, so not a PyQGIS api break
1 parent 2893456 commit e723896

File tree

4 files changed

+4
-223
lines changed

4 files changed

+4
-223
lines changed

doc/api_break.dox

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
5252
<li>QgsMapCanvasMap. It is an internal class used by map canvas.</li>
5353
<li>QgsMapRenderer. It has been replaced by QgsMapRendererJob with subclasses and QgsMapSettings.</li>
5454
<li>QgsPseudoColorShader. This shader has been broken for some time and was replaced by QgsSingleBandPseudoColorRenderer.</li>
55+
<li>QgsRendererV2DataDefinedMenus was removed. Use QgsDataDefinedButton instead.</li>
5556
</ul>
5657

5758
\subsection qgis_api_break_3_0_global General changes

src/gui/symbology-ng/qgsrendererv2widget.cpp

+3-178
Original file line numberDiff line numberDiff line change
@@ -274,184 +274,9 @@ void QgsRendererV2Widget::applyChanges()
274274
apply();
275275
}
276276

277-
278-
279-
////////////
280-
281-
#include "qgsfield.h"
282-
283-
QgsRendererV2DataDefinedMenus::QgsRendererV2DataDefinedMenus( QMenu* menu, QgsVectorLayer* layer, const QString& rotationField, const QString& sizeScaleField, QgsSymbol::ScaleMethod scaleMethod )
284-
: QObject( menu )
285-
, mLayer( layer )
286-
{
287-
mRotationMenu = new QMenu( tr( "Rotation field" ) );
288-
mSizeScaleMenu = new QMenu( tr( "Size scale field" ) );
289-
290-
mRotationAttributeActionGroup = new QActionGroup( mRotationMenu );
291-
mSizeAttributeActionGroup = new QActionGroup( mSizeScaleMenu );
292-
mSizeMethodActionGroup = new QActionGroup( mSizeScaleMenu );
293-
294-
populateMenu( mRotationMenu, rotationField, mRotationAttributeActionGroup );
295-
populateMenu( mSizeScaleMenu, sizeScaleField, mSizeAttributeActionGroup );
296-
297-
mSizeScaleMenu->addSeparator();
298-
299-
QAction* aScaleByArea = new QAction( tr( "Scale area" ), mSizeMethodActionGroup );
300-
QAction* aScaleByDiameter = new QAction( tr( "Scale diameter" ), mSizeMethodActionGroup );
301-
302-
aScaleByArea->setCheckable( true );
303-
aScaleByDiameter->setCheckable( true );
304-
305-
if ( scaleMethod == QgsSymbol::ScaleDiameter )
306-
{
307-
aScaleByDiameter->setChecked( true );
308-
}
309-
else
310-
{
311-
aScaleByArea->setChecked( true );
312-
}
313-
314-
mSizeScaleMenu->addActions( mSizeMethodActionGroup->actions() );
315-
316-
//@todo cleanup the class since Rotation and SizeScale are now
317-
//defined using QgsDataDefinedButton
318-
//
319-
//menu->addMenu( mRotationMenu );
320-
//menu->addMenu( mSizeScaleMenu );
321-
322-
connect( mSizeMethodActionGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( scaleMethodSelected( QAction* ) ) );
323-
connect( mRotationAttributeActionGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( rotationFieldSelected( QAction* ) ) );
324-
connect( mSizeAttributeActionGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( sizeScaleFieldSelected( QAction* ) ) );
325-
}
326-
327-
QgsRendererV2DataDefinedMenus::~QgsRendererV2DataDefinedMenus()
328-
{
329-
delete mSizeMethodActionGroup;
330-
delete mSizeAttributeActionGroup;
331-
delete mRotationAttributeActionGroup;
332-
delete mRotationMenu;
333-
delete mSizeScaleMenu;
334-
}
335-
336-
void QgsRendererV2DataDefinedMenus::populateMenu( QMenu* menu, const QString& fieldName, QActionGroup *actionGroup )
337-
{
338-
QAction* aExpr = new QAction( tr( "- expression -" ), actionGroup );
339-
aExpr->setCheckable( true );
340-
menu->addAction( aExpr );
341-
menu->addSeparator();
342-
QAction* aNo = new QAction( tr( "- no field -" ), actionGroup );
343-
aNo->setCheckable( true );
344-
menu->addAction( aNo );
345-
menu->addSeparator();
346-
347-
bool hasField = false;
348-
Q_FOREACH ( const QgsField& fld, mLayer->fields() )
349-
{
350-
if ( fld.type() == QVariant::Int || fld.type() == QVariant::Double )
351-
{
352-
QAction* a = new QAction( fld.name(), actionGroup );
353-
a->setCheckable( true );
354-
if ( fieldName == fld.name() )
355-
{
356-
a->setChecked( true );
357-
hasField = true;
358-
}
359-
menu->addAction( a );
360-
}
361-
}
362-
363-
if ( !hasField )
364-
{
365-
if ( fieldName.isEmpty() )
366-
{
367-
aNo->setChecked( true );
368-
}
369-
else
370-
{
371-
aExpr->setChecked( true );
372-
aExpr->setText( tr( "- expression -" ) + fieldName );
373-
}
374-
}
375-
376-
}
377-
378-
void QgsRendererV2DataDefinedMenus::rotationFieldSelected( QAction* a )
379-
{
380-
if ( !a )
381-
return;
382-
383-
QString fldName = a->text();
384-
#if 0
385-
updateMenu( mRotationAttributeActionGroup, fldName );
386-
#endif
387-
if ( fldName == tr( "- no field -" ) )
388-
{
389-
fldName = QString();
390-
}
391-
else if ( fldName.startsWith( tr( "- expression -" ) ) )
392-
{
393-
QString expr( fldName );
394-
expr.replace( 0, tr( "- expression -" ).length(), "" );
395-
QgsExpressionBuilderDialog dialog( mLayer, expr );
396-
if ( !dialog.exec() ) return;
397-
fldName = dialog.expressionText();
398-
Q_ASSERT( !QgsExpression( fldName ).hasParserError() );
399-
a->setText( tr( "- expression -" ) + fldName );
400-
}
401-
402-
emit rotationFieldChanged( fldName );
403-
}
404-
405-
void QgsRendererV2DataDefinedMenus::sizeScaleFieldSelected( QAction* a )
406-
{
407-
if ( !a )
408-
return;
409-
410-
QString fldName = a->text();
411-
#if 0
412-
updateMenu( mSizeAttributeActionGroup, fldName );
413-
#endif
414-
if ( fldName == tr( "- no field -" ) )
415-
{
416-
fldName = QString();
417-
}
418-
else if ( fldName.startsWith( tr( "- expression -" ) ) )
419-
{
420-
QString expr( fldName );
421-
expr.replace( 0, tr( "- expression -" ).length(), "" );
422-
QgsExpressionBuilderDialog dialog( mLayer, expr );
423-
if ( !dialog.exec() ) return;
424-
fldName = dialog.expressionText();
425-
Q_ASSERT( !QgsExpression( fldName ).hasParserError() );
426-
a->setText( tr( "- expression -" ) + fldName );
427-
}
428-
429-
emit sizeScaleFieldChanged( fldName );
430-
}
431-
432-
void QgsRendererV2DataDefinedMenus::scaleMethodSelected( QAction* a )
433-
{
434-
if ( !a )
435-
return;
436-
437-
if ( a->text() == tr( "Scale area" ) )
438-
{
439-
emit scaleMethodChanged( QgsSymbol::ScaleArea );
440-
}
441-
else if ( a->text() == tr( "Scale diameter" ) )
442-
{
443-
emit scaleMethodChanged( QgsSymbol::ScaleDiameter );
444-
}
445-
}
446-
#if 0 // MK: is there any reason for this?
447-
void QgsRendererV2DataDefinedMenus::updateMenu( QActionGroup* actionGroup, QString fieldName )
448-
{
449-
Q_FOREACH ( QAction* a, actionGroup->actions() )
450-
{
451-
a->setChecked( a->text() == fieldName );
452-
}
453-
}
454-
#endif
277+
//
278+
// QgsDataDefinedValueDialog
279+
//
455280

456281
QgsDataDefinedValueDialog::QgsDataDefinedValueDialog( const QList<QgsSymbol*>& symbolList, QgsVectorLayer * layer, const QString & label )
457282
: mSymbolList( symbolList )

src/gui/symbology-ng/qgsrendererv2widget.h

-43
Original file line numberDiff line numberDiff line change
@@ -132,49 +132,6 @@ class QMenu;
132132
class QgsField;
133133
class QgsFields;
134134

135-
136-
/** \ingroup gui
137-
Utility class for providing GUI for data-defined rendering.
138-
@deprecated unused, will be removed in QGIS 3.0
139-
@note not available in Python bindings
140-
*/
141-
class QgsRendererV2DataDefinedMenus : public QObject
142-
{
143-
Q_OBJECT
144-
145-
public:
146-
147-
//! @deprecated will be removed in QGIS 3.0
148-
Q_DECL_DEPRECATED QgsRendererV2DataDefinedMenus( QMenu* menu, QgsVectorLayer* layer, const QString& rotationField, const QString& sizeScaleField, QgsSymbol::ScaleMethod scaleMethod );
149-
~QgsRendererV2DataDefinedMenus();
150-
151-
void populateMenu( QMenu* menu, const QString& fieldName, QActionGroup *actionGroup );
152-
#if 0
153-
void updateMenu( QActionGroup* actionGroup, QString fieldName );
154-
#endif
155-
public slots:
156-
157-
void rotationFieldSelected( QAction *a );
158-
void sizeScaleFieldSelected( QAction *a );
159-
void scaleMethodSelected( QAction *a );
160-
161-
signals:
162-
163-
void rotationFieldChanged( const QString& fldName );
164-
void sizeScaleFieldChanged( const QString& fldName );
165-
void scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod );
166-
167-
protected:
168-
QMenu* mRotationMenu;
169-
QMenu* mSizeScaleMenu;
170-
QActionGroup *mSizeMethodActionGroup;
171-
QActionGroup *mRotationAttributeActionGroup;
172-
QActionGroup *mSizeAttributeActionGroup;
173-
QgsVectorLayer* mLayer;
174-
};
175-
176-
////////////
177-
178135
#include "ui_widget_set_dd_value.h"
179136
#include "qgssizescalewidget.h"
180137

tests/src/python/acceptable_missing_doc.py

-2
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@
568568
"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()"],
569569
"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)"],
570570
"QgsMapRendererQImageJob": ["QgsMapRendererQImageJob(const QgsMapSettings &settings)"],
571-
"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)"],
572571
"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)"],
573572
"QgsColorWidgetFactory": ["QgsColorWidgetFactory(const QString &name)"],
574573
"QgsDateTimeEditConfig": ["QgsDateTimeEditConfig(QgsVectorLayer *vl, int fieldIdx, QWidget *parent=nullptr)"],
@@ -831,7 +830,6 @@
831830
"QgsLayerTreeView",
832831
"QgsActionManager",
833832
"QgsSQLStatement::NodeColumnRef",
834-
"QgsRendererV2DataDefinedMenus",
835833
"QgsLocaleNumC",
836834
"QgsRasterChecker",
837835
"QgsNumericScaleBarStyle",

0 commit comments

Comments
 (0)