44 PickerSortFilterProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent), m_minimumMask(0x0), m_pluginName(QString()), m_showPluginsWithoutInstance(
false) {};
47 inline void setPluginMinimumMask(
const int minimumMask )
49 m_minimumMask = minimumMask;
53 inline void setPluginName( QString &name )
59 inline void showPluginsWithoutInstance(
bool show)
61 m_showPluginsWithoutInstance = show;
66 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const
68 QModelIndex idx = sourceModel()->index(sourceRow, 0, sourceParent);
69 int type = sourceModel()->data(idx, Qt::UserRole + 1).toInt();
70 int itemType = sourceModel()->data(idx, Qt::UserRole + 3).toInt();
73 if(!m_showPluginsWithoutInstance)
75 int itemType = sourceModel()->data(idx, Qt::UserRole + 3).toInt();
76 if(itemType == ito::PlugInModel::itemPlugin && sourceModel()->hasChildren(idx) ==
false)
82 if(!m_pluginName.isNull() && itemType == ito::PlugInModel::itemPlugin )
84 if( QString::compare( sourceModel()->data(idx, Qt::DisplayRole).toString(), m_pluginName, Qt::CaseInsensitive ) != 0)
95 return (type & m_minimumMask) == m_minimumMask;
100 QString m_pluginName;
101 bool m_showPluginsWithoutInstance;
114 DialogPluginPicker(
bool allowNewInstances,
ito::AddInBase *currentItem,
int minimumPluginTypeMask = 0x0, QString pluginName = QString(), QWidget *parent = NULL );
122 void itemClicked(
const QModelIndex &index);
123 Ui::DialogPluginPicker ui;
127 void itemDblClicked(
const QModelIndex &index);
128 void showPluginsWithoutInstance(
bool checked);
129 void createNewInstance(
bool checked);
130 void selectionChanged(
const QItemSelection& newSelection,
const QItemSelection& oldSelection);