mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Fix bug in plugin manager introduced by recent changes I made that causes it to not remember loaded plugns properly
git-svn-id: http://svn.osgeo.org/qgis/trunk@8792 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
82971f40a1
commit
e40991ee32
@ -161,8 +161,7 @@ void QgsPluginManager::getPythonPluginDescriptions()
|
||||
//myData.setIcon(pixmap); //todo use a python logo here
|
||||
myData.setCheckable(true);
|
||||
myData.setRenderAsWidget(false);
|
||||
QVariant myVariant = qVariantFromValue(myData);
|
||||
mypDetailItem->setData(myVariant,PLUGIN_DATA_ROLE);
|
||||
myData.setChecked(false); //start off assuming false
|
||||
|
||||
// check to see if the plugin is loaded and set the checkbox accordingly
|
||||
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();
|
||||
@ -177,9 +176,11 @@ void QgsPluginManager::getPythonPluginDescriptions()
|
||||
if (libName == packageName)
|
||||
{
|
||||
// set the checkbox
|
||||
mypDetailItem->setCheckState(Qt::Checked);
|
||||
myData.setChecked(true);
|
||||
}
|
||||
}
|
||||
QVariant myVariant = qVariantFromValue(myData);
|
||||
mypDetailItem->setData(myVariant,PLUGIN_DATA_ROLE);
|
||||
// Add item to model
|
||||
mModelPlugins->appendRow(mypDetailItem);
|
||||
}
|
||||
@ -358,7 +359,9 @@ void QgsPluginManager::unload()
|
||||
{
|
||||
// FPV - I want to use index. You can do evrething with item.
|
||||
QModelIndex myIndex=mModelPlugins->index(row,0);
|
||||
if (mModelPlugins->data(myIndex,Qt::CheckStateRole).toInt() == 0)
|
||||
QgsDetailedItemData myData =
|
||||
qVariantValue<QgsDetailedItemData>(mModelPlugins->data(myIndex,PLUGIN_DATA_ROLE));
|
||||
if (!myData.isChecked())
|
||||
{
|
||||
// iThe plugin name without version string in its data PLUGIN_LIB [ts]
|
||||
myIndex=mModelPlugins->index(row,0);
|
||||
@ -402,7 +405,10 @@ std::vector < QgsPluginItem > QgsPluginManager::getSelectedPlugins()
|
||||
// FPV - I want to use item here. You can do everything with index if you want.
|
||||
for (int row=0;row < mModelPlugins->rowCount();row++)
|
||||
{
|
||||
if (mModelPlugins->item(row,0)->checkState() == Qt::Checked)
|
||||
QgsDetailedItemData myData =
|
||||
qVariantValue<QgsDetailedItemData>(mModelPlugins->item(row,0)->data(PLUGIN_DATA_ROLE));
|
||||
|
||||
if (myData.isChecked())
|
||||
{
|
||||
QString pluginName = mModelPlugins->item(row,0)->data(PLUGIN_LIBRARY_NAME_ROLE).toString();
|
||||
bool pythonic = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user