From c4af04586343e3552abc7bb046833d06f184584f Mon Sep 17 00:00:00 2001 From: Ren Zihou Date: Tue, 24 Aug 2021 21:38:24 +0800 Subject: [PATCH] optimize selection display --- src/ChessLabel.cpp | 1 + src/board.cpp | 1 + src/mainwindow.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ChessLabel.cpp b/src/ChessLabel.cpp index 3ed6524..ebd63c0 100644 --- a/src/ChessLabel.cpp +++ b/src/ChessLabel.cpp @@ -46,6 +46,7 @@ void ChessLabel::kill() { void ChessLabel::highlight(bool h /* = true */) { h ? this->setStyleSheet("border: 2px solid red;") : this->setStyleSheet(""); + this->setAlignment(Qt::AlignCenter); } QString ChessLabel::qrcFilename() const { diff --git a/src/board.cpp b/src/board.cpp index 7f43acd..017023e 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -381,6 +381,7 @@ void Board::countDown() { timer->stop(); return; } + this->setSelected(nullptr); this->flipTurn(); this->resetTimer(); emit this->timeOut(timeout); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3860df2..c087e81 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -145,7 +145,7 @@ void MainWindow::connectionEstablished() { void MainWindow::connectionInterrupted() { this->setState(server == nullptr ? DISCONNECTED : LISTENING); socket = nullptr; - QMessageBox::information(this, "Connection Lost", "Connection is interrupted"); + QMessageBox::information(this, "Connection Lost", "Connection interrupted."); qDebug() << "connection interrupted"; }