Skip to content
Permalink
Browse files

run astyle on src/gui

  • Loading branch information
3nids committed Mar 3, 2017
1 parent 40c056c commit e7079eead96462db12a0bc16125f8cfee17e7af1
Showing 599 changed files with 8,575 additions and 8,571 deletions.
@@ -31,7 +31,7 @@
#include "qgsactionmanager.h"


QgsVectorLayer* QgsAttributeTableDelegate::layer( const QAbstractItemModel *model )
QgsVectorLayer *QgsAttributeTableDelegate::layer( const QAbstractItemModel *model )
{
const QgsAttributeTableModel *tm = qobject_cast<const QgsAttributeTableModel *>( model );
if ( tm )
@@ -44,7 +44,7 @@ QgsVectorLayer* QgsAttributeTableDelegate::layer( const QAbstractItemModel *mode
return nullptr;
}

const QgsAttributeTableModel* QgsAttributeTableDelegate::masterModel( const QAbstractItemModel* model )
const QgsAttributeTableModel *QgsAttributeTableDelegate::masterModel( const QAbstractItemModel *model )
{
const QgsAttributeTableModel *tm = qobject_cast<const QgsAttributeTableModel *>( model );
if ( tm )
@@ -57,7 +57,7 @@ const QgsAttributeTableModel* QgsAttributeTableDelegate::masterModel( const QAbs
return nullptr;
}

QWidget* QgsAttributeTableDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
QWidget *QgsAttributeTableDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
Q_UNUSED( option );
QgsVectorLayer *vl = layer( index.model() );
@@ -67,8 +67,8 @@ QWidget* QgsAttributeTableDelegate::createEditor( QWidget *parent, const QStyleO
int fieldIdx = index.model()->data( index, QgsAttributeTableModel::FieldIndexRole ).toInt();

QgsAttributeEditorContext context( masterModel( index.model() )->editorContext(), QgsAttributeEditorContext::Popup );
QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( vl, fieldIdx, nullptr, parent, context );
QWidget* w = eww->widget();
QgsEditorWidgetWrapper *eww = QgsEditorWidgetRegistry::instance()->create( vl, fieldIdx, nullptr, parent, context );
QWidget *w = eww->widget();

w->setAutoFillBackground( true );
w->setFocusPolicy( Qt::StrongFocus ); // to make sure QMouseEvents are propagated to the editor widget
@@ -89,13 +89,13 @@ void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemMode
QVariant oldValue = model->data( index, Qt::EditRole );

QVariant newValue;
QgsEditorWidgetWrapper* eww = QgsEditorWidgetWrapper::fromWidget( editor );
QgsEditorWidgetWrapper *eww = QgsEditorWidgetWrapper::fromWidget( editor );
if ( !eww )
return;

newValue = eww->value();

if (( oldValue != newValue && newValue.isValid() ) || oldValue.isNull() != newValue.isNull() )
if ( ( oldValue != newValue && newValue.isValid() ) || oldValue.isNull() != newValue.isNull() )
{
vl->beginEditCommand( tr( "Attribute changed" ) );
vl->changeAttributeValue( fid, fieldIdx, newValue, oldValue );
@@ -105,7 +105,7 @@ void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemMode

void QgsAttributeTableDelegate::setEditorData( QWidget *editor, const QModelIndex &index ) const
{
QgsEditorWidgetWrapper* eww = QgsEditorWidgetWrapper::fromWidget( editor );
QgsEditorWidgetWrapper *eww = QgsEditorWidgetWrapper::fromWidget( editor );
if ( !eww )
return;

@@ -117,7 +117,7 @@ void QgsAttributeTableDelegate::setFeatureSelectionModel( QgsFeatureSelectionMod
mFeatureSelectionModel = featureSelectionModel;
}

void QgsAttributeTableDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
void QgsAttributeTableDelegate::paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
QgsAttributeTableFilterModel::ColumnType columnType = static_cast<QgsAttributeTableFilterModel::ColumnType>( index.model()->data( index, QgsAttributeTableFilterModel::TypeRole ).toInt() );

@@ -34,32 +34,32 @@ class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate
{
Q_OBJECT

static QgsVectorLayer* layer( const QAbstractItemModel* model );
static const QgsAttributeTableModel* masterModel( const QAbstractItemModel* model );
static QgsVectorLayer *layer( const QAbstractItemModel *model );
static const QgsAttributeTableModel *masterModel( const QAbstractItemModel *model );

public:

/**
* Constructor
* @param parent parent object
*/
QgsAttributeTableDelegate( QObject* parent = nullptr )
: QItemDelegate( parent )
, mLayer( nullptr )
, mFeatureSelectionModel( nullptr )
QgsAttributeTableDelegate( QObject *parent = nullptr )
: QItemDelegate( parent )
, mLayer( nullptr )
, mFeatureSelectionModel( nullptr )
{
}

/**
* Used to create an editor for when the user tries to
* change the contents of a cell
*/
QWidget * createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;

/**
* Overloads the paint method form the QItemDelegate base class
*/
void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const override;
void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;

/**
* Sets data from editor back to model. Overloads default method
@@ -76,7 +76,7 @@ class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate
*/
void setEditorData( QWidget *editor, const QModelIndex &index ) const override;

void setFeatureSelectionModel( QgsFeatureSelectionModel* featureSelectionModel );
void setFeatureSelectionModel( QgsFeatureSelectionModel *featureSelectionModel );

signals:

@@ -88,11 +88,11 @@ class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate
* It is the consumers responsibility to check if initialization has already
* happened before.
*/
void actionColumnItemPainted( const QModelIndex& index ) const;
void actionColumnItemPainted( const QModelIndex &index ) const;

private:
QgsVectorLayer* mLayer = nullptr;
QgsFeatureSelectionModel* mFeatureSelectionModel = nullptr;
QgsVectorLayer *mLayer = nullptr;
QgsFeatureSelectionModel *mFeatureSelectionModel = nullptr;
};

#endif //QGSATTRIBUTETABLEDELEGATE_H
@@ -29,11 +29,11 @@
// Filter Model //
//////////////////

QgsAttributeTableFilterModel::QgsAttributeTableFilterModel( QgsMapCanvas* canvas, QgsAttributeTableModel* sourceModel, QObject* parent )
: QSortFilterProxyModel( parent )
, mCanvas( canvas )
, mFilterMode( ShowAll )
, mSelectedOnTop( false )
QgsAttributeTableFilterModel::QgsAttributeTableFilterModel( QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent )
: QSortFilterProxyModel( parent )
, mCanvas( canvas )
, mFilterMode( ShowAll )
, mSelectedOnTop( false )
{
setSourceModel( sourceModel );
setDynamicSortFilter( true );
@@ -70,7 +70,7 @@ void QgsAttributeTableFilterModel::sort( int column, Qt::SortOrder order )
emit sortColumnChanged( column, order );
}

QVariant QgsAttributeTableFilterModel::data( const QModelIndex& index, int role ) const
QVariant QgsAttributeTableFilterModel::data( const QModelIndex &index, int role ) const
{
if ( mapColumnToSource( index.column() ) == -1 ) // actions
{
@@ -114,20 +114,20 @@ int QgsAttributeTableFilterModel::actionColumnIndex() const
return mColumnMapping.indexOf( -1 );
}

int QgsAttributeTableFilterModel::columnCount( const QModelIndex& parent ) const
int QgsAttributeTableFilterModel::columnCount( const QModelIndex &parent ) const
{
Q_UNUSED( parent );
return mColumnMapping.count();
}

void QgsAttributeTableFilterModel::setAttributeTableConfig( const QgsAttributeTableConfig& config )
void QgsAttributeTableFilterModel::setAttributeTableConfig( const QgsAttributeTableConfig &config )
{
mConfig = config;
mConfig.update( layer()->fields() );

QVector<int> newColumnMapping;

Q_FOREACH ( const QgsAttributeTableConfig::ColumnConfig& columnConfig, mConfig.columns() )
Q_FOREACH ( const QgsAttributeTableConfig::ColumnConfig &columnConfig, mConfig.columns() )
{
// Hidden? Forget about this column
if ( columnConfig.hidden )
@@ -235,7 +235,7 @@ void QgsAttributeTableFilterModel::setSelectedOnTop( bool selectedOnTop )
}
}

void QgsAttributeTableFilterModel::setSourceModel( QgsAttributeTableModel* sourceModel )
void QgsAttributeTableFilterModel::setSourceModel( QgsAttributeTableModel *sourceModel )
{
mTableModel = sourceModel;

@@ -261,7 +261,7 @@ bool QgsAttributeTableFilterModel::selectedOnTop()
return mSelectedOnTop;
}

void QgsAttributeTableFilterModel::setFilteredFeatures( const QgsFeatureIds& ids )
void QgsAttributeTableFilterModel::setFilteredFeatures( const QgsFeatureIds &ids )
{
mFilteredFeatures = ids;
setFilterMode( ShowFilteredList );
@@ -318,7 +318,7 @@ bool QgsAttributeTableFilterModel::filterAcceptsRow( int sourceRow, const QModel

case ShowEdited:
{
QgsVectorLayerEditBuffer* editBuffer = layer()->editBuffer();
QgsVectorLayerEditBuffer *editBuffer = layer()->editBuffer();
if ( editBuffer )
{
QgsFeatureId fid = masterModel()->rowToId( sourceRow );
@@ -387,7 +387,7 @@ void QgsAttributeTableFilterModel::generateListOfVisibleFeatures()
QgsRectangle rect = mCanvas->mapSettings().mapToLayerCoordinates( layer(), mCanvas->extent() );
QgsRenderContext renderContext;
renderContext.expressionContext().appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( layer() ) );
QgsFeatureRenderer* renderer = layer()->renderer();
QgsFeatureRenderer *renderer = layer()->renderer();

mFilteredFeatures.clear();

@@ -397,7 +397,7 @@ void QgsAttributeTableFilterModel::generateListOfVisibleFeatures()
return;
}

const QgsMapSettings& ms = mCanvas->mapSettings();
const QgsMapSettings &ms = mCanvas->mapSettings();
if ( !layer()->isInScaleRange( ms.scale() ) )
{
QgsDebugMsg( "Out of scale limits" );
@@ -461,7 +461,7 @@ void QgsAttributeTableFilterModel::generateListOfVisibleFeatures()
}
}

QgsFeatureId QgsAttributeTableFilterModel::rowToId( const QModelIndex& row )
QgsFeatureId QgsAttributeTableFilterModel::rowToId( const QModelIndex &row )
{
return masterModel()->rowToId( mapToSource( row ).row() );
}
@@ -474,15 +474,15 @@ QModelIndex QgsAttributeTableFilterModel::fidToIndex( QgsFeatureId fid )
QModelIndexList QgsAttributeTableFilterModel::fidToIndexList( QgsFeatureId fid )
{
QModelIndexList indexes;
Q_FOREACH ( const QModelIndex& idx, masterModel()->idToIndexList( fid ) )
Q_FOREACH ( const QModelIndex &idx, masterModel()->idToIndexList( fid ) )
{
indexes.append( mapFromMaster( idx ) );
}

return indexes;
}

QModelIndex QgsAttributeTableFilterModel::mapToSource( const QModelIndex& proxyIndex ) const
QModelIndex QgsAttributeTableFilterModel::mapToSource( const QModelIndex &proxyIndex ) const
{
if ( !proxyIndex.isValid() )
return QModelIndex();
@@ -497,7 +497,7 @@ QModelIndex QgsAttributeTableFilterModel::mapToSource( const QModelIndex& proxyI
return QSortFilterProxyModel::mapToSource( index( proxyIndex.row(), sourceColumn, proxyIndex.parent() ) );
}

QModelIndex QgsAttributeTableFilterModel::mapFromSource( const QModelIndex& sourceIndex ) const
QModelIndex QgsAttributeTableFilterModel::mapFromSource( const QModelIndex &sourceIndex ) const
{
QModelIndex proxyIndex = QSortFilterProxyModel::mapFromSource( sourceIndex );

@@ -508,10 +508,10 @@ QModelIndex QgsAttributeTableFilterModel::mapFromSource( const QModelIndex& sour
if ( col == -1 )
col = 0;

return index( proxyIndex.row(), col , proxyIndex.parent() );
return index( proxyIndex.row(), col, proxyIndex.parent() );
}

Qt::ItemFlags QgsAttributeTableFilterModel::flags( const QModelIndex& index ) const
Qt::ItemFlags QgsAttributeTableFilterModel::flags( const QModelIndex &index ) const
{
// Handle the action column flags here, the master model doesn't know it
if ( mapColumnToSource( index.column() ) == -1 )
@@ -76,7 +76,7 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
* @param sourceModel The QgsAttributeTableModel to use as source (mostly referred to as master model)
* @param canvas The mapCanvas. Used to identify the currently visible features.
*/
QgsAttributeTableFilterModel( QgsMapCanvas* canvas, QgsAttributeTableModel* sourceModel, QObject* parent = nullptr );
QgsAttributeTableFilterModel( QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent = nullptr );

/**
* Set the attribute table model that backs this model
@@ -85,7 +85,7 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
*
* @note added in 2.0
*/
void setSourceModel( QgsAttributeTableModel* sourceModel );
void setSourceModel( QgsAttributeTableModel *sourceModel );

/**
* Changes the sort order of the features. If set to true, selected features
@@ -108,7 +108,7 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
*
* @param ids The list of feature ids which will be accepted by the filter
*/
virtual void setFilteredFeatures( const QgsFeatureIds& ids );
virtual void setFilteredFeatures( const QgsFeatureIds &ids );

/**
* Get a list of currently filtered feature ids
@@ -157,19 +157,19 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
*
* @return The feature id of the feature visible in the provided row
*/
QgsFeatureId rowToId( const QModelIndex& row );
QgsFeatureId rowToId( const QModelIndex &row );

QModelIndex fidToIndex( QgsFeatureId fid ) override;

QModelIndexList fidToIndexList( QgsFeatureId fid );

inline QModelIndex mapToMaster( const QModelIndex& proxyIndex ) const { return mapToSource( proxyIndex ); }
inline QModelIndex mapToMaster( const QModelIndex &proxyIndex ) const { return mapToSource( proxyIndex ); }

inline QModelIndex mapFromMaster( const QModelIndex& sourceIndex ) const { return mapFromSource( sourceIndex ); }
inline QModelIndex mapFromMaster( const QModelIndex &sourceIndex ) const { return mapFromSource( sourceIndex ); }

virtual QModelIndex mapToSource( const QModelIndex& proxyIndex ) const override;
virtual QModelIndex mapToSource( const QModelIndex &proxyIndex ) const override;

virtual QModelIndex mapFromSource( const QModelIndex& sourceIndex ) const override;
virtual QModelIndex mapFromSource( const QModelIndex &sourceIndex ) const override;

virtual Qt::ItemFlags flags( const QModelIndex &index ) const override;

@@ -189,17 +189,17 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
* @param expression The expression which should be used for sorting
* @param order The order ( Qt::AscendingOrder or Qt::DescendingOrder )
*/
void sort( const QString& expression, Qt::SortOrder order = Qt::AscendingOrder );
void sort( const QString &expression, Qt::SortOrder order = Qt::AscendingOrder );

/**
* The expression which is used to sort the attribute table.
*/
QString sortExpression() const;

//! Returns the map canvas
QgsMapCanvas* mapCanvas() const { return mCanvas; }
QgsMapCanvas *mapCanvas() const { return mCanvas; }

virtual QVariant data( const QModelIndex& index, int role ) const override;
virtual QVariant data( const QModelIndex &index, int role ) const override;

QVariant headerData( int section, Qt::Orientation orientation, int role ) const override;

@@ -216,7 +216,7 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
* in which order they are shown as well as if and where an action column
* is shown.
*/
void setAttributeTableConfig( const QgsAttributeTableConfig& config );
void setAttributeTableConfig( const QgsAttributeTableConfig &config );

signals:

@@ -263,10 +263,10 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub

private:
QgsFeatureIds mFilteredFeatures;
QgsMapCanvas* mCanvas = nullptr;
QgsMapCanvas *mCanvas = nullptr;
FilterMode mFilterMode;
bool mSelectedOnTop;
QgsAttributeTableModel* mTableModel = nullptr;
QgsAttributeTableModel *mTableModel = nullptr;

QgsAttributeTableConfig mConfig;
QVector<int> mColumnMapping;

0 comments on commit e7079ee

Please sign in to comment.
You can’t perform that action at this time.