AppUI: 增加几个按钮
This commit is contained in:
parent
7af41f19ee
commit
8379ea30fe
|
@ -24,6 +24,24 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>玩家:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>电脑:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GameView" name="gameView">
|
||||
<property name="sizePolicy">
|
||||
|
@ -49,6 +67,41 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_newGame">
|
||||
<property name="text">
|
||||
<string>新局</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_giveUp">
|
||||
<property name="text">
|
||||
<string>认输</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_hint">
|
||||
<property name="text">
|
||||
<string>提示</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_retractMove">
|
||||
<property name="text">
|
||||
<string>悔棋</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
|
@ -57,7 +110,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>491</width>
|
||||
<height>21</height>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_F">
|
||||
|
|
|
@ -602,6 +602,7 @@ bool GameController::actionPiece(QPointF pos)
|
|||
|
||||
// 在浏览历史记录时点击棋盘,则认为是悔棋
|
||||
if (currentRow != manualListModel.rowCount() - 1) {
|
||||
#ifndef MOBILE_APP_UI
|
||||
// 定义新对话框
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
|
@ -614,6 +615,7 @@ bool GameController::actionPiece(QPointF pos)
|
|||
(msgBox.button(QMessageBox::Cancel))->setText(tr("取消"));
|
||||
|
||||
if (QMessageBox::Ok == msgBox.exec()) {
|
||||
#endif /* !MOBILE_APP_UI */
|
||||
chess_ = chessTemp;
|
||||
manualListModel.removeRows(currentRow + 1, manualListModel.rowCount() - currentRow - 1);
|
||||
|
||||
|
@ -626,9 +628,12 @@ bool GameController::actionPiece(QPointF pos)
|
|||
// 发信号更新状态栏
|
||||
message = QString::fromStdString(chess_.getTips());
|
||||
emit statusBarChanged(message);
|
||||
#ifndef MOBILE_APP_UI
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
return false;
|
||||
#endif /* !MOBILE_APP_UI */
|
||||
}
|
||||
}
|
||||
|
||||
// 如果未开局则开局
|
||||
|
|
|
@ -279,6 +279,11 @@ void NineChessWindow::initialize()
|
|||
connect(ui.actionPrevious_B, &QAction::triggered,
|
||||
this, &NineChessWindow::on_actionRowChange);
|
||||
|
||||
#ifdef MOBILE_APP_UI
|
||||
connect(ui.pushButton_retractMove, &QPushButton::released,
|
||||
this, &NineChessWindow::on_actionRowChange);
|
||||
#endif
|
||||
|
||||
connect(ui.actionNext_F, &QAction::triggered,
|
||||
this, &NineChessWindow::on_actionRowChange);
|
||||
|
||||
|
@ -633,7 +638,11 @@ void NineChessWindow::on_actionRowChange()
|
|||
if (obsender != nullptr) {
|
||||
if (obsender == ui.actionBegin_S) {
|
||||
ui.listView->setCurrentIndex(model->index(0, 0));
|
||||
} else if (obsender == ui.actionPrevious_B) {
|
||||
} else if (obsender == ui.actionPrevious_B
|
||||
#ifdef MOBILE_APP_UI
|
||||
|| obsender == ui.pushButton_retractMove
|
||||
#endif /* MOBILE_APP_UI */
|
||||
) {
|
||||
if (currentRow > 0) {
|
||||
ui.listView->setCurrentIndex(model->index(currentRow - 1, 0));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue