本文整理汇总了C++中QSimCommand::setWantDigits方法的典型用法代码示例。如果您正苦于以下问题:C++ QSimCommand::setWantDigits方法的具体用法?C++ QSimCommand::setWantDigits怎么用?C++ QSimCommand::setWantDigits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSimCommand
的用法示例。
在下文中一共展示了QSimCommand::setWantDigits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sticksGameShow
void DemoSimApplication::sticksGameShow()
{
QSimCommand cmd;
if ( sticksLeft == 1 ) {
cmd.setType( QSimCommand::GetInkey );
cmd.setText( "There is only 1 stick left. You lose. Play again?" );
cmd.setWantYesNo( true );
command( cmd, this, SLOT(sticksGamePlayAgain(QSimTerminalResponse)) );
} else {
cmd.setType( QSimCommand::GetInkey );
cmd.setText( "There are 21 sticks left. How many do you take (1, 2, or 3)?" );
cmd.setWantDigits( true );
if ( sticksLeft == 21 )
cmd.setHasHelp( true );
command( cmd, this, SLOT(sticksGameLoop(QSimTerminalResponse)) );
}
}
示例2: sticksGameLoop
void DemoSimApplication::sticksGameLoop( const QSimTerminalResponse& resp )
{
QSimCommand cmd;
if ( resp.result() == QSimTerminalResponse::Success ) {
// User has selected the number of sticks they want.
int taken = 0;
if ( resp.text() == "1" ) {
taken = 1;
} else if ( resp.text() == "2" ) {
taken = 2;
} else if ( resp.text() == "3" ) {
taken = 3;
} else {
cmd.setType( QSimCommand::GetInkey );
cmd.setText( "Must be 1, 2, or 3. There are " + QString::number( sticksLeft ) +
" sticks left. How many sticks do you take?" );
cmd.setWantDigits( true );
command( cmd, this, SLOT(sticksGameLoop(QSimTerminalResponse)) );
return;
}
cmd.setType( QSimCommand::DisplayText );
cmd.setDestinationDevice( QSimCommand::Display );
cmd.setText( "I take " + QString::number( 4 - taken ) + " sticks." );
cmd.setClearAfterDelay( true );
sticksLeft -= 4;
command( cmd, this, SLOT(sticksGameShow()) );
} else if ( resp.result() == QSimTerminalResponse::HelpInformationRequested ) {
// Display help for the game.
cmd.setType( QSimCommand::DisplayText );
cmd.setDestinationDevice( QSimCommand::Display );
cmd.setText( "Starting with 21 sticks, players pick up 1, 2, or 3 sticks at a time. "
"The loser is the player who has to pick up the last stick." );
command( cmd, this, SLOT(startSticksGame()) );
} else {
// Probably aborted.
mainMenu();
}
}
示例3: mainMenuSelection
void DemoSimApplication::mainMenuSelection( int id )
{
QSimCommand cmd;
switch ( id ) {
case MainMenu_News:
{
QTimer::singleShot( 0, this, SLOT(sendDisplayText()) );
}
break;
case MainMenu_Sports:
{
sendSportsMenu();
}
break;
case MainMenu_Time:
{
cmd.setType( QSimCommand::SetupCall );
cmd.setNumber( "1194" );
cmd.setText( "Dialing the Time Guy ..." );
command( cmd, this, SLOT(mainMenu()) );
}
break;
case MainMenu_SticksGame:
{
startSticksGame();
}
break;
case MainMenu_Tones:
{
sendToneMenu();
}
break;
case MainMenu_Icons:
{
sendIconMenu();
}
break;
case MainMenu_IconsSE:
{
sendIconSEMenu();
}
break;
case MainMenu_Finance:
{
cmd.setType( QSimCommand::GetInput );
cmd.setText( "Enter code" );
cmd.setWantDigits( true );
cmd.setMinimumLength( 3 );
cmd.setHasHelp( true );
command( cmd, this, SLOT(getInputLoop(QSimTerminalResponse)) );
}
break;
case MainMenu_Browser:
{
sendBrowserMenu();
}
break;
default:
{
// Don't know what this item is, so just re-display the main menu.
mainMenu();
}
break;
}
}