本文整理汇总了C++中QCompleter::setModel方法的典型用法代码示例。如果您正苦于以下问题:C++ QCompleter::setModel方法的具体用法?C++ QCompleter::setModel怎么用?C++ QCompleter::setModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCompleter
的用法示例。
在下文中一共展示了QCompleter::setModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupUi
QT_BEGIN_NAMESPACE
MainWindow::MainWindow(const QString &customFont)
{
setupUi(this);
pixelSize->setValue(QFontInfo(QFont()).pixelSize());
populateCharacterRanges();
{
weightCombo->addItem(QLatin1String("Light"), QVariant(int(QFont::Light)));
const int normalIdx = weightCombo->count();
weightCombo->addItem(QLatin1String("Normal"), QVariant(int(QFont::Normal)));
weightCombo->addItem(QLatin1String("DemiBold"), QVariant(int(QFont::DemiBold)));
weightCombo->addItem(QLatin1String("Bold"), QVariant(int(QFont::Bold)));
weightCombo->addItem(QLatin1String("Black"), QVariant(int(QFont::Black)));
weightCombo->setCurrentIndex(normalIdx);
}
QShortcut *sc = new QShortcut(Qt::ControlModifier + Qt::Key_A, this);
connect(sc, SIGNAL(activated()),
this, SLOT(on_selectAll_clicked()));
sc = new QShortcut(Qt::ControlModifier + Qt::Key_D, this);
connect(sc, SIGNAL(activated()),
this, SLOT(on_deselectAll_clicked()));
sc = new QShortcut(Qt::ControlModifier + Qt::Key_I, this);
connect(sc, SIGNAL(activated()),
this, SLOT(on_invertSelection_clicked()));
QCompleter *completer = new QCompleter(this);
completer->setModel(new QDirModel(this));
path->setCompleter(completer);
path->setText(QDir::currentPath());
completer = new QCompleter(this);
completer->setModel(new QDirModel(this));
sampleFile->setCompleter(completer);
charCount->setText(QString());
if (!customFont.isEmpty())
addCustomFont(customFont);
fontChanged();
connect(fontComboBox, SIGNAL(currentFontChanged(QFont)),
this, SLOT(fontChanged()));
connect(pixelSize, SIGNAL(valueChanged(int)),
this, SLOT(fontChanged()));
connect(italic, SIGNAL(stateChanged(int)),
this, SLOT(fontChanged()));
connect(weightCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(fontChanged()));
}
示例2: 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 );
}
示例3: QFrame
KLFPathChooser::KLFPathChooser(QWidget *parent)
: QFrame(parent), _mode(0), _caption(), _filter(), _dlgconfirmoverwrite(true),
_pathFromDialog(false)
{
// setFrameShape(QFrame::Box);
// setFrameShadow(QFrame::Raised);
setFrameStyle(QFrame::NoFrame|QFrame::Plain);
QHBoxLayout *lyt = new QHBoxLayout(this);
// lyt->setContentsMargins(2,2,2,2);
lyt->setContentsMargins(0,0,0,0);
lyt->setSpacing(2);
txtPath = new QLineEdit(this);
lyt->addWidget(txtPath);
btnBrowse = new QPushButton(tr("Browse"), this);
btnBrowse->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
lyt->addWidget(btnBrowse);
// set a filename completer for txtPath
QDirModel *dirModel = new QDirModel(QStringList(),
QDir::AllEntries|QDir::AllDirs|QDir::NoDotAndDotDot,
QDir::DirsFirst|QDir::IgnoreCase, this);
QCompleter *fileNameCompleter = new QCompleter(this);
fileNameCompleter->setModel(dirModel);
txtPath->setCompleter(fileNameCompleter);
// connect signals
connect(txtPath, SIGNAL(textChanged(const QString&)), this, SLOT(slotTextChanged()));
connect(btnBrowse, SIGNAL(clicked()), this, SLOT(requestBrowse()));
}
示例4: 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()));
}
示例5: 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()));
}
示例6: 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();
}
示例7: 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" ) );
}
示例8: setZipLineEdit
/** Define the QLineEdit to use as zip code editor */
void ZipCountryCompleters::setZipLineEdit(QLineEdit *zip)
{
m_Zip = zip;
// Completer
QCompleter *completer = new QCompleter(this);
completer->setModel(m_Model);
completer->setCompletionColumn(ZipCountryModel::ZipCity);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
completer->popup()->setAlternatingRowColors(true);
zip->setCompleter(completer);
connect(m_Zip, SIGNAL(textChanged(QString)), this, SLOT(zipTextChanged()));
connect(completer, SIGNAL(activated(QModelIndex)), this, SLOT(indexActivated(QModelIndex)));
// button
m_ZipButton = new QToolButton(m_Zip);
m_ZipButton->setToolTip("Zip button");
m_ZipButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_ZipButton->setIconSize(QSize(16,16));
m_ZipButton->setIcon(QIcon(QDir::cleanPath(qApp->applicationDirPath() + "/../../../../../global_resources/pixmap/16x16/ok.png")));
m_ZipButton->setMinimumSize(20,20);
m_ZipButton->setMaximumSize(20,20);
m_ZipButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
m_ZipButton->show();
int frameWidth = m_Zip->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
QSize msz = m_Zip->minimumSizeHint();
m_Zip->setMinimumSize(qMax(msz.width(), m_ZipButton->maximumHeight() + frameWidth * 2 + 2),
qMax(msz.height(), m_ZipButton->maximumHeight() + frameWidth * 2 + 2));
m_Zip->setStyleSheet(QString("padding-left: %1px;").arg(m_ZipButton->sizeHint().width() + frameWidth));
m_Zip->installEventFilter(this);
}
示例9: 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--;
}
示例10: 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();
}
示例11: setUpCompleter
void FilterDialog::setUpCompleter()
{
QCompleter* completer = new QCompleter(this);
QFileSystemModel* fsmodel = new QFileSystemModel(completer);
fsmodel->setReadOnly(true);
fsmodel->setRootPath("");
completer->setModel(fsmodel);
folderPathLineEdit->setCompleter(completer);
}
示例12: PreferencesPage
DivinePreferences::DivinePreferences(QWidget * parent)
: PreferencesPage(parent)
{
ui_ = new Ui::DivinePreferences();
ui_->setupUi(this);
QCompleter * completer = new QCompleter(this);
completer->setModel(new QDirModel(completer));
ui_->pathEdit->setCompleter(completer);
}
示例13: updateFilter
//-----------------------------------------------------------------------------
void ctkPathLineEditPrivate::updateFilter()
{
Q_Q(ctkPathLineEdit);
// help completion for the QComboBox::QLineEdit
QCompleter *newCompleter = new QCompleter(q);
newCompleter->setModel(new QDirModel(
ctk::nameFiltersToExtensions(this->NameFilters),
this->Filters | QDir::NoDotAndDotDot | QDir::AllDirs,
QDir::Name|QDir::DirsLast, newCompleter));
this->ComboBox->setCompleter(newCompleter);
}
示例14: if
FormAgregarServicio::FormAgregarServicio( QWidget* parent )
: EVentana( parent ), Ui::FormAgregarServPeluqueriaBase()
{
setupUi(this);
setObjectName( "FormAgregarServicio" );
setWindowTitle( "Agregar Nuevo Servicio de Peluqueria" );
setWindowIcon( QIcon( ":/imagenes/pelu.gif" ) );
this->addAction( new EActCerrar( this ) );
QSqlQueryModel *modeloMascota = new QSqlQueryModel( CBMascota );
if( QSqlDatabase::database().driverName() == "QSQLITE" )
{
modeloMascota->setQuery( "SELECT m.id, m.nombre||' - '||d.apellido||', '||d.nombre FROM mascota m, dueno d WHERE m.id_dueno = d.id ORDER BY 2" );
}
else if( QSqlDatabase::database().driverName() == "QMYSQL" )
{
modeloMascota->setQuery( "SELECT m.id, CONCAT( CONCAT( CONCAT( CONCAT( m.nombre, \" - \" ), d.apellido ), \", \" ), d.nombre ) FROM mascota m, dueno d WHERE m.id_dueno = d.id ORDER BY 2" );
}
CBMascota->setModel( modeloMascota );
CBMascota->setModelColumn( 1 );
CBMascota->setCurrentIndex( -1 );
connect( CBMascota, SIGNAL( currentIndexChanged( int ) ), this, SLOT( cambioIndice( int ) ) );
CWFecha->setMaximumDate( QDate::currentDate() );
CWFecha->setSelectionMode( QCalendarWidget::SingleSelection );
PBAgregar->setIcon( QIcon( ":/imagenes/add.png" ) );
PBAgregar->setShortcut( QKeySequence( "Ctrl+a" ) );
PBAgregar->setText( "&Agregar" );
PBBorrar->setIcon( QIcon( ":/imagenes/borrar.png" ) );
PBBorrar->setShortcut( QKeySequence( "Ctrl+L" ) );
PBBorrar->setText( "&Limpiar" );
modeloPeluqueria = new MPeluqueria( this, false );
modeloPeluqueria->setSolo_lectura( true );
preferencias *p = preferencias::getInstancia();
modeloPeluqueria->setLimite( p->value( "General\\limite", 5 ).toInt() );
modeloPeluqueria->setSort( 4, Qt::DescendingOrder );
modeloPeluqueria->setEditStrategy( QSqlTableModel::OnRowChange );
TVHistorial->setModel( modeloPeluqueria );
TVHistorial->hideColumn( 0 );
TVHistorial->hideColumn( 1 );
TVHistorial->resizeColumnsToContents();
connect( PBAgregar, SIGNAL( clicked() ), this, SLOT( agregar() ) );
connect( PBBorrar , SIGNAL( clicked() ), this, SLOT( borrar() ) );
QCompleter *completador = new QCompleter( LEDescripcion );
QSqlQueryModel *modeloDescripciones = new QSqlQueryModel( completador );
modeloDescripciones->setQuery( "SELECT DISTINCT descripcion FROM peluqueria" );
completador->setModel( modeloDescripciones );
LEDescripcion->setCompleter( completador );
}
示例15: QMainWindow
QWatermark::QWatermark(QWidget *parent)
: QMainWindow(parent)
{
setupUi(this);
QCompleter *completer = new QCompleter(this);
FSModel *fsModel = new FSModel(completer);
fsModel->setRootPath("");
completer->setModel(fsModel);
profileComboBox->addItems(Profile::getProfiles());
QSettings s;
s.beginGroup("MainWindow");
restoreGeometry(s.value("geometry").toByteArray());
restoreState(s.value("windowState").toByteArray());
sourceLineEdit->setText(s.value("sourcePath").toString());
destinationLineEdit->setText(s.value("destinationPath").toString());
previewZoomSpinBox->setValue(s.value("zoom", 30).toInt());
treeCheckBox->setChecked(s.value("treeIteration", false).toBool());
int ix = profileComboBox->findText(s.value("profile", tr("Default")).toString());
if (ix > -1)
profileComboBox->setCurrentIndex(ix);
QAbstractButton *b = buttonGroup->button(s.value("buttonGroup", 0).toInt());
if (!b)
b = ULRadioButton;
b->setChecked(true);
s.endGroup();
sourceLineEdit->setCompleter(completer);
destinationLineEdit->setCompleter(completer);
connect(sourcePushButton,SIGNAL(clicked()),this,SLOT(selectSourceFolder(void)));
connect(destinationPushButton,SIGNAL(clicked()),this,SLOT(selectDestinationFolder(void)));
connect(startButton,SIGNAL(clicked()),this,SLOT(doWatermark(void)));
connect(actionAbout, SIGNAL(triggered()), this, SLOT(about(void)));
connect(actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(sourceLineEdit, SIGNAL(textEdited(QString)), this, SLOT(checkConditions()));
connect(destinationLineEdit, SIGNAL(textEdited(QString)), this, SLOT(checkConditions()));
connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(preview()));
connect(profileComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(preview()));
connect(previewZoomSpinBox, SIGNAL(valueChanged(int)), this, SLOT(preview()));
connect(editProfileButton, SIGNAL(clicked()), this, SLOT(editProfileButton_clicked()));
checkConditions();
preview();
}