mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-19 00:02:48 -04:00
Fix crash
This commit is contained in:
parent
4730047696
commit
f03a94f650
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user