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


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

本文整理汇总了C++中QCompleter::setCompletionPrefix方法的典型用法代码示例。如果您正苦于以下问题:C++ QCompleter::setCompletionPrefix方法的具体用法?C++ QCompleter::setCompletionPrefix怎么用?C++ QCompleter::setCompletionPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QCompleter的用法示例。


在下文中一共展示了QCompleter::setCompletionPrefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateArgumentCompleter

void MainWindow::updateArgumentCompleter(QStringList *list, bool google)
{
    editingCompleter++;
    QCompleter *completer = ui->txtArgument->completer();

    if (completer == NULL) {
        completer = new QCompleter(*list, ui->txtArgument);
        ui->txtArgument->setCompleter(completer);
    } else {
        QStringListModel *model = new QStringListModel(*list, completer);
        completer->setModel(model);
    }

    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setCompletionMode(QCompleter::PopupCompletion);
    completer->popup()->installEventFilter(this);
    completer->popup()->setItemDelegate(new GoogleResultDelegate());

    if (google) {
        completer->setMaxVisibleItems(21);
    } else {
        completer->setMaxVisibleItems(7);
    }

    completer->setCompletionPrefix(ui->txtArgument->text());

    if (!list->isEmpty()) {
        completer->complete();
    }

    editingCompleter--;
}
开发者ID:m-lima,项目名称:Lunger,代码行数:32,代码来源:mainwindow.cpp

示例2: showCommands

void Omnibar::showCommands() {
    this->setFocus();
    this->setText(": ");

    QCompleter *completer = this->completer();
    completer->setCompletionMode(QCompleter::PopupCompletion);
    completer->setModelSorting(QCompleter::CaseSensitivelySortedModel);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setFilterMode(Qt::MatchStartsWith);

    completer->setMaxVisibleItems(20);

    completer->setCompletionPrefix(": ");
    completer->complete();
}
开发者ID:probonopd,项目名称:iaito,代码行数:15,代码来源:omnibar.cpp

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