本文整理汇总了C++中Plugin::getIsUserCreatable方法的典型用法代码示例。如果您正苦于以下问题:C++ Plugin::getIsUserCreatable方法的具体用法?C++ Plugin::getIsUserCreatable怎么用?C++ Plugin::getIsUserCreatable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::getIsUserCreatable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
NodeCreationDialog::NodeCreationDialog(const QString& initialFilter,
QWidget* parent)
: QDialog(parent)
, _imp( new NodeCreationDialogPrivate() )
{
setWindowTitle( tr("Node Creation Tool") );
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint);
setObjectName( QString::fromUtf8("nodeCreationDialog") );
setAttribute(Qt::WA_DeleteOnClose, false);
_imp->layout = new QVBoxLayout(this);
_imp->layout->setContentsMargins(0, 0, 0, 0);
CompleterLineEdit::PluginsNamesMap pluginsMap;
QString initialFilterName;
std::string stdInitialFilter = initialFilter.toStdString();
int i = 0;
for (PluginsMap::iterator it = _imp->items.begin(); it != _imp->items.end(); ++it) {
if ( it->second.empty() ) {
continue;
}
if (it->second.size() == 1) {
std::pair<QString, QString> idNamePair;
Plugin* p = ( *it->second.begin() );
if ( !p->getIsUserCreatable() ) {
continue;
}
idNamePair.second = p->generateUserFriendlyPluginID();
int indexOfBracket = idNamePair.second.lastIndexOf( QString::fromUtf8(" [") );
if (indexOfBracket != -1) {
idNamePair.first = idNamePair.second.left(indexOfBracket);
}
int weight = getPluginWeight( p->getPluginID(), p->getMajorVersion() );
pluginsMap.insert( std::make_pair(weight, idNamePair) );
if (it->first == stdInitialFilter) {
initialFilterName = idNamePair.first;
}
++i;
} else {
QString bestMajorName;
for (PluginMajorsOrdered::reverse_iterator it2 = it->second.rbegin(); it2 != it->second.rend(); ++it2) {
if ( !(*it2)->getIsUserCreatable() ) {
continue;
}
std::pair<QString, QString> idNamePair;
if ( it2 == it->second.rbegin() ) {
idNamePair.second = (*it2)->generateUserFriendlyPluginID();
bestMajorName = idNamePair.second;
} else {
idNamePair.second = (*it2)->generateUserFriendlyPluginIDMajorEncoded();
}
int indexOfBracket = idNamePair.second.lastIndexOf( QString::fromUtf8(" [") );
if (indexOfBracket != -1) {
idNamePair.first = idNamePair.second.left(indexOfBracket);
}
++i;
int weight = getPluginWeight( (*it2)->getPluginID(), (*it2)->getMajorVersion() );
pluginsMap.insert( std::make_pair(weight, idNamePair) );
}
if (it->first == stdInitialFilter) {
initialFilterName = bestMajorName;
}
}
}
_imp->textEdit = new CompleterLineEdit(pluginsMap, true, this);
if ( !initialFilterName.isEmpty() ) {
_imp->textEdit->setText(initialFilterName);
}
QPoint global = QCursor::pos();
QSize sizeH = sizeHint();
global.rx() -= sizeH.width() / 2;
global.ry() -= sizeH.height() / 2;
move( global.x(), global.y() );
_imp->layout->addWidget(_imp->textEdit);
_imp->textEdit->setFocus();
_imp->textEdit->selectAll();
QTimer::singleShot( 20, _imp->textEdit, SLOT(showCompleter()) );
}