本文整理汇总了C++中QCompleter::setCompletionColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ QCompleter::setCompletionColumn方法的具体用法?C++ QCompleter::setCompletionColumn怎么用?C++ QCompleter::setCompletionColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCompleter
的用法示例。
在下文中一共展示了QCompleter::setCompletionColumn方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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()));
}
示例2: getProducts
void HCopyCard::getProducts()
{
int cliente=ui->cbC->model()->index(ui->cbC->currentIndex(),0).data(0).toInt();
QString query="SELECT ricette.ID_prodotto, prodotti.descrizione FROM ricette, prodotti WHERE prodotti.ID=ricette.ID_prodotto AND ricette.ID IN (SELECT ID_ricetta FROM associazioni WHERE ID_cliente=:id and visualizza=1)order by prodotti.descrizione";
QSqlQuery q(db);
q.prepare(query);
q.bindValue(":id",QVariant(cliente));
q.exec();
QSqlQueryModel *qrm=new QSqlQueryModel();
qDebug()<<"getProds"<<q.lastError().text();
qrm->setQuery(q);
ui->cbP->setModel(qrm);
ui->cbP->setModelColumn(1);
QCompleter *cp = new QCompleter(qrm);
cp->setCaseSensitivity(Qt::CaseInsensitive);
cp->setCompletionColumn(1);
cp->setCompletionMode(QCompleter::PopupCompletion);
ui->cbP->setCompleter(cp);
ui->cbP->setCurrentIndex(-1);
ui->cbP->setCurrentIndex(0);
}
示例3: 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);
}
示例4: setComboBoxCompleterModel
void setComboBoxCompleterModel(QComboBox* pBox,
QStandardItemModel* model, int32 column)
{
QCompleter* pCompleter = new QCompleter(model, pBox);
pCompleter->setCompletionColumn(column);
pBox->setCompleter(pCompleter);
pBox->setModel(model);
pBox->setModelColumn(column);
}
示例5: fillMoves
void PokeEdit::fillMoves()
{
movesModel = new PokeMovesModel(m_poke->num(), m_poke->gen(), this, hackMons);
QSortFilterProxyModel *filter = new QSortFilterProxyModel(this);
filter->setSourceModel(movesModel);
ui->moveChoice->setModel(filter);
ui->moveChoice->disconnect(SIGNAL(activated(QModelIndex)), this);
connect(ui->moveChoice, SIGNAL(activated(QModelIndex)), SLOT(moveEntered(QModelIndex)));
#ifdef QT5
ui->moveChoice->horizontalHeader()->setSectionResizeMode(PokeMovesModel::PP, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setSectionResizeMode(PokeMovesModel::Priority, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setSectionResizeMode(PokeMovesModel::Pow, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setSectionResizeMode(PokeMovesModel::Acc, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setSectionResizeMode(PokeMovesModel::Name, QHeaderView::Fixed);
#else
ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::PP, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Pow, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Acc, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Name, QHeaderView::Fixed);
#endif
ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Name, 125);
ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Type, Theme::TypePicture(Type::Normal).width()+5);
ui->moveChoice->setIconSize(Theme::TypePicture(Type::Normal).size());
ui->moveChoice->sortByColumn(PokeMovesModel::Name, Qt::AscendingOrder);
m_moves[0] = ui->move1;
m_moves[1] = ui->move2;
m_moves[2] = ui->move3;
m_moves[3] = ui->move4;
connect(ui->speciesLabel, SIGNAL(clicked()), SLOT(on_pokemonFrame_clicked()));
/* the four move choice items */
for (int i = 0; i < 4; i++)
{
QCompleter *completer = new QCompleter(m_moves[i]);
completer->setModel(ui->moveChoice->model());
completer->setCompletionColumn(PokeMovesModel::Name);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::PopupCompletion);
completer->setCompletionRole(Qt::DisplayRole);
m_moves[i]->setCompleter(completer);
completer->setProperty("move", i);
m_moves[i]->setProperty("move", i);
connect(completer, SIGNAL(activated(QString)), SLOT(changeMove()));
connect(m_moves[i], SIGNAL(returnPressed()), SLOT(changeMove()));
connect(m_moves[i], SIGNAL(editingFinished()), SLOT(changeMove()));
}
}
示例6: ui
PokeSelection::PokeSelection(Pokemon::uniqueId pokemon, QAbstractItemModel *pokemonModel) :
ui(new Ui::PokeSelection), search(NULL), newwidth(0)
{
ui->setupUi(this);
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
proxy->setFilterRegExp(".");
proxy->setSourceModel(pokemonModel);
this->sourceModel = pokemonModel;
this->proxy = proxy;
ui->pokemonList->setModel(proxy);
QCompleter *completer = new QCompleter(proxy, ui->pokeEdit);
completer->setCompletionColumn(1);
completer->setCompletionRole(Qt::DisplayRole);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::PopupCompletion);
ui->pokeEdit->setCompleter(completer);
setNum(pokemon);
ui->pokemonList->setCurrentIndex(pokemonModel->index(pokemon.pokenum, 1));
ui->pokemonList->scrollTo(ui->pokemonList->currentIndex());
updateSprite();
updateTypes();
if (getGen() <= 1) {
ui->shiny->hide();
} else {
ui->shiny->show();
}
ui->baseStats->setGen(getGen());
connect(completer, SIGNAL(activated(QModelIndex)), SLOT(setPokemon(QModelIndex)));
connect(ui->shiny, SIGNAL(toggled(bool)), SLOT(updateSprite()));
connect(ui->pokemonList, SIGNAL(pokemonSelected(Pokemon::uniqueId)), SLOT(setNum(Pokemon::uniqueId)));
connect(ui->pokemonList, SIGNAL(pokemonSelected(Pokemon::uniqueId)), SLOT(updateSprite()));
connect(ui->pokemonList, SIGNAL(pokemonSelected(Pokemon::uniqueId)), SLOT(updateTypes()));
connect(ui->pokemonList, SIGNAL(pokemonActivated(Pokemon::uniqueId)), SLOT(finish()));
connect(ui->changeSpecies, SIGNAL(clicked()), SLOT(finish()));
connect(ui->pokemonFrame, SIGNAL(clicked()), SLOT(toggleSearchWindow()));
}
示例7: setZipLineEdit
/** Define the QLineEdit to use as zip code editor */
void ZipCountryCompleters::setZipLineEdit(Utils::QButtonLineEdit *zip)
{
m_zipEdit = zip;
// Completer
QCompleter *completer = new QCompleter(this);
completer->setModel(m_ZipModel);
completer->setCompletionColumn(ZipCountryModel::ZipCity);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::PopupCompletion);
completer->popup()->setAlternatingRowColors(true);
m_zipEdit->setCompleter(completer);
connect(m_zipEdit, SIGNAL(textChanged(QString)), this, SLOT(zipTextChanged()));
connect(completer, SIGNAL(activated(QModelIndex)), this, SLOT(onCompleterIndexActivated(QModelIndex)));
// button
m_ZipButton = new QToolButton(m_zipEdit);
m_ZipButton->setIcon(theme()->icon(Core::Constants::ICONHELP));
m_zipEdit->setRightButton(m_ZipButton);
}
示例8: ui
PokeEdit::PokeEdit(TeamBuilderWidget *master, PokeTeam *poke, QAbstractItemModel *pokeModel, QAbstractItemModel *itemsModel, QAbstractItemModel *natureModel) :
ui(new Ui::PokeEdit),
pokemonModel(pokeModel),
m_poke(poke), master(master)
{
ui->setupUi(this);
ui->itemSprite->raise();
ui->item->setModel(itemsModel);
ui->nature->setModel(natureModel);
ui->levelSettings->setPoke(poke);
ui->evbox->setPoke(poke);
ui->ivbox->setPoke(poke);
if (0) {
master->getDock(EVDock)->setWidget(ui->evbox);
master->getDock(IVDock)->setWidget(ui->ivbox);
master->getDock(LevelDock)->setWidget(ui->levelSettings);
master->getDock(MoveDock)->setWidget(ui->moveContainer);
} else {
QCloseDockWidget *hi = new QCloseDockWidget(tr("Advanced"), this);
hi->setObjectName("AdvancedTab");
hi->setWidget(ui->ivbox);
hi->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable);
ui->horizontalMove->addWidget(hi);
if (advancedWindowClosed) {
hi->close();
}
connect(hi, SIGNAL(closed()), SIGNAL(closeAdvanced()));
// QDockWidget *hi2 = new QDockWidget(tr("Level"), this);
// hi2->setWidget(ui->levelSettings);
// hi2->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable);
// ui->horizontalPoke->addWidget(hi2);
}
QSortFilterProxyModel *pokeFilter = new QSortFilterProxyModel(this);
pokeFilter->setFilterRegExp(".");
pokeFilter->setSourceModel(pokemonModel);
QCompleter *completer = new QCompleter(pokeFilter, ui->nickname);
completer->setCompletionColumn(1);
completer->setCompletionRole(Qt::DisplayRole);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::PopupCompletion);
ui->nickname->setCompleter(completer);
connect(completer, SIGNAL(activated(QString)), SLOT(setNum(QString)));
/* 20 characters for the name. Longest name: Vivillon-Archipelago = 20 characters */
ui->nickname->setValidator(new QNickValidator(ui->nickname, 20));
fillMoves();
connect(ui->levelSettings, SIGNAL(levelUpdated()), this, SLOT(updateStats()));
connect(ui->levelSettings, SIGNAL(levelUpdated()), ui->ivbox, SLOT(updateStats()));
connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updatePicture()));
connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updateGender()));
connect(ui->ivbox, SIGNAL(genderUpdated()), SLOT(updateGender()));
connect(ui->ivbox, SIGNAL(genderUpdated()), ui->levelSettings, SLOT(updateGender()));
connect(ui->ivbox, SIGNAL(shinyUpdated()), SLOT(updatePicture()));
connect(ui->happiness, SIGNAL(valueChanged(int)), this, SLOT(changeHappiness(int)));
connect(ui->nature, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNature(int)));
connect(ui->item, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeItem(QString)));
connect(ui->evbox, SIGNAL(natureChanged(int)), this, SLOT(setNature(int)));
connect(ui->evbox, SIGNAL(natureBoostChanged()), ui->ivbox, SLOT(updateStats()));
connect(ui->ivbox, SIGNAL(statsUpdated()), ui->evbox, SLOT(updateEVs()));
updateAll();
}
示例9: ui
PokeEdit::PokeEdit(PokeTeam *poke, QAbstractItemModel *pokeModel, QAbstractItemModel *itemsModel, QAbstractItemModel *natureModel) :
ui(new Ui::PokeEdit),
pokemonModel(pokeModel),
m_poke(poke)
{
ui->setupUi(this);
ui->itemSprite->raise();
ui->item->setModel(itemsModel);
ui->nature->setModel(natureModel);
ui->levelSettings->setPoke(poke);
ui->evbox->setPoke(poke);
ui->ivbox->setPoke(poke);
movesModel = new PokeMovesModel(poke->num(), poke->gen(), this);
QSortFilterProxyModel *filter = new QSortFilterProxyModel(this);
filter->setSourceModel(movesModel);
ui->moveChoice->setModel(filter);
ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::PP, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Pow, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Acc, QHeaderView::ResizeToContents);
ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Name, QHeaderView::Fixed);
ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Name, 125);
ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Type, Theme::TypePicture(Type::Normal).width()+5);
ui->moveChoice->setIconSize(Theme::TypePicture(Type::Normal).size());
ui->moveChoice->sortByColumn(PokeMovesModel::Name, Qt::AscendingOrder);
m_moves[0] = ui->move1;
m_moves[1] = ui->move2;
m_moves[2] = ui->move3;
m_moves[3] = ui->move4;
connect(ui->speciesLabel, SIGNAL(clicked()), SLOT(on_pokemonFrame_clicked()));
connect(ui->moveChoice, SIGNAL(activated(QModelIndex)), SLOT(moveEntered(QModelIndex)));
/* the four move choice items */
for (int i = 0; i < 4; i++)
{
QCompleter *completer = new QCompleter(m_moves[i]);
completer->setModel(ui->moveChoice->model());
completer->setCompletionColumn(PokeMovesModel::Name);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setCompletionMode(QCompleter::PopupCompletion);
completer->setCompletionRole(Qt::DisplayRole);
m_moves[i]->setCompleter(completer);
completer->setProperty("move", i);
m_moves[i]->setProperty("move", i);
connect(completer, SIGNAL(activated(QString)), SLOT(changeMove()));
connect(m_moves[i], SIGNAL(returnPressed()), SLOT(changeMove()));
connect(m_moves[i], SIGNAL(editingFinished()), SLOT(changeMove()));
}
connect(ui->levelSettings, SIGNAL(levelUpdated()), this, SLOT(updateStats()));
connect(ui->levelSettings, SIGNAL(levelUpdated()), ui->ivbox, SLOT(updateStats()));
connect(ui->levelSettings, SIGNAL(shinyUpdated()), this, SLOT(updatePicture()));
connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updatePicture()));
connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updateGender()));
connect(ui->ivbox, SIGNAL(genderUpdated()), SLOT(updateGender()));
connect(ui->ivbox, SIGNAL(genderUpdated()), ui->levelSettings, SLOT(updateGender()));
connect(ui->ivbox, SIGNAL(shinyUpdated()), SLOT(updatePicture()));
connect(ui->ivbox, SIGNAL(shinyUpdated()), ui->levelSettings, SLOT(updateShiny()));
connect(ui->happiness, SIGNAL(valueChanged(int)), this, SLOT(changeHappiness(int)));
connect(ui->nature, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNature(int)));
connect(ui->item, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeItem(QString)));
connect(ui->evbox, SIGNAL(natureChanged(int)), this, SLOT(setNature(int)));
connect(ui->evbox, SIGNAL(natureBoostChanged()), ui->ivbox, SLOT(updateStats()));
connect(ui->ivbox, SIGNAL(statsUpdated()), ui->evbox, SLOT(updateEVs()));
updateAll();
}
示例10: QMainWindow
//.........这里部分代码省略.........
// Filter helper
auto MakeHitterFilter = [=](QString text, QString toolTip, const auto& onFilterFn) -> QAction*
{
QAction* action = new QAction(this);
connect(action, &QAction::toggled, hitterSortFilterProxyModel, onFilterFn);
action->setText(text);
action->setToolTip(toolTip);
action->setCheckable(true);
action->toggle();
hittingFilters->addAction(action);
return action;
};
// Hitter filters
QAction* filterC = MakeHitterFilter("C", "Filter Catchers", &PlayerSortFilterProxyModel::OnFilterC);
QAction* filter1B = MakeHitterFilter("1B", "Filter 1B", &PlayerSortFilterProxyModel::OnFilter1B);
QAction* filter2B = MakeHitterFilter("2B", "Filter 2B", &PlayerSortFilterProxyModel::OnFilter2B);
QAction* filterSS = MakeHitterFilter("SS", "Filter SS", &PlayerSortFilterProxyModel::OnFilterSS);
QAction* filter3B = MakeHitterFilter("3B", "Filter 3B", &PlayerSortFilterProxyModel::OnFilter3B);
QAction* filterOF = MakeHitterFilter("OF", "Filter Outfielders", &PlayerSortFilterProxyModel::OnFilterOF);
QAction* filterCI = MakeHitterFilter("CI", "Filter Corner Infielders", &PlayerSortFilterProxyModel::OnFilterCI);
QAction* filterMI = MakeHitterFilter("MI", "Filter Middle Infielders", &PlayerSortFilterProxyModel::OnFilterMI);
QAction* filterDH = MakeHitterFilter("DH", "Filter Designated Hitters", &PlayerSortFilterProxyModel::OnFilterDH);
QAction* filterU = MakeHitterFilter("U", "Filter Utility", &PlayerSortFilterProxyModel::OnFilterU);
// Menu spacer
QWidget* spacer = new QWidget(this);
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// Completion Widget
QCompleter* completer = new QCompleter(this);
completer->setModel(playerTableModel);
completer->setCompletionColumn(PlayerTableModel::COLUMN_NAME);
completer->setFilterMode(Qt::MatchContains);
completer->setCaseSensitivity(Qt::CaseInsensitive);
// Select
auto HighlightPlayerInTable = [=](const QModelIndex& srcIdx)
{
// Lookup catergory
auto catergoryIdx = srcIdx.model()->index(srcIdx.row(), PlayerTableModel::COLUMN_CATERGORY);
auto catergory = srcIdx.model()->data(catergoryIdx).toUInt();
// Change to tab
hitterPitcherTabs->setCurrentIndex(CaterogyToTab(catergory));
// Select row
if (catergory == Player::Catergory::Hitter) {
auto proxyModel = dynamic_cast<QSortFilterProxyModel*>(hitterTableView->model());
auto proxyIdx = proxyModel->mapFromSource(srcIdx);
hitterTableView->selectRow(proxyIdx.row());
hitterTableView->setFocus();
} else if (catergory == Player::Catergory::Pitcher) {
auto proxyModel = dynamic_cast<QSortFilterProxyModel*>(pitcherTableView->model());
auto proxyIdx = proxyModel->mapFromSource(srcIdx);
pitcherTableView->selectRow(proxyIdx.row());
pitcherTableView->setFocus();
}
};
// Select the target
connect(completer, static_cast<void (QCompleter::*)(const QModelIndex&)>(&QCompleter::activated), [=](const QModelIndex& index) {
// Get player index
QAbstractProxyModel* proxyModel = dynamic_cast<QAbstractProxyModel*>(completer->completionModel());