@@ -161,8 +161,7 @@ void QgsPluginManager::getPythonPluginDescriptions()
161
161
// myData.setIcon(pixmap); //todo use a python logo here
162
162
myData.setCheckable (true );
163
163
myData.setRenderAsWidget (false );
164
- QVariant myVariant = qVariantFromValue (myData);
165
- mypDetailItem->setData (myVariant,PLUGIN_DATA_ROLE);
164
+ myData.setChecked (false ); // start off assuming false
166
165
167
166
// check to see if the plugin is loaded and set the checkbox accordingly
168
167
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance ();
@@ -177,9 +176,11 @@ void QgsPluginManager::getPythonPluginDescriptions()
177
176
if (libName == packageName)
178
177
{
179
178
// set the checkbox
180
- mypDetailItem-> setCheckState (Qt::Checked );
179
+ myData. setChecked ( true );
181
180
}
182
181
}
182
+ QVariant myVariant = qVariantFromValue (myData);
183
+ mypDetailItem->setData (myVariant,PLUGIN_DATA_ROLE);
183
184
// Add item to model
184
185
mModelPlugins ->appendRow (mypDetailItem);
185
186
}
@@ -358,7 +359,9 @@ void QgsPluginManager::unload()
358
359
{
359
360
// FPV - I want to use index. You can do evrething with item.
360
361
QModelIndex myIndex=mModelPlugins ->index (row,0 );
361
- if (mModelPlugins ->data (myIndex,Qt::CheckStateRole).toInt () == 0 )
362
+ QgsDetailedItemData myData =
363
+ qVariantValue<QgsDetailedItemData>(mModelPlugins ->data (myIndex,PLUGIN_DATA_ROLE));
364
+ if (!myData.isChecked ())
362
365
{
363
366
// iThe plugin name without version string in its data PLUGIN_LIB [ts]
364
367
myIndex=mModelPlugins ->index (row,0 );
@@ -402,7 +405,10 @@ std::vector < QgsPluginItem > QgsPluginManager::getSelectedPlugins()
402
405
// FPV - I want to use item here. You can do everything with index if you want.
403
406
for (int row=0 ;row < mModelPlugins ->rowCount ();row++)
404
407
{
405
- if (mModelPlugins ->item (row,0 )->checkState () == Qt::Checked)
408
+ QgsDetailedItemData myData =
409
+ qVariantValue<QgsDetailedItemData>(mModelPlugins ->item (row,0 )->data (PLUGIN_DATA_ROLE));
410
+
411
+ if (myData.isChecked ())
406
412
{
407
413
QString pluginName = mModelPlugins ->item (row,0 )->data (PLUGIN_LIBRARY_NAME_ROLE).toString ();
408
414
bool pythonic = false ;
0 commit comments