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


C++ SpinBox::setMaxValue方法代码示例

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


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

示例1: openExchangeWindow

void GameEngine::openExchangeWindow()
{
    if (exchangeWindow == NULL)
    {
        exchangeWindow = new ModalWindow("ExchangeMW", "Exchange", 400, 300);

        //offer block
        Label* tmpLbl = new Label("You offer:", "OfferLbl", 0, 0, 50, 15);
        exchangeWindow->addUIElement(tmpLbl, 0.45, 0.01);

        for (int i = 0; i < CT_DEVELOPMENT; ++i)
        {
            int resNumber = currentPlayer->getCardsOnHandCount(static_cast<eCardType> (i));
            QString str = GameCard::cardTypeToStr(static_cast<eCardType> (i));

            tmpLbl = new Label(str + " (" + QString::number(resNumber) + ")", "OfferLbl"+str, 0, 0, 50, 15);
            exchangeWindow->addUIElement(tmpLbl, 0.05+0.2*i, 0.07);

            SpinBox* tmpSB = new SpinBox("OfferSB"+str, 0, 0, 25, 50);

            tmpSB->setMinValue(0);
            tmpSB->setMaxValue(resNumber);
            //tmpSB->setStep(currentPlayer->getExchangeRate(static_cast<eCardType> (i)));

            exchangeWindow->addUIElement(tmpSB, 0.05+0.2*i, 0.15);
        }

        //offer for who - players or game bank
        tmpLbl = new Label("Exchange whith:", "ExchangeWhithLbl", 0, 0, 50, 15);
        exchangeWindow->addUIElement(tmpLbl, 0.45, 0.33);

        RadioButtonBox* tmprbb =  new RadioButtonBox("ExchangeTarget", 0, 0, 300, 15, RadioButtonBox::HORIZONTAL);
        tmprbb->addRadioButton("Player", "Players", 75, 15);
        tmprbb->addRadioButton("PC", "PC", 75, 15);
        exchangeWindow->addUIElement(tmprbb, 0.25, 0.40);

        //taking block
        tmpLbl = new Label("You taking:", "OfferLbl", 0, 0, 50, 15);
        exchangeWindow->addUIElement(tmpLbl, 0.45, 0.43);

        for (int i = 0; i < CT_DEVELOPMENT; ++i)
        {
            QString str = GameCard::cardTypeToStr(static_cast<eCardType> (i));

            tmpLbl = new Label(str, "TakingLbl"+str, 0, 0, 50, 15);
            exchangeWindow->addUIElement(tmpLbl, 0.05+0.2*i, 0.50);

            SpinBox* tmpSB = new SpinBox("TakingSB"+str, 0, 0, 25, 50);

            tmpSB->setMinValue(0);
            tmpSB->setMaxValue(MAX_CARD_COUNT);

            exchangeWindow->addUIElement(tmpSB, 0.05+0.2*i, 0.60);
        }

        //bottom buttons
        Command* mousePress = new GECcloseEW(this);
        Button* tmpBtn = new Button("Cancel", "CancelBtn", 0, 0, 75, 25, mousePress);
        exchangeWindow->addUIElement(tmpBtn, 0.55, 0.85);

        mousePress = new GECsendExchangeOfferBtn(this);
        tmpBtn = new Button("Exchange", "ExchangeBtn", 0, 0, 75, 25, mousePress);
        exchangeWindow->addUIElement(tmpBtn, 0.30, 0.85);

        mousePress = new GECcloseEW(this);
        exchangeWindow->addKeyCommand(Qt::Key_Escape, mousePress);

        exchangeWindow->show(true);
        exchangeWindow->active(true);
    }
}
开发者ID:RidgeA,项目名称:Colonization,代码行数:71,代码来源:gameengine.cpp


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