Skip to content
Permalink
Browse files

Fix crash

  • Loading branch information
m-kuhn committed Apr 29, 2016
1 parent 4730047 commit f03a94f6504d6a155e18c85669db9c8c138dbb8f
@@ -33,13 +33,36 @@ class QgsAction
OpenUrl,
};

QgsAction( ActionType type, const QString& name, const QString& action, bool capture );
/**
* Create a new QgsAction
*
* @param type The type of this action
* @param description A human readable description string
* @param action The action text. Its interpretation depends on the type
* @param capture If this is set to true, the output will be captured when an action is run
*/
QgsAction( ActionType type, const QString& description, const QString& action, bool capture );

QgsAction( ActionType type, const QString& name, const QString& action, const QString& icon, bool capture );

//! The name of the action
/**
* Create a new QgsAction
*
* @param type The type of this action
* @param description A human readable description string
* @param action The action text. Its interpretation depends on the type
* @param icon Path to an icon for this action
* @param capture If this is set to true, the output will be captured when an action is run
* @param shortTitle A short string used to label user interface elements like buttons
*/
QgsAction( ActionType type, const QString& description, const QString& action, const QString& icon, bool capture, const QString& shortTitle = QString() );


//! The name of the action. This may be a longer description.
QString name() const;

//! The short title is used to label user interface elements like buttons
QString shortTitle() const;

//! The path to the icon
QString iconPath() const;

@@ -39,4 +39,9 @@ class QgsAttributeTableDelegate : QItemDelegate
void setEditorData( QWidget *editor, const QModelIndex &index ) const;

void setFeatureSelectionModel( QgsFeatureSelectionModel* featureSelectionModel );

/**
* Set an image that represents an action widget
*/
void setActionWidgetImage( const QImage& image );
};
@@ -111,13 +111,16 @@ int QgsAttributeTableFilterModel::columnCount( const QModelIndex& parent ) const

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

int columnIndex = 0;
int configIndex = 0;
bool resetModel = false;

for ( ; configIndex < config.columns().size(); ++configIndex )
for ( ; configIndex < mConfig.columns().size(); ++configIndex )
{
const QgsAttributeTableConfig::ColumnConfig& columnConfig = config.columns().at( configIndex );
const QgsAttributeTableConfig::ColumnConfig& columnConfig = mConfig.columns().at( configIndex );

// Hidden? No reason for further checks
if ( columnConfig.mHidden )
@@ -144,7 +147,6 @@ void QgsAttributeTableFilterModel::setAttributeTableConfig( const QgsAttributeTa
resetModel = true;
}


// New column? append
Q_ASSERT( mColumnMapping.size() == columnIndex );
if ( columnConfig.mType == QgsAttributeTableConfig::Action )
@@ -183,6 +185,7 @@ void QgsAttributeTableFilterModel::setSourceModel( QgsAttributeTableModel* sourc
}

QSortFilterProxyModel::setSourceModel( sourceModel );
disconnect( mTableModel, SIGNAL( columnsAboutToBeInserted( QModelIndex, int, int ) ), this, SLOT( onColumnsAboutToBeInserted() ) );
}

bool QgsAttributeTableFilterModel::selectedOnTop()
@@ -290,6 +293,11 @@ void QgsAttributeTableFilterModel::selectionChanged()
}
}

void QgsAttributeTableFilterModel::onColumnsAboutToBeInserted()
{
setAttributeTableConfig( mConfig );
}

void QgsAttributeTableFilterModel::generateListOfVisibleFeatures()
{
if ( !layer() )
@@ -228,6 +228,7 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub

private slots:
void selectionChanged();
void onColumnsAboutToBeInserted();

private:
QgsFeatureIds mFilteredFeatures;
@@ -236,6 +237,7 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
bool mSelectedOnTop;
QgsAttributeTableModel* mTableModel;

QgsAttributeTableConfig mConfig;
QVector<int> mColumnMapping;
};

0 comments on commit f03a94f

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