mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
indentation update/fix (followup 9ab22bd)
This commit is contained in:
parent
10e09bc76b
commit
f76d7301a3
@ -28,8 +28,7 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
from qgis.core import QgsField, QgsExpression, QgsFeature
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.core.GeoAlgorithmExecutionException import \
|
||||
GeoAlgorithmExecutionException
|
||||
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
|
||||
from processing.core.parameters import ParameterVector
|
||||
from processing.core.outputs import OutputVector
|
||||
from processing.tools import dataobjects, vector
|
||||
|
@ -66,12 +66,12 @@ class FieldsMapperParametersPanel(ParametersPanel):
|
||||
item.setLayer(layers[0])
|
||||
return item
|
||||
return ParametersPanel.getWidgetFromParameter(self, param)
|
||||
|
||||
|
||||
def updateDependentFields(self):
|
||||
sender = self.sender()
|
||||
if not isinstance(sender, QComboBox):
|
||||
return
|
||||
if not sender.name in self.dependentItems:
|
||||
if sender.name not in self.dependentItems:
|
||||
return
|
||||
layer = sender.itemData(sender.currentIndex())
|
||||
children = self.dependentItems[sender.name]
|
||||
@ -79,7 +79,7 @@ class FieldsMapperParametersPanel(ParametersPanel):
|
||||
widget = self.valueItems[child]
|
||||
if isinstance(widget, FieldsMappingPanel):
|
||||
widget.setLayer(layer)
|
||||
|
||||
|
||||
def somethingDependsOnThisParameter(self, parent):
|
||||
for param in self.alg.parameters:
|
||||
if isinstance(param, ParameterFieldsMapping):
|
||||
@ -96,13 +96,13 @@ class FieldsMapperParametersDialog(AlgorithmDialog):
|
||||
|
||||
self.mainWidget = FieldsMapperParametersPanel(self, alg)
|
||||
self.setMainWidget()
|
||||
|
||||
|
||||
def setParamValue(self, param, widget, alg=None):
|
||||
if isinstance(param, ParameterFieldsMapping):
|
||||
return param.setValue(widget.value())
|
||||
return AlgorithmDialog.setParamValue(self, param, widget, alg)
|
||||
|
||||
|
||||
|
||||
class FieldsMapperModelerParametersDialog(ModelerParametersDialog):
|
||||
|
||||
def __init__(self, alg, model, algName=None):
|
||||
@ -118,7 +118,7 @@ class FieldsMapperModelerParametersDialog(ModelerParametersDialog):
|
||||
if isinstance(param, ParameterFieldsMapping):
|
||||
return FieldsMappingPanel()
|
||||
return ModelerParametersDialog.getWidgetFromParameter(self, param)
|
||||
|
||||
|
||||
def setPreviousValues(self):
|
||||
ModelerParametersDialog.setPreviousValues(self)
|
||||
if self._algName is not None:
|
||||
|
@ -454,7 +454,7 @@ class FieldsMappingPanel(QtGui.QWidget, Ui_Form):
|
||||
|
||||
def updateLayerCombo(self):
|
||||
layers = dataobjects.getVectorLayers()
|
||||
layers.sort(key = lambda lay: lay.name())
|
||||
layers.sort(key=lambda lay: lay.name())
|
||||
for layer in layers:
|
||||
self.layerCombo.addItem(layer.name(), layer)
|
||||
|
||||
|
@ -77,7 +77,7 @@ class GeometryPredicateSelectionPanel(QWidget, Ui_Form):
|
||||
|
||||
def updatePredicates(self):
|
||||
if (isinstance(self.leftLayer, QgsVectorLayer)
|
||||
and isinstance(self.rightLayer, QgsVectorLayer)):
|
||||
and isinstance(self.rightLayer, QgsVectorLayer)):
|
||||
leftType = self.leftLayer.geometryType()
|
||||
rightType = self.rightLayer.geometryType()
|
||||
unusablePredicates = self.unusablePredicates[leftType][rightType]
|
||||
@ -86,7 +86,7 @@ class GeometryPredicateSelectionPanel(QWidget, Ui_Form):
|
||||
for predicate in ParameterGeometryPredicate.predicates:
|
||||
widget = self.getWidget(predicate)
|
||||
widget.setEnabled(predicate in self.enabledPredicated
|
||||
and not predicate in unusablePredicates)
|
||||
and predicate not in unusablePredicates)
|
||||
|
||||
def setRows(self, rows):
|
||||
widgets = []
|
||||
|
@ -206,18 +206,18 @@ class QgsBrowserTreeFilterProxyModel : public QSortFilterProxyModel
|
||||
|
||||
// returns true if at least one ancestor is accepted by filter
|
||||
bool filterAcceptsAncestor( const QModelIndex &sourceIndex ) const
|
||||
{
|
||||
if ( !mModel )
|
||||
return true;
|
||||
{
|
||||
if ( !mModel )
|
||||
return true;
|
||||
|
||||
QModelIndex sourceParentIndex = mModel->parent( sourceIndex );
|
||||
if ( !sourceParentIndex.isValid() )
|
||||
return false;
|
||||
if ( filterAcceptsItem( sourceParentIndex ) )
|
||||
return true;
|
||||
QModelIndex sourceParentIndex = mModel->parent( sourceIndex );
|
||||
if ( !sourceParentIndex.isValid() )
|
||||
return false;
|
||||
if ( filterAcceptsItem( sourceParentIndex ) )
|
||||
return true;
|
||||
|
||||
return filterAcceptsAncestor( sourceParentIndex );
|
||||
}
|
||||
return filterAcceptsAncestor( sourceParentIndex );
|
||||
}
|
||||
|
||||
// returns true if at least one descendant s accepted by filter
|
||||
bool filterAcceptsDescendant( const QModelIndex &sourceIndex ) const
|
||||
|
@ -52,7 +52,7 @@ namespace pal
|
||||
const char* what() const throw() override
|
||||
{
|
||||
return "This set is full...";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief Thrown when trying to access an empty dada set
|
||||
@ -62,7 +62,7 @@ namespace pal
|
||||
const char* what() const throw() override
|
||||
{
|
||||
return "This set is empty...";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief Thrown when a geometry type is not like expected
|
||||
@ -72,7 +72,7 @@ namespace pal
|
||||
const char* what() const throw() override
|
||||
{
|
||||
return "GeometryTypeId is not expected...";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief Thrown when a geometry type is not like expected
|
||||
@ -82,7 +82,7 @@ namespace pal
|
||||
const char* what() const throw() override
|
||||
{
|
||||
return "Geometry Type is unknown";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ namespace pal
|
||||
const char * what() const throw() override
|
||||
{
|
||||
return "No way to compute positions";
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace pal
|
||||
const char * what() const throw() override
|
||||
{
|
||||
return "Not yet implemented... sorry";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief Try to access an unknown feature
|
||||
@ -63,7 +63,7 @@ namespace pal
|
||||
const char * what() const throw() override
|
||||
{
|
||||
return "Feature not found";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief Try to access an unknown layer
|
||||
@ -73,7 +73,7 @@ namespace pal
|
||||
const char * what() const throw() override
|
||||
{
|
||||
return "Layer not found";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief layer already exists
|
||||
@ -83,7 +83,7 @@ namespace pal
|
||||
const char * what() const throw() override
|
||||
{
|
||||
return "Layers names must be unique";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief features already exists
|
||||
@ -93,7 +93,7 @@ namespace pal
|
||||
const char * what() const throw() override
|
||||
{
|
||||
return "Features IDs must be unique within a layer";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief thrown when a value is not in the valid scale range
|
||||
@ -109,7 +109,7 @@ namespace pal
|
||||
const char * what() const throw() override
|
||||
{
|
||||
return "value not allowed";
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -522,10 +522,10 @@ class CORE_EXPORT QgsExpression
|
||||
|
||||
virtual QStringList referencedColumns() const override { QStringList lst( mNode->referencedColumns() ); foreach ( Node* n, mList->list() ) lst.append( n->referencedColumns() ); return lst; }
|
||||
virtual bool needsGeometry() const override { bool needs = false; foreach ( Node* n, mList->list() ) needs |= n->needsGeometry(); return needs; }
|
||||
virtual void accept( Visitor& v ) const override { v.visit( *this ); }
|
||||
virtual void accept( Visitor& v ) const override { v.visit( *this ); }
|
||||
|
||||
protected:
|
||||
Node* mNode;
|
||||
protected:
|
||||
Node* mNode;
|
||||
NodeList* mList;
|
||||
bool mNotIn;
|
||||
};
|
||||
|
@ -35,7 +35,7 @@ class QgisVisitor : public SpatialIndex::IVisitor
|
||||
: mList( list ) {}
|
||||
|
||||
void visitNode( const INode& n ) override
|
||||
{ Q_UNUSED( n ); }
|
||||
{ Q_UNUSED( n ); }
|
||||
|
||||
void visitData( const IData& d ) override
|
||||
{
|
||||
@ -43,7 +43,7 @@ class QgisVisitor : public SpatialIndex::IVisitor
|
||||
}
|
||||
|
||||
void visitData( std::vector<const IData*>& v ) override
|
||||
{ Q_UNUSED( v ); }
|
||||
{ Q_UNUSED( v ); }
|
||||
|
||||
private:
|
||||
QList<QgsFeatureId>& mList;
|
||||
@ -56,7 +56,7 @@ class QgsSpatialIndexCopyVisitor : public SpatialIndex::IVisitor
|
||||
: mNewIndex( newIndex ) {}
|
||||
|
||||
void visitNode( const INode& n ) override
|
||||
{ Q_UNUSED( n ); }
|
||||
{ Q_UNUSED( n ); }
|
||||
|
||||
void visitData( const IData& d ) override
|
||||
{
|
||||
@ -67,7 +67,7 @@ class QgsSpatialIndexCopyVisitor : public SpatialIndex::IVisitor
|
||||
}
|
||||
|
||||
void visitData( std::vector<const IData*>& v ) override
|
||||
{ Q_UNUSED( v ); }
|
||||
{ Q_UNUSED( v ); }
|
||||
|
||||
private:
|
||||
SpatialIndex::ISpatialIndex* mNewIndex;
|
||||
|
@ -226,7 +226,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
|
||||
virtual QStringList subLayers() const override
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief Returns the legend rendered as pixmap
|
||||
*
|
||||
|
@ -107,9 +107,9 @@ class CORE_EXPORT QgsRendererV2Metadata : public QgsRendererV2AbstractMetadata
|
||||
|
||||
virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) override { return mCreateFunc ? mCreateFunc( elem ) : NULL; }
|
||||
virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) override
|
||||
{ return mWidgetFunc ? mWidgetFunc( layer, style, renderer ) : NULL; }
|
||||
{ return mWidgetFunc ? mWidgetFunc( layer, style, renderer ) : NULL; }
|
||||
virtual QgsFeatureRendererV2* createRendererFromSld( QDomElement& elem, QGis::GeometryType geomType ) override
|
||||
{ return mCreateFromSldFunc ? mCreateFromSldFunc( elem, geomType ) : NULL; }
|
||||
{ return mCreateFromSldFunc ? mCreateFromSldFunc( elem, geomType ) : NULL; }
|
||||
|
||||
//! @note not available in python bindings
|
||||
QgsRendererV2CreateFunc createFunction() const { return mCreateFunc; }
|
||||
|
@ -38,35 +38,35 @@ class CustomLayerOrderModel : public QAbstractListModel
|
||||
int rowCount( const QModelIndex & ) const override
|
||||
{
|
||||
return mOrder.count();
|
||||
}
|
||||
}
|
||||
|
||||
QVariant data( const QModelIndex &index, int role ) const override
|
||||
{
|
||||
QString id = mOrder.at( index.row() );
|
||||
|
||||
if ( role == Qt::DisplayRole )
|
||||
{
|
||||
QgsMapLayer* layer = QgsMapLayerRegistry::instance()->mapLayer( id );
|
||||
if ( layer )
|
||||
return layer->name();
|
||||
}
|
||||
{
|
||||
QgsMapLayer* layer = QgsMapLayerRegistry::instance()->mapLayer( id );
|
||||
if ( layer )
|
||||
return layer->name();
|
||||
}
|
||||
|
||||
if ( role == Qt::UserRole + 1 )
|
||||
{
|
||||
QgsMapLayer* layer = QgsMapLayerRegistry::instance()->mapLayer( id );
|
||||
if ( layer )
|
||||
return layer->id();
|
||||
}
|
||||
if ( role == Qt::UserRole + 1 )
|
||||
{
|
||||
QgsMapLayer* layer = QgsMapLayerRegistry::instance()->mapLayer( id );
|
||||
if ( layer )
|
||||
return layer->id();
|
||||
}
|
||||
|
||||
if ( role == Qt::CheckStateRole )
|
||||
{
|
||||
QgsLayerTreeLayer* nodeLayer = mBridge->rootGroup()->findLayer( id );
|
||||
if ( nodeLayer )
|
||||
return nodeLayer->isVisible();
|
||||
}
|
||||
if ( role == Qt::CheckStateRole )
|
||||
{
|
||||
QgsLayerTreeLayer* nodeLayer = mBridge->rootGroup()->findLayer( id );
|
||||
if ( nodeLayer )
|
||||
return nodeLayer->isVisible();
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool setData( const QModelIndex &index, const QVariant &value, int role ) override
|
||||
{
|
||||
@ -86,57 +86,57 @@ class CustomLayerOrderModel : public QAbstractListModel
|
||||
Qt::ItemFlags flags( const QModelIndex &index ) const override
|
||||
{
|
||||
if ( !index.isValid() )
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled;
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled;
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable;
|
||||
}
|
||||
|
||||
Qt::DropActions supportedDropActions() const override
|
||||
{
|
||||
return Qt::MoveAction;
|
||||
}
|
||||
{
|
||||
return Qt::MoveAction;
|
||||
}
|
||||
|
||||
QStringList mimeTypes() const override
|
||||
{
|
||||
QStringList types;
|
||||
types << "application/qgis.layerorderdata";
|
||||
return types;
|
||||
}
|
||||
QStringList mimeTypes() const override
|
||||
{
|
||||
QStringList types;
|
||||
types << "application/qgis.layerorderdata";
|
||||
return types;
|
||||
}
|
||||
|
||||
QMimeData* mimeData( const QModelIndexList& indexes ) const override
|
||||
{
|
||||
QStringList lst;
|
||||
foreach ( QModelIndex index, indexes )
|
||||
QMimeData* mimeData( const QModelIndexList& indexes ) const override
|
||||
{
|
||||
QStringList lst;
|
||||
foreach ( QModelIndex index, indexes )
|
||||
lst << data( index, Qt::UserRole + 1 ).toString();
|
||||
|
||||
QMimeData* mimeData = new QMimeData();
|
||||
mimeData->setData( "application/qgis.layerorderdata", lst.join( "\n" ).toUtf8() );
|
||||
return mimeData;
|
||||
}
|
||||
QMimeData* mimeData = new QMimeData();
|
||||
mimeData->setData( "application/qgis.layerorderdata", lst.join( "\n" ).toUtf8() );
|
||||
return mimeData;
|
||||
}
|
||||
|
||||
bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
Q_UNUSED( column );
|
||||
|
||||
if ( action == Qt::IgnoreAction )
|
||||
return true;
|
||||
|
||||
if ( !data->hasFormat( "application/qgis.layerorderdata" ) )
|
||||
return false;
|
||||
|
||||
QByteArray encodedData = data->data( "application/qgis.layerorderdata" );
|
||||
QStringList lst = QString::fromUtf8( encodedData ).split( "\n" );
|
||||
|
||||
if ( row < 0 )
|
||||
row = mOrder.count();
|
||||
|
||||
beginInsertRows( QModelIndex(), row, row + lst.count() - 1 );
|
||||
for ( int i = 0; i < lst.count(); ++i )
|
||||
mOrder.insert( row + i, lst[i] );
|
||||
endInsertRows();
|
||||
bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
Q_UNUSED( column );
|
||||
|
||||
if ( action == Qt::IgnoreAction )
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !data->hasFormat( "application/qgis.layerorderdata" ) )
|
||||
return false;
|
||||
|
||||
QByteArray encodedData = data->data( "application/qgis.layerorderdata" );
|
||||
QStringList lst = QString::fromUtf8( encodedData ).split( "\n" );
|
||||
|
||||
if ( row < 0 )
|
||||
row = mOrder.count();
|
||||
|
||||
beginInsertRows( QModelIndex(), row, row + lst.count() - 1 );
|
||||
for ( int i = 0; i < lst.count(); ++i )
|
||||
mOrder.insert( row + i, lst[i] );
|
||||
endInsertRows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool removeRows( int row, int count, const QModelIndex& parent ) override
|
||||
{
|
||||
|
@ -38,28 +38,28 @@ class QgsExpressionItemSearchProxy : public QSortFilterProxyModel
|
||||
bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override
|
||||
{
|
||||
if ( source_parent == qobject_cast<QStandardItemModel*>( sourceModel() )->invisibleRootItem()->index() )
|
||||
return true;
|
||||
return true;
|
||||
|
||||
return QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/** An expression item that can be used in the QgsExpressionBuilderWidget tree.
|
||||
*/
|
||||
class QgsExpressionItem : public QStandardItem
|
||||
{
|
||||
public:
|
||||
enum ItemType
|
||||
{
|
||||
Header,
|
||||
Field,
|
||||
ExpressionNode
|
||||
};
|
||||
public:
|
||||
enum ItemType
|
||||
{
|
||||
Header,
|
||||
Field,
|
||||
ExpressionNode
|
||||
};
|
||||
|
||||
QgsExpressionItem( QString label,
|
||||
QString expressionText,
|
||||
QString helpText,
|
||||
QgsExpressionItem::ItemType itemType = ExpressionNode )
|
||||
QgsExpressionItem( QString label,
|
||||
QString expressionText,
|
||||
QString helpText,
|
||||
QgsExpressionItem::ItemType itemType = ExpressionNode )
|
||||
: QStandardItem( label )
|
||||
{
|
||||
mExpressionText = expressionText;
|
||||
|
@ -47,37 +47,37 @@ class GUI_EXPORT QgsLongLongValidator : public QValidator
|
||||
QValidator::State validate( QString &input, int& ) const override
|
||||
{
|
||||
if ( input.isEmpty() )
|
||||
return Intermediate;
|
||||
return Intermediate;
|
||||
|
||||
if ( b >= 0 && input.startsWith( '-' ) )
|
||||
return Invalid;
|
||||
|
||||
if ( t < 0 && input.startsWith( '+' ) )
|
||||
return Invalid;
|
||||
if ( t < 0 && input.startsWith( '+' ) )
|
||||
return Invalid;
|
||||
|
||||
if ( input == "-" || input == "+" )
|
||||
return Intermediate;
|
||||
if ( input == "-" || input == "+" )
|
||||
return Intermediate;
|
||||
|
||||
|
||||
bool ok;
|
||||
qlonglong entered = input.toLongLong( &ok );
|
||||
if ( !ok )
|
||||
return Invalid;
|
||||
bool ok;
|
||||
qlonglong entered = input.toLongLong( &ok );
|
||||
if ( !ok )
|
||||
return Invalid;
|
||||
|
||||
if ( entered >= b && entered <= t )
|
||||
return Acceptable;
|
||||
if ( entered >= b && entered <= t )
|
||||
return Acceptable;
|
||||
|
||||
if ( entered >= 0 )
|
||||
{
|
||||
// the -entered < b condition is necessary to allow people to type
|
||||
// the minus last (e.g. for right-to-left languages)
|
||||
return ( entered > t && -entered < b ) ? Invalid : Intermediate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( entered < b ) ? Invalid : Intermediate;
|
||||
}
|
||||
}
|
||||
if ( entered >= 0 )
|
||||
{
|
||||
// the -entered < b condition is necessary to allow people to type
|
||||
// the minus last (e.g. for right-to-left languages)
|
||||
return ( entered > t && -entered < b ) ? Invalid : Intermediate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( entered < b ) ? Invalid : Intermediate;
|
||||
}
|
||||
}
|
||||
|
||||
void setBottom( qint64 bottom ) { b = bottom; }
|
||||
void setTop( qint64 top ) { t = top; }
|
||||
|
@ -125,11 +125,11 @@ void QgsMapOverviewCanvas::drawExtentRect()
|
||||
const QPolygonF& vPoly = mMapCanvas->mapSettings().visiblePolygon();
|
||||
const QgsMapToPixel& cXf = mSettings.mapToPixel();
|
||||
QVector< QPoint > pts;
|
||||
pts.push_back( cXf.transform( QgsPoint(vPoly[0]) ).toQPointF().toPoint() );
|
||||
pts.push_back( cXf.transform( QgsPoint(vPoly[1]) ).toQPointF().toPoint() );
|
||||
pts.push_back( cXf.transform( QgsPoint(vPoly[2]) ).toQPointF().toPoint() );
|
||||
pts.push_back( cXf.transform( QgsPoint(vPoly[3]) ).toQPointF().toPoint() );
|
||||
mPanningWidget->setPolygon( QPolygon(pts) );
|
||||
pts.push_back( cXf.transform( QgsPoint( vPoly[0] ) ).toQPointF().toPoint() );
|
||||
pts.push_back( cXf.transform( QgsPoint( vPoly[1] ) ).toQPointF().toPoint() );
|
||||
pts.push_back( cXf.transform( QgsPoint( vPoly[2] ) ).toQPointF().toPoint() );
|
||||
pts.push_back( cXf.transform( QgsPoint( vPoly[3] ) ).toQPointF().toPoint() );
|
||||
mPanningWidget->setPolygon( QPolygon( pts ) );
|
||||
mPanningWidget->show(); // show if hidden
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class TreeFilterProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
QgsCptCityDataItem* item = mModel->dataItem( mModel->index( sourceRow, 0, sourceParent ) );
|
||||
return ( item && !( item->type() == QgsCptCityDataItem::ColorRamp ) );
|
||||
}
|
||||
}
|
||||
// bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
||||
|
||||
private:
|
||||
|
@ -1542,47 +1542,47 @@ class QgsSvgListModel : public QAbstractListModel
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
return mSvgFiles.count();
|
||||
}
|
||||
}
|
||||
|
||||
QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const override
|
||||
{
|
||||
QString entry = mSvgFiles.at( index.row() );
|
||||
|
||||
if ( role == Qt::DecorationRole ) // icon
|
||||
{
|
||||
QPixmap pixmap;
|
||||
if ( !QPixmapCache::find( entry, pixmap ) )
|
||||
{
|
||||
// render SVG file
|
||||
QColor fill, outline;
|
||||
double outlineWidth;
|
||||
bool fillParam, outlineParam, outlineWidthParam;
|
||||
QgsSvgCache::instance()->containsParams( entry, fillParam, fill, outlineParam, outline, outlineWidthParam, outlineWidth );
|
||||
QPixmap pixmap;
|
||||
if ( !QPixmapCache::find( entry, pixmap ) )
|
||||
{
|
||||
// render SVG file
|
||||
QColor fill, outline;
|
||||
double outlineWidth;
|
||||
bool fillParam, outlineParam, outlineWidthParam;
|
||||
QgsSvgCache::instance()->containsParams( entry, fillParam, fill, outlineParam, outline, outlineWidthParam, outlineWidth );
|
||||
|
||||
bool fitsInCache; // should always fit in cache at these sizes (i.e. under 559 px ^ 2, or half cache size)
|
||||
const QImage& img = QgsSvgCache::instance()->svgAsImage( entry, 30.0, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, 1.0, fitsInCache );
|
||||
pixmap = QPixmap::fromImage( img );
|
||||
QPixmapCache::insert( entry, pixmap );
|
||||
bool fitsInCache; // should always fit in cache at these sizes (i.e. under 559 px ^ 2, or half cache size)
|
||||
const QImage& img = QgsSvgCache::instance()->svgAsImage( entry, 30.0, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, 1.0, fitsInCache );
|
||||
pixmap = QPixmap::fromImage( img );
|
||||
QPixmapCache::insert( entry, pixmap );
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
else if ( role == Qt::UserRole || role == Qt::ToolTipRole )
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
return QVariant();
|
||||
}
|
||||
else if ( role == Qt::UserRole || role == Qt::ToolTipRole )
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
protected:
|
||||
QStringList mSvgFiles;
|
||||
protected:
|
||||
QStringList mSvgFiles;
|
||||
};
|
||||
|
||||
class QgsSvgGroupsModel : public QStandardItemModel
|
||||
{
|
||||
public:
|
||||
QgsSvgGroupsModel( QObject* parent ) : QStandardItemModel( parent )
|
||||
public:
|
||||
QgsSvgGroupsModel( QObject* parent ) : QStandardItemModel( parent )
|
||||
{
|
||||
QStringList svgPaths = QgsApplication::svgPaths();
|
||||
QStandardItem *parentItem = invisibleRootItem();
|
||||
|
@ -35,14 +35,14 @@ class SpinBoxDelegate : public QItemDelegate
|
||||
editor->setMinimum( 0 );
|
||||
editor->setMaximum( 999 );
|
||||
return editor;
|
||||
}
|
||||
}
|
||||
|
||||
void setEditorData( QWidget *editor, const QModelIndex &index ) const override
|
||||
{
|
||||
int value = index.model()->data( index, Qt::EditRole ).toInt();
|
||||
QSpinBox *spinBox = static_cast<QSpinBox*>( editor );
|
||||
spinBox->setValue( value );
|
||||
}
|
||||
}
|
||||
|
||||
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override
|
||||
{
|
||||
@ -51,12 +51,12 @@ class SpinBoxDelegate : public QItemDelegate
|
||||
int value = spinBox->value();
|
||||
|
||||
model->setData( index, value, Qt::EditRole );
|
||||
}
|
||||
}
|
||||
|
||||
void updateEditorGeometry( QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex & /*index*/ ) const override
|
||||
{
|
||||
editor->setGeometry( option.rect );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -110,31 +110,31 @@ class SymbolLayerItem : public QStandardItem
|
||||
QVariant data( int role ) const override
|
||||
{
|
||||
if ( role == Qt::DisplayRole || role == Qt::EditRole )
|
||||
{
|
||||
if ( mIsLayer )
|
||||
return QgsSymbolLayerV2Registry::instance()->symbolLayerMetadata( mLayer->layerType() )->visibleName();
|
||||
else
|
||||
{
|
||||
switch ( mSymbol->type() )
|
||||
if ( mIsLayer )
|
||||
return QgsSymbolLayerV2Registry::instance()->symbolLayerMetadata( mLayer->layerType() )->visibleName();
|
||||
else
|
||||
{
|
||||
case QgsSymbolV2::Marker : return "Marker";
|
||||
case QgsSymbolV2::Fill : return "Fill";
|
||||
case QgsSymbolV2::Line : return "Line";
|
||||
default: return "Symbol";
|
||||
switch ( mSymbol->type() )
|
||||
{
|
||||
case QgsSymbolV2::Marker : return "Marker";
|
||||
case QgsSymbolV2::Fill : return "Fill";
|
||||
case QgsSymbolV2::Line : return "Line";
|
||||
default: return "Symbol";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( role == Qt::SizeHintRole )
|
||||
return QVariant( QSize( 32, 32 ) );
|
||||
if ( role == Qt::CheckStateRole )
|
||||
return QVariant(); // could be true/false
|
||||
if ( role == Qt::SizeHintRole )
|
||||
return QVariant( QSize( 32, 32 ) );
|
||||
if ( role == Qt::CheckStateRole )
|
||||
return QVariant(); // could be true/false
|
||||
return QStandardItem::data( role );
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
QgsSymbolLayerV2* mLayer;
|
||||
QgsSymbolV2* mSymbol;
|
||||
bool mIsLayer;
|
||||
protected:
|
||||
QgsSymbolLayerV2* mLayer;
|
||||
QgsSymbolV2* mSymbol;
|
||||
bool mIsLayer;
|
||||
};
|
||||
|
||||
//////////
|
||||
|
@ -31,7 +31,7 @@ class QgsNonEditableDelegate : public QStyledItemDelegate
|
||||
Q_UNUSED( option );
|
||||
Q_UNUSED( index );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class QgsDmsAndDdDelegate : public QStyledItemDelegate
|
||||
|
@ -28,57 +28,57 @@ class QgsValidatedDoubleSpinBox : public QDoubleSpinBox
|
||||
{
|
||||
QValidator::State state = QDoubleSpinBox::validate( input, pos );
|
||||
if ( state != QValidator::Acceptable )
|
||||
{
|
||||
return state;
|
||||
}
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
// A value of zero is acceptable as intermediate result,
|
||||
// but not as final entry
|
||||
double val = valueFromText( input );
|
||||
if ( val == 0.0 )
|
||||
{
|
||||
return QValidator::Intermediate;
|
||||
}
|
||||
return QValidator::Acceptable;
|
||||
}
|
||||
// A value of zero is acceptable as intermediate result,
|
||||
// but not as final entry
|
||||
double val = valueFromText( input );
|
||||
if ( val == 0.0 )
|
||||
{
|
||||
return QValidator::Intermediate;
|
||||
}
|
||||
return QValidator::Acceptable;
|
||||
}
|
||||
|
||||
StepEnabled stepEnabled() const override
|
||||
StepEnabled stepEnabled() const override
|
||||
{
|
||||
StepEnabled mayStep = StepNone;
|
||||
|
||||
// Zero is off limits, so handle the logic differently
|
||||
// (always exclude zero from the permitted interval)
|
||||
if ( minimum() == 0.0 )
|
||||
{
|
||||
if ( value() - singleStep() > minimum() )
|
||||
{
|
||||
mayStep |= StepDownEnabled;
|
||||
if ( value() - singleStep() > minimum() )
|
||||
{
|
||||
mayStep |= StepDownEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // closed interval
|
||||
{
|
||||
if ( value() - singleStep() >= minimum() )
|
||||
else // closed interval
|
||||
{
|
||||
mayStep |= StepDownEnabled;
|
||||
if ( value() - singleStep() >= minimum() )
|
||||
{
|
||||
mayStep |= StepDownEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( maximum() == 0.0 )
|
||||
{
|
||||
if ( value() + singleStep() < maximum() )
|
||||
if ( maximum() == 0.0 )
|
||||
{
|
||||
mayStep |= StepUpEnabled;
|
||||
if ( value() + singleStep() < maximum() )
|
||||
{
|
||||
mayStep |= StepUpEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( value() + singleStep() <= maximum() )
|
||||
else
|
||||
{
|
||||
mayStep |= StepUpEnabled;
|
||||
if ( value() + singleStep() <= maximum() )
|
||||
{
|
||||
mayStep |= StepUpEnabled;
|
||||
}
|
||||
}
|
||||
return mayStep;
|
||||
}
|
||||
return mayStep;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -60,7 +60,7 @@ namespace osgEarth
|
||||
{
|
||||
//All QGIS tiles are in JPEG format
|
||||
return "jpg";
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool supportsPersistentCaching() const
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ class QgsGrassEditLayer : public QgsMapCanvasItem
|
||||
virtual QRectF boundingRect() const override
|
||||
{
|
||||
return QRectF( 0, 0, mMapCanvas->width(), mMapCanvas->height() );
|
||||
}
|
||||
}
|
||||
|
||||
virtual void updatePosition() override
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ class QgsGrassMapcalc: public QMainWindow, private Ui::QgsGrassMapcalcBase,
|
||||
bool inputRegion( struct Cell_head *window, QgsCoordinateReferenceSystem & crs, bool all ) override;
|
||||
QStringList output( int type ) override;
|
||||
bool hasOutput( int type ) override
|
||||
{ Q_UNUSED( type ); return true; }
|
||||
{ Q_UNUSED( type ); return true; }
|
||||
|
||||
/** \brief receives contentsMousePressEvent from view */
|
||||
void mousePressEvent( QMouseEvent* ) override;
|
||||
|
@ -53,7 +53,7 @@ class DummyColorScheme : public QgsColorScheme
|
||||
virtual QgsColorScheme* clone() const override
|
||||
{
|
||||
return new DummyColorScheme();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -54,7 +54,7 @@ class DummyColorScheme : public QgsColorScheme
|
||||
virtual QgsColorScheme* clone() const override
|
||||
{
|
||||
return new DummyColorScheme();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user