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


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

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


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

示例1: 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()));
    }
}
开发者ID:BakedCoder,项目名称:pokemon-online,代码行数:49,代码来源:pokeedit.cpp

示例2: 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()));
}
开发者ID:CarnegieJames,项目名称:pokemon-online,代码行数:46,代码来源:pokeselection.cpp

示例3: on_client_merged

void ProjectManagerPlugin::on_client_merged(qmdiHost *host)
{
    if (m_dockWidget)
        return;

    QMainWindow *window = dynamic_cast<QMainWindow*>(host);
    m_dockWidget = new QDockWidget(window);
    m_dockWidget->setObjectName("m_dockWidget");
    m_dockWidget->setWindowTitle( tr("Project") );

#if 0
    m_treeView = new QTreeView(m_dockWidget);
    m_treeView->setAlternatingRowColors(true);
    m_dockWidget->setWidget(m_treeView);
#else
    QWidget *w = new QWidget(m_dockWidget);
    m_gui =  new Ui::ProjectManagerGUI;
    m_gui->setupUi(w);
    m_dockWidget->setWidget(w);
#endif

    m_projectModel = new FoldersModel(m_gui->filesView);
    //m_projectModel->processDir("/home/elcuco/src/qtedit4/");
//	m_projectModel->processDir("/home/elcuco/src/qt-creator/");
    m_projectModel->processDir("/home/elcuco/src/googlecode/qtedit4/trunk/");
//	m_projectModel->processDir("c:\\Users\\elcuco\\Source\\qtedit4");
    m_gui->filesView->setModel(m_projectModel);
    window->addDockWidget( Qt::LeftDockWidgetArea, m_dockWidget );

    QCompleter *completer = new GenericItemCompleter();
    completer->setModel(m_projectModel);
    completer->setParent(m_gui->filenameLineEdit);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
    completer->setCompletionRole(0);
    completer->setCompletionPrefix("/");
    m_gui->filenameLineEdit->setCompleter(completer);

    connect(m_gui->filesView,SIGNAL(clicked(QModelIndex)),this,SLOT(onItemClicked(QModelIndex)));
    connect(m_gui->addDirectoryButton,SIGNAL(clicked()),this,SLOT(onAddDirectoryClicked()));
}
开发者ID:hunt978,项目名称:qtedit4,代码行数:41,代码来源:ProjectManagerPlg.cpp

示例4: 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();
}
开发者ID:BakedCoder,项目名称:pokemon-online,代码行数:69,代码来源:pokeedit.cpp

示例5: 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();
}
开发者ID:Isa-,项目名称:pokemon-online,代码行数:75,代码来源:pokeedit.cpp


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