当前位置: 首页>>代码示例>>C++>>正文


C++ QCompleter::setParent方法代码示例

本文整理汇总了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);
        }
    }
开发者ID:WeDo30,项目名称:actiona,代码行数:32,代码来源:codelineedit.cpp

示例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()));
}
开发者ID:hunt978,项目名称:qtedit4,代码行数:41,代码来源:ProjectManagerPlg.cpp


注:本文中的QCompleter::setParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。