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


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

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


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

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

示例2: setupUi

void TextImportDialog::setupUi()
{
	// Setup directory completors for the file and script boxen
	QCompleter *completer = new QCompleter(this);
	QDirModel *dirModel = new QDirModel(completer);
	completer->setModel(dirModel);
	completer->setCompletionMode(QCompleter::PopupCompletion);
	completer->setCaseSensitivity(Qt::CaseInsensitive);
	completer->setWrapAround(true);
	m_ui->filename->setCompleter(completer);

	completer = new QCompleter(this);
	dirModel = new QDirModel(completer);
	completer->setModel(dirModel);
	completer->setCompletionMode(QCompleter::PopupCompletion);
	completer->setCaseSensitivity(Qt::CaseInsensitive);
	completer->setWrapAround(true);
	m_ui->scriptFile->setCompleter(completer);
	
	completer = new QCompleter(this);
	dirModel = new QDirModel(completer);
	completer->setModel(dirModel);
	completer->setCompletionMode(QCompleter::PopupCompletion);
	completer->setCaseSensitivity(Qt::CaseInsensitive);
	completer->setWrapAround(true);
	m_ui->preprocFile->setCompleter(completer);
	
	// Remember the last format selected
	bool isPlainText = QSettings().value("textimport/plaintext",true).toBool();
	m_ui->fmtPlain->setChecked(isPlainText);
	m_ui->fmtFields->setChecked(!isPlainText);
	
	// Find the template
	QSettings settings;
	int templateId = settings.value("textimport/template-id",0).toInt();
	if(templateId > 0)
		m_template = SlideTemplateManager::instance()->findTemplate(SlideTemplateManager::Generic,templateId);
	
	// Setup the template selector widget
	TemplateSelectorWidget *tmplWidget = new TemplateSelectorWidget(SlideTemplateManager::Generic,"Template:",this);
	if(m_template)
		tmplWidget->setSelectedGroup(m_template);
	else
		m_template = tmplWidget->selectedGroup();
	
	// Add template editor to UI
	//QVBoxLayout *vbox = new QVBoxLayout(m_ui->templateBox);
	//vbox->addWidget(tmplWidget);
	m_ui->templateBox->layout()->addWidget(tmplWidget);
			
	connect(tmplWidget, SIGNAL(currentGroupChanged(SlideGroup*)), this, SLOT(templateChanged(SlideGroup*)));
	
	// Connect slots
	connect(m_ui->buttonBox,     SIGNAL(accepted()), this, SLOT(doImport()));
	connect(m_ui->browse,        SIGNAL(clicked()),  this, SLOT(browseBtn()));
	connect(m_ui->scriptBrowse,  SIGNAL(clicked()),  this, SLOT(scriptBrowseBtn()));
	connect(m_ui->preprocBrowse, SIGNAL(clicked()),  this, SLOT(preprocBrowseBtn()));
	
	
	m_ui->filename->setText(AppSettings::previousPath("textimport"));
	m_ui->scriptFile->setText(AppSettings::previousPath("script"));
	m_ui->preprocFile->setText(AppSettings::previousPath("preproc"));
}
开发者ID:dtbinh,项目名称:dviz,代码行数:63,代码来源:TextImportDialog.cpp


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