本文整理汇总了C++中QCompleter::setParent方法的典型用法代码示例。如果您正苦于以下问题:C++ QCompleter::setParent方法的具体用法?C++ QCompleter::setParent怎么用?C++ QCompleter::setParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCompleter
的用法示例。
在下文中一共展示了QCompleter::setParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertVariable
void CodeLineEdit::insertVariable(const QString &variable)
{
//If a validator is set this means that the insertion will fail
//In this case, reset the content and set the code mode
if(validator())
{
if(!text().isEmpty() && QMessageBox::question(this, tr("Insert variable/resource"), tr("Inserting a variable or a resource will replace the current parameter value.\nAre you sure?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes)
return;
setCode(true);
setText(QString());
}
//Temporarily remove the completer so that we don't get a popup
QCompleter *currentCompleter = completer();
if(currentCompleter)
{
currentCompleter->setParent(0);
setCompleter(0);
}
if(isCode())
insert(variable);
else
insert("$" + variable);
if(currentCompleter)
{
currentCompleter->setParent(this);
setCompleter(currentCompleter);
}
}
示例2: on_client_merged
void ProjectManagerPlugin::on_client_merged(qmdiHost *host)
{
if (m_dockWidget)
return;
QMainWindow *window = dynamic_cast<QMainWindow*>(host);
m_dockWidget = new QDockWidget(window);
m_dockWidget->setObjectName("m_dockWidget");
m_dockWidget->setWindowTitle( tr("Project") );
#if 0
m_treeView = new QTreeView(m_dockWidget);
m_treeView->setAlternatingRowColors(true);
m_dockWidget->setWidget(m_treeView);
#else
QWidget *w = new QWidget(m_dockWidget);
m_gui = new Ui::ProjectManagerGUI;
m_gui->setupUi(w);
m_dockWidget->setWidget(w);
#endif
m_projectModel = new FoldersModel(m_gui->filesView);
//m_projectModel->processDir("/home/elcuco/src/qtedit4/");
// m_projectModel->processDir("/home/elcuco/src/qt-creator/");
m_projectModel->processDir("/home/elcuco/src/googlecode/qtedit4/trunk/");
// m_projectModel->processDir("c:\\Users\\elcuco\\Source\\qtedit4");
m_gui->filesView->setModel(m_projectModel);
window->addDockWidget( Qt::LeftDockWidgetArea, m_dockWidget );
QCompleter *completer = new GenericItemCompleter();
completer->setModel(m_projectModel);
completer->setParent(m_gui->filenameLineEdit);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
completer->setCompletionRole(0);
completer->setCompletionPrefix("/");
m_gui->filenameLineEdit->setCompleter(completer);
connect(m_gui->filesView,SIGNAL(clicked(QModelIndex)),this,SLOT(onItemClicked(QModelIndex)));
connect(m_gui->addDirectoryButton,SIGNAL(clicked()),this,SLOT(onAddDirectoryClicked()));
}