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


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

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


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

示例1: initImagePage

void EnrichmentDialog::initImagePage()
{
	imagePage = new QWidget();

    QGroupBox *gb = new QGroupBox();
	QGridLayout *gl = new QGridLayout(gb);
    gl->addWidget(new QLabel( tr("File")), 0, 0);

	imagePathBox = new QLineEdit();

	QCompleter *completer = new QCompleter(this);
	completer->setModel(new QDirModel(completer));
	completer->setModelSorting(QCompleter::CaseSensitivelySortedModel);
	completer->setCompletionMode(QCompleter::InlineCompletion);

	imagePathBox->setCompleter(completer);
	gl->addWidget(imagePathBox, 0, 1);

	QPushButton *browseBtn = new QPushButton();
	connect(browseBtn, SIGNAL(clicked()), this, SLOT(chooseImageFile()));
	browseBtn->setIcon(QIcon(":/folder_open.png"));
	gl->addWidget(browseBtn, 0, 2);

	boxSaveImagesInternally = new QCheckBox(tr("&Save internally"));
	connect(boxSaveImagesInternally, SIGNAL(toggled(bool)), this, SLOT(saveImagesInternally(bool)));

	gl->addWidget(boxSaveImagesInternally, 1, 1);
	gl->setColumnStretch(1, 1);
	gl->setRowStretch(2, 1);

	QVBoxLayout *layout = new QVBoxLayout(imagePage);
    layout->addWidget(gb);
	tabWidget->addTab(imagePage, tr( "&Image" ) );
}
开发者ID:kuzavas,项目名称:qtiplot,代码行数:34,代码来源:EnrichmentDialog.cpp

示例2: PythonCompleterListView

QCompleter *createCompleter()
{
    PythonCompleterListView *lstView = new PythonCompleterListView();
    lstView->setItemDelegateForColumn(0, new PythonCompleterDelegate());

    QCompleter *completer = new QCompleter();
    completer->setPopup(lstView);
    completer->setCompletionMode(QCompleter::PopupCompletion);
    completer->setCaseSensitivity(Qt::CaseSensitive);
    completer->setModelSorting(QCompleter::CaseSensitivelySortedModel);

    return completer;
}
开发者ID:honzakac,项目名称:agros2d,代码行数:13,代码来源:pythoncompleter.cpp

示例3: QCompleter

QCompleter *CompleterHelper::completer(const QString &tableName, const QString &columnName, QWidget *parent)
{
	QCompleter *completer = new QCompleter(parent);

	QString queryText = QString("SELECT DISTINCT %1 FROM %2 ORDER BY %1").arg(columnName).arg(tableName);
	QSqlQueryModel *completerModel = new QSqlQueryModel(completer);
	completerModel->setQuery(queryText);

	completer->setModel(completerModel);
	completer->setCaseSensitivity(Qt::CaseInsensitive);
	completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);

	return completer;
}
开发者ID:electri,项目名称:running,代码行数:14,代码来源:completerhelper.cpp

示例4: 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

示例5: setupCompleter

void Omnibar::setupCompleter() {
    // Set gotoEntry completer for jump history
    QStringList flagsList = this->getFlags();
    QCompleter *completer = new QCompleter(flagsList, this);
    completer->setMaxVisibleItems(20);
    completer->setCompletionMode(QCompleter::PopupCompletion);
    completer->setModelSorting(QCompleter::CaseSensitivelySortedModel);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setFilterMode(Qt::MatchContains);

    QStringListModel *completerModel = (QStringListModel*)(completer->model());
    completerModel->setStringList(completerModel->stringList() << this->commands);

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

示例6: readScripts

void ProjectReader::readScripts(QString &path, QString &name, bool open) {
    Q_ASSERT(xml.isStartElement() && xml.name() == QLatin1String("Script"));

    QString n;
    Highlighter *h;
    QCompleter *c;
    CodeEditor *editor = new CodeEditor(name, 0, h);
    
    if (open) {
        editor = 0;
        mMw->addCodeEditor(path + "/" + name);
    } else {
        
        editor->setUndoRedoEnabled(true);
        editor->setTabStopWidth(29);
#ifdef Q_WS_MAC
        int size = 12;
        QFont font("Monaco", size);
#endif
#ifdef Q_OS_WIN
        int size = 10;
        QFont font("Consolas", size);
#endif
#ifdef Q_OS_LINUX
        int size = 10;
        QFont font("Inconsolata-g", size);
#endif
        editor->setFont(font);
        h = new Highlighter(editor->document());
        c = new QCompleter();
        c->setModel(mDocumentManager->modelFromFile(":/wordlist.txt"));
        c->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
        c->setCaseSensitivity(Qt::CaseInsensitive);
        c->setWrapAround(false);
        c->popup()->setStyleSheet("color: #848484; background-color: #2E2E2E; selection-background-color: #424242;");
        editor->setCompleter(c);
        
        n = path + "/" + name;
        //qDebug() << "look a script" << n;
        
        editor->openFile(path + "/" + name);
        
        mMw->addCodeEditor(editor, open);
    }

    xml.skipCurrentElement();
}
开发者ID:ATSOTECK,项目名称:Aurora-Game-Editor,代码行数:47,代码来源:projectReader.cpp

示例7: QTextEdit

ScriptEdit::ScriptEdit(ScriptingEnv *env, QWidget *parent, const char *name)
  : QTextEdit(parent, name), scripted(env), d_error(false), d_completer(0), d_highlighter(0),
  d_file_name(QString::null), d_search_string(QString::null), d_output_widget(NULL)
{
	myScript = scriptEnv->newScript("", this, name);
	connect(myScript, SIGNAL(error(const QString&, const QString&, int)), this, SLOT(insertErrorMsg(const QString&)));
	connect(myScript, SIGNAL(print(const QString&)), this, SLOT(scriptPrint(const QString&)));
	connect(myScript, SIGNAL(error(const QString&, const QString&, int)),
			this, SIGNAL(error(const QString&, const QString&, int)));

	setLineWrapMode(NoWrap);
	setUndoRedoEnabled(true);
	setTextFormat(Qt::PlainText);
	setAcceptRichText (false);
	setFocusPolicy(Qt::StrongFocus);

	rehighlight();

	d_fmt_default.setBackground(palette().brush(QPalette::Base));

	//Init completer based on parser built-in functions
	QStringList functions = MyParser::functionNamesList();
	functions.sort();
	QCompleter *completer = new QCompleter(this);
	completer->setModelSorting(QCompleter::CaseSensitivelySortedModel);
	completer->setCompletionMode(QCompleter::PopupCompletion);
	completer->setModel(new QStringListModel(functions, completer));
	setCompleter(completer);

	printCursor = textCursor();
	scriptsDirPath = qApp->applicationDirPath();

	actionExecute = new QAction(tr("E&xecute"), this);
	actionExecute->setShortcut( tr("Ctrl+J") );
	connect(actionExecute, SIGNAL(activated()), this, SLOT(execute()));

	actionExecuteAll = new QAction(QIcon(":/play.png"), tr("Execute &All"), this);
	actionExecuteAll->setShortcut( tr("Ctrl+Shift+J") );
	connect(actionExecuteAll, SIGNAL(activated()), this, SLOT(executeAll()));

	actionEval = new QAction(tr("&Evaluate Expression"), this);
	actionEval->setShortcut( tr("Ctrl+Return") );
	connect(actionEval, SIGNAL(activated()), this, SLOT(evaluate()));

	actionPrint = new QAction(QIcon(":/fileprint.png"), tr("&Print"), this);
	connect(actionPrint, SIGNAL(activated()), this, SLOT(print()));

	actionImport = new QAction(QIcon(":/fileopen.png"), tr("&Import..."), this);
	actionImport->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_O));
	connect(actionImport, SIGNAL(activated()), this, SLOT(importASCII()));

	actionSave = new QAction(QIcon(":/filesave.png"), tr("&Save"), this);
	actionSave->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_S));
	connect(actionSave, SIGNAL(activated()), this, SLOT(save()));

	actionExport = new QAction(QIcon(":/filesaveas.png"), tr("Sa&ve as..."), this);
	connect(actionExport, SIGNAL(activated()), this, SLOT(exportASCII()));

	actionFind = new QAction(QIcon(":/find.png"), tr("&Find..."), this);
	actionFind->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_F));
	connect(actionFind, SIGNAL(activated()), this, SLOT(showFindDialog()));

	actionReplace = new QAction(QIcon(":/replace.png"), tr("&Replace..."), this);
	actionReplace->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_R));
	connect(actionReplace, SIGNAL(activated()), this, SLOT(replace()));

	actionFindNext = new QAction(QIcon(":/find_next.png"), tr("&Find next"), this);
	actionFindNext->setShortcut(QKeySequence(Qt::Key_F3));
	connect(actionFindNext, SIGNAL(activated()), this, SLOT(findNext()));

	actionFindPrevious = new QAction(QIcon(":/find_previous.png"), tr("&Find previous"), this);
	actionFindPrevious->setShortcut(QKeySequence(Qt::Key_F4));
	connect(actionFindPrevious, SIGNAL(activated()), this, SLOT(findPrevious()));

	functionsMenu = new QMenu(this);
	Q_CHECK_PTR(functionsMenu);
	connect(functionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(insertFunction(QAction *)));

	connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(matchParentheses()));
}
开发者ID:chaoqing,项目名称:qtiplot,代码行数:80,代码来源:ScriptEdit.cpp


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