ui: 界面上显示总盘数

This commit is contained in:
Calcitem 2020-05-02 22:20:27 +08:00
parent f830f8bb8b
commit 9d715fc6a0
4 changed files with 43 additions and 0 deletions

View File

@ -572,6 +572,41 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelGamesPlayed">
<property name="font">
<font>
<family>黑体</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>盘数:</string>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="scoreLcdNumber_GamesPlayed">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="smallDecimalPoint">
<bool>false</bool>
</property>
<property name="digitCount">
<number>5</number>
</property>
<property name="value" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelScore">
<property name="font">

View File

@ -249,6 +249,7 @@ void GameController::gameReset()
emit statusBarChanged(message);
// 更新比分 LCD 显示
emit nGamesPlayedChanged(QString::number(state.nPlayed, 10));
emit score1Changed(QString::number(state.score[BLACK], 10));
emit score2Changed(QString::number(state.score[WHITE], 10));
emit scoreDrawChanged(QString::number(state.score_draw, 10));

View File

@ -134,6 +134,9 @@ public:
signals:
// 总盘数改变的信号
void nGamesPlayedChanged(const QString &score);
// 玩家1(先手)赢盘数改变的信号
void score1Changed(const QString &score);

View File

@ -271,6 +271,10 @@ void MillGameWindow::initialize()
// 关联控制器的信号和主窗口控件的槽
// 更新LCD显示总盘数
connect(gameController, SIGNAL(nGamesPlayedChanged(QString)),
ui.scoreLcdNumber_GamesPlayed, SLOT(display(QString)));
// 更新LCD显示玩家1赢盘数
connect(gameController, SIGNAL(score1Changed(QString)),
ui.scoreLcdNumber_1, SLOT(display(QString)));