本文整理汇总了C++中Match::playerB方法的典型用法代码示例。如果您正苦于以下问题:C++ Match::playerB方法的具体用法?C++ Match::playerB怎么用?C++ Match::playerB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::playerB方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/** Find match which corresponds to player 'a' and 'b' pair.
*/
Match& Group::match( Player a, Player b )
{
for ( int i = 0; i < _matches.count(); i ++ ) {
Match m = _matches.at( i );
if ( ( m.playerA() == a ) && ( m.playerB() == b ) ) {
return _matches[ i ];
} else if ( ( m.playerB() == a ) && ( m.playerA() == b ) ) {
_matches[i].swapPlayers();
return _matches[ i ];
}
}
// should never get here!
qWarning() << "can't find match of " << a.name() << "and" << b.name();
return (* new Match( a, b ) );
}
示例2: removePlayer
/** removes player from players list and removes
* all matches which he/she had participated
*/
void Group::removePlayer( Player player )
{
_players.removeOne( player );
QMutableListIterator<Match> i( _matches );
while( i.hasNext() ) {
Match m = i.next();
if ( ( m.playerA() == player ) ||
( m.playerB() == player ) ) {
i.remove();
}
}
}
示例3: playedMatchList
MatchList Group::playedMatchList( Player p ) const
{
MatchList ml;
for ( int i = 0; i < _matches.count(); i ++ ) {
Match m = _matches.at( i );
if ( ( m.playerA() == p ) || ( m.playerB() == p ) ) {
if ( m.played() ) {
ml << m;
}
}
}
return ml;
}
示例4: QDialog
MatchResDialog::MatchResDialog( Match match, QWidget* parent )
: QDialog( parent ),
_match( match ),
_okButton( new QPushButton( tr( "Save" ) ) )
{
setWindowTitle( tr( "Match score" ) );
_okButton->setEnabled( false );
QGridLayout* l = new QGridLayout( this );
QLabel* playerA = new QLabel( match.playerA().name(), this );
QLabel* playerB = new QLabel( match.playerB().name(), this );
l->addWidget( playerA, 0, 0, Qt::AlignJustify );
l->addWidget( playerB, 0, 1, Qt::AlignJustify );
unsigned int games = match.games_const().count();
for ( unsigned int i = 0; i < match.maxGames(); i ++ ) {
QLineEdit* ballsA = new QLineEdit( this );
QLineEdit* ballsB = new QLineEdit( this );
if ( i < games ) {
// this should be done before connecting of lineedits to textChanged
// slot
ballsA->setText( QString::number( match.games_const().at( i ).aBalls ) );
ballsB->setText( QString::number( match.games_const().at( i ).bBalls ) );
}
connect( ballsA, SIGNAL( textChanged( const QString& ) ),
this, SLOT( textChanged( ) ) );
connect( ballsB, SIGNAL( textChanged( const QString& ) ),
this, SLOT( textChanged( ) ) );
l->addWidget( ballsA, i + 1, 0 );
l->addWidget( ballsB, i + 1, 1 );
}
if ( games ) {
textChanged();
}
l->addWidget( _okButton, l->rowCount(), 0, 1, 2 );
connect( _okButton, SIGNAL( clicked() ), this, SLOT( okButtonClicked() ) );
}
示例5: setMatchResults
void Group::setMatchResults( Match m )
{
setMatchResults( m.playerA(), m.playerB(), m.games_const() );
}