本文整理汇总了C++中QCompleter类的典型用法代码示例。如果您正苦于以下问题:C++ QCompleter类的具体用法?C++ QCompleter怎么用?C++ QCompleter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QCompleter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupUi
TOPPASOutputFilesDialog::TOPPASOutputFilesDialog(const QString & dir_name, int num_jobs)
{
setupUi(this);
if (dir_name != "")
{
line_edit->setText(dir_name);
}
else
{
line_edit->setText(QDir::currentPath());
}
if (num_jobs >= 1)
{
num_jobs_box->setValue(num_jobs);
}
QCompleter * completer = new QCompleter(this);
QDirModel * dir_model = new QDirModel(completer);
dir_model->setFilter(QDir::AllDirs);
completer->setModel(dir_model);
line_edit->setCompleter(completer);
connect(browse_button, SIGNAL(clicked()), this, SLOT(showFileDialog()));
connect(ok_button, SIGNAL(clicked()), this, SLOT(checkValidity_()));
connect(cancel_button, SIGNAL(clicked()), this, SLOT(reject()));
// make Ok the default (just pressing Enter will run the workflow)
ok_button->setFocus();
}
示例2: QCompleter
void Gui_Groups::createGroups() {
if(_client->level() >= business) {
QStringList completions;
list<Group*> grps = _client->listAllGroups();
if(!grps.empty()) {
list<Group*>::iterator it = grps.begin();
for(; it != grps.end(); ++it)
completions.push_back(QString::fromStdString((*it)->name()));
}
QCompleter* completer = new QCompleter(completions, this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
search->setCompleter(completer);
search->setClearButtonEnabled(true);
search->show();
for(list<Group*>::iterator it = grps.begin(); it != grps.end(); ++it) {
if((*it)->isMember(_client->username())) {
QListWidgetItem* item = new QListWidgetItem;
item->setData(Qt::DisplayRole, QString::fromStdString((*it)->name()));
item->setData(Qt::UserRole + 1, QString::fromStdString((*it)->admin().login()));
item->setData(Qt::UserRole + 2, QString::fromStdString((*it)->description()));
grplist->addItem(item);
}
}
}
}
示例3: DatabaseImporterConfig
SqlBatchImporterConfig::SqlBatchImporterConfig( QWidget *parent )
: DatabaseImporterConfig( parent )
{
QWidget *gridHolder = new QWidget( this );
QGridLayout *databaseLayout = new QGridLayout( gridHolder );
QLabel *explanationLabel = new QLabel( i18n( "Input file produced by amarokcollectionscanner.<br>"
"See <a href=\"http://community.kde.org/Amarok/Development/BatchMode\">Batch Mode</a>." ), gridHolder );
explanationLabel->setTextFormat( Qt::RichText );
explanationLabel->setAlignment( Qt::AlignHCenter );
explanationLabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); // Don't stretch vertically
QLabel *label = new QLabel( i18n( "Input file" ), gridHolder );
m_inputFilePathInput = new QLineEdit( gridHolder );
QCompleter *completer = new QCompleter( this );
completer->setModel( new QDirModel( completer ) );
m_inputFilePathInput->setCompleter( completer );
m_inputFilePathInput->setText( QDir::homePath() + "/result.xml" );
label->setBuddy( m_inputFilePathInput );
databaseLayout->addWidget( explanationLabel, 0, 0, 1, 2 );
databaseLayout->addWidget( label, 1, 0 );
databaseLayout->addWidget( m_inputFilePathInput, 1, 1 );
gridHolder->setLayout( databaseLayout );
QWidget *spacer = new QWidget( this );
spacer->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
}
示例4: QWidget
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" ) );
}
示例5: layer
void QgsUniqueValuesWidget::initWidget( QWidget* editor )
{
mComboBox = qobject_cast<QComboBox*>( editor );
mLineEdit = qobject_cast<QLineEdit*>( editor );
QStringList sValues;
QList<QVariant> values;
layer()->uniqueValues( fieldIdx(), values );
Q_FOREACH( QVariant v, values )
{
if ( mComboBox )
{
mComboBox->addItem( v.toString(), v );
}
sValues << v.toString();
}
if ( mLineEdit )
{
QCompleter* c = new QCompleter( sValues );
c->setCompletionMode( QCompleter::PopupCompletion );
mLineEdit->setCompleter( c );
connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( valueChanged( QString ) ) );
}
if ( mComboBox )
{
connect( mComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( valueChanged() ) );
}
}
示例6: QWidget
HCopyCard::HCopyCard(QWidget *parent, QSqlDatabase pdb) :
QWidget(parent),
ui(new Ui::HCopyCard)
{
ui->setupUi(this);
db=pdb;
QSqlTableModel *modclienti=new QSqlTableModel(0,db);
modclienti->setTable("anagrafica");
modclienti->setFilter("cliente > 0");
modclienti->setSort(1,Qt::AscendingOrder);
modclienti->select();
ui->cbC->setModel(modclienti);
ui->cbC->setModelColumn(1);
QCompleter *cc = new QCompleter(modclienti);
cc->setCaseSensitivity(Qt::CaseInsensitive);
cc->setCompletionColumn(1);
cc->setCompletionMode(QCompleter::PopupCompletion);
ui->cbC->setCompleter(cc);
getProducts();
connect(ui->cbC,SIGNAL(currentIndexChanged(int)),this,SLOT(getProducts()));
}
示例7: QWidget
ConfigGeneralWidget::ConfigGeneralWidget(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
#ifdef KTIKZ_USE_KDE
ui.historyLengthLabel->setVisible(false);
ui.historyLengthSpinBox->setVisible(false);
ui.toolBarStyleLabel->setVisible(false);
ui.toolBarStyleComboBox->setVisible(false);
#endif
QCompleter *completer = new QCompleter(this);
completer->setModel(new QDirModel(completer));
completer->setCompletionMode(QCompleter::PopupCompletion);
ui.tikzDocEdit->setCompleter(completer);
ui.latexEdit->setCompleter(completer);
ui.pdftopsEdit->setCompleter(completer);
ui.editorEdit->setCompleter(completer);
ui.tikzDocButton->setIcon(Icon("document-open"));
ui.latexButton->setIcon(Icon("document-open"));
ui.pdftopsButton->setIcon(Icon("document-open"));
ui.editorButton->setIcon(Icon("document-open"));
connect(ui.commandsInDockCheck, SIGNAL(toggled(bool)), this, SLOT(setCommandsInDock(bool)));
connect(ui.tikzDocButton, SIGNAL(clicked()), this, SLOT(browseCommand()));
connect(ui.tikzDocSearchButton, SIGNAL(clicked()), this, SLOT(searchTikzDocumentation()));
connect(ui.latexButton, SIGNAL(clicked()), this, SLOT(browseCommand()));
connect(ui.pdftopsButton, SIGNAL(clicked()), this, SLOT(browseCommand()));
connect(ui.editorButton, SIGNAL(clicked()), this, SLOT(browseCommand()));
}
示例8: QWizardPage
/*
* First page
*/
NdwFirstPage::NdwFirstPage(QWizard *parent)
: QWizardPage(parent) {
setupUi(this);
odbcAvailable = QSqlDatabase::drivers().contains("QODBC");
if (!odbcAvailable) {
odbcCheckBox->setEnabled(false);
odbcCheckBox->setToolTip(tr("You have no ODBC driver installed."));
} else {
odbcCheckBox->setToolTip("");
}
registerField("host", hostLineEdit);
registerField("driver", dbTypeComboBox, "currentDriver");
registerField("usesOdbc", odbcCheckBox);
QCompleter *c = new QCompleter(QStringList("localhost"), this);
c->setCompletionMode(QCompleter::InlineCompletion);
hostLineEdit->setCompleter(c);
connect(dbTypeComboBox, SIGNAL(currentIndexChanged(int)),
this, SIGNAL(completeChanged()));
connect(hostLineEdit, SIGNAL(textChanged(QString)),
this, SIGNAL(completeChanged()));
}
示例9: showAutocompletionMenu
void BAbstractFileType::showAutocompletionMenu(BAbstractCodeEditorDocument *doc, QTextCursor cursor, const QPoint &)
{
if (cursor.isNull())
return;
QCompleter *completer = doc->findChild<QCompleter *>("beqt/completer");
cursor.select(QTextCursor::WordUnderCursor);
if (!cursor.hasSelection()) {
if (completer)
completer->popup()->hide();
return;
}
QList<AutocompletionItem> list = createAutocompletionItemList(doc, cursor);
if (list.isEmpty()) {
if (completer)
completer->popup()->hide();
return;
}
QStandardItemModel *model = doc->findChild<QStandardItemModel *>("beqt/completion_model");
if (!model) {
model = new QStandardItemModel(doc);
model->setObjectName("beqt/completion_model");
model->setColumnCount(1);
}
model->clear();
foreach (const AutocompletionItem &item, list) {
QStandardItem *si = new QStandardItem(item.actionIcon, item.actionText);
si->setData(item.actionToolTip, Qt::ToolTipRole);
si->setData(item.text, Qt::UserRole);
model->appendRow(si);
}
示例10: GenericDelegate
void QuickEdit::PrefixDelegateSetup()
{
GenericDelegate* delegate = new GenericDelegate(ui->tvEditor, false);
delegate->widgetCreator = [&](QWidget * parent)
{
QStringList list;
list << " " << "const " << "volatile ";
QCompleter *completer = new QCompleter(list, parent);
completer->setCaseSensitivity(Qt::CaseSensitive);
QComboBox* box = new QComboBox(parent);
QStringListModel* model = new QStringListModel;
model->setStringList(list);
box->setModel(model);
box->setEditable(true);
box->setCompleter(completer);
return box;
};
delegate->dataAccessor = [](QWidget * editor, const QModelIndex & index)
{
QString value = index.model()->data(index, Qt::EditRole).toString();
QComboBox *box = static_cast<QComboBox*>(editor);
box->setCurrentText(value);
};
delegate->dataSetter = [](QWidget * editor,QAbstractItemModel* model, const QModelIndex &index)
{
QComboBox * box = static_cast<QComboBox*>(editor);
QString value = box->currentText();
model->setData(index, value, Qt::EditRole);
};
ui->tvEditor->setItemDelegateForColumn(columns.indexOf("prefix"), delegate);
}
示例11: QMainWindow
Muse::Muse(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
QStringList wordList;
wordList << "alpha" << "omega" << "omicron" << "zeta";
//QLineEdit *lineEdit = new QLineEdit(this);
QCompleter *completer = new QCompleter(wordList, this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
//ui.textEdit->setcompl(completer);
ui.Subject_listWidget->addItem("Voleur");
ui.Subject_listWidget->addItem("Gendarme");
ui.Subject_listWidget->addItem("Extraterrestre");
ui.Subject_listWidget->addItem("Nounou");
ui.Subject_listWidget->addItem("Cowboy");
ui.Verb_listWidget->addItem("cours");
ui.Verb_listWidget->addItem("mange");
ui.Verb_listWidget->addItem("fuit");
ui.Verb_listWidget->addItem("range");
ui.Verb_listWidget->addItem("galope");
ui.Complement_listWidget->addItem("dans la ville");
ui.Complement_listWidget->addItem(QString::fromStdWString(L"des fruits et légume"));
ui.Complement_listWidget->addItem(QString::fromStdWString(L"sa planète"));
ui.Complement_listWidget->addItem("les affaires des enfants");
ui.Complement_listWidget->addItem("dans les plaines");
}
示例12: QWidget
LaunchPage::LaunchPage(QWidget *parent)
: QWidget(parent),
ui(new Ui::LaunchPage),
m_argsModel(new QStringListModel(this))
{
ui->setupUi(this);
connect(ui->progSelectButton, SIGNAL(clicked()), SLOT(showFileDialog()));
connect(ui->addArgButton, SIGNAL(clicked()), SLOT(addArgument()));
connect(ui->removeArgButton, SIGNAL(clicked()), SLOT(removeArgument()));
connect(ui->progEdit, SIGNAL(textChanged(QString)), SIGNAL(updateButtonState()));
ui->argsBox->setModel(m_argsModel);
QCompleter *pathCompleter = new QCompleter(this);
QFileSystemModel *fsModel = new QFileSystemModel(this);
fsModel->setRootPath(QDir::rootPath());
pathCompleter->setModel(fsModel);
ui->progEdit->setCompleter(pathCompleter);
QSettings settings;
ui->progEdit->setText(settings.value(QLatin1String("Launcher/Program")).toString());
m_argsModel->setStringList(settings.value(QLatin1String("Launcher/Arguments")).toStringList());
ui->accessMode->setCurrentIndex(settings.value(QLatin1String("Launcher/AccessMode")).toInt());
updateArgumentButtons();
}
示例13: QWidget
FileChooserWidget::FileChooserWidget(QWidget * parent)
: QWidget(parent) {
QHBoxLayout * layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
setLayout(layout);
//Path line edit
_pathLineEdit = new QLineEdit(this);
layout->addWidget(_pathLineEdit);
QCompleter * completer = new QCompleter(this);
completer->setModel(new QDirModel(completer));
_pathLineEdit->setCompleter(completer);
connect(_pathLineEdit, SIGNAL(returnPressed()),
SLOT(returnPressed()));
connect(_pathLineEdit, SIGNAL(textChanged(const QString &)),
SLOT(textChanged(const QString &)));
//Search button
_searchButton = new QToolButton();
layout->addWidget(_searchButton);
_searchButton->setAutoRaise(true);
connect(_searchButton, SIGNAL(clicked()), SLOT(search()));
}
示例14: QDockWidget
void MainWindow::createDockWindows()
{
QDockWidget *dock = new QDockWidget(tr("History"), this);
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
historyList = new QListWidget(dock);
dock->setWidget(historyList);
addDockWidget(Qt::RightDockWidgetArea, dock);
viewMenu->addAction(dock->toggleViewAction());
dock = new QDockWidget(tr("Command Line"));
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
QStringList wordList;
wordList << "FW"<<"BK"<<"CW"<<"CCW"<<"ROT"<<"BLOCK"<<"FOR"<<"RESET"<<"DOWN"<<"UP";
QCompleter *completer = new QCompleter(wordList);
completer->setCaseSensitivity(Qt::CaseInsensitive);
cmdLineEdit = new QLineEdit();
cmdLineEdit->setCompleter(completer);
dock->setWidget(cmdLineEdit);
addDockWidget(Qt::RightDockWidgetArea, dock);
viewMenu->addAction(dock->toggleViewAction());
////////////////////////////////////////////////////////////////////////////////
// ZAD 3
cmdLineEdit->installEventFilter(keyPressEater);
connect(cmdLineEdit, SIGNAL(returnPressed()), this, SLOT(sendCmd()));
connect(keyPressEater, SIGNAL(odzyskaj()), this, SLOT(odzyskaj()));
}
示例15: QDialog
AddExternalRecitalPieceDialog::AddExternalRecitalPieceDialog(int recitalId, ConfigFile *c, QWidget *parent) :
QDialog(parent),
ui(new Ui::AddExternalRecitalPieceDialog), myConfig(c), currentRecitalId(recitalId)
{
ui->setupUi(this);
QStringList composerList;
QSqlQuery query("SELECT composer FROM piececomposer");
if (query.lastError().isValid()) {
qDebug() << "DB Error: 223 - " << query.lastError();
}
while(query.next()) {
composerList << query.value(0).toString();
}
QCompleter *composerCompleter = new QCompleter(composerList);
composerCompleter->setCaseSensitivity(Qt::CaseInsensitive);
ui->lineEdit_composer->setCompleter(composerCompleter);
QStringList myGenreStringList;
std::list<std::string> genreList = myConfig->readConfigStringList("PalPiecesGenreList");
std::list<std::string>::iterator it3;
for(it3= genreList.begin(); it3 != genreList.end(); it3++) {
myGenreStringList << QString::fromUtf8(it3->c_str());
}
QCompleter *genreCompleter = new QCompleter(myGenreStringList);
genreCompleter->setCaseSensitivity(Qt::CaseInsensitive);
ui->lineEdit_genre->setCompleter(genreCompleter);
}