diff --git a/CMakeLists.txt b/CMakeLists.txt index cb4eec4..5bbf50a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,11 @@ set(CMAKE_AUTOMOC ON) #打开全局moc set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(QT_VERSION_MAJOR 6) +if (${QT_VERSION_MAJOR} GREATER_EQUAL 6) + set(DTK_VERSION 6) +endif() + #对DApplication 进行加速 set(CMAKE_EXE_LINKER_FLAGS "-pie") diff --git a/debian/control b/debian/control index 2ca1c40..6d03ae6 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: com.deepin.lianliankan Section: utils Priority: optional Maintainer: Packages -Build-Depends: debhelper (>= 11),cmake, pkg-config, qtbase5-dev, qtchooser (>= 55-gc9562a1-1~),qt5-qmake, libdtkwidget-dev, qttools5-dev-tools, libqt5svg5-dev, qttools5-dev,libgtest-dev, libgmock-dev, qtmultimedia5-dev +Build-Depends: debhelper (>= 11),cmake, pkg-config, qt6-base-dev, qtchooser (>= 55-gc9562a1-1~),qmake6, libdtk6widget-dev, qt6-tools-dev-tools, qt6-svg-dev, qt6-tools-dev,libgtest-dev, libgmock-dev, qt6-multimedia-dev Standards-Version: 4.1.3 Package: com.deepin.lianliankan diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a759279..f1447f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,11 +17,11 @@ endif() # Find the library include(FindPkgConfig) find_package(PkgConfig REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5LinguistTools REQUIRED) -find_package(DtkWidget REQUIRED) -find_package(Qt5 COMPONENTS Multimedia REQUIRED) -pkg_search_module(DtkWidget REQUIRED dtkwidget) +find_package(Qt${QT_VERSION_MAJOR}Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Multimedia REQUIRED) +find_package(Dtk${DTK_VERSION}Core REQUIRED) +find_package(Dtk${DTK_VERSION}Widget REQUIRED) +find_package(Dtk${DTK_VERSION}Gui REQUIRED) #lupdate start set(TS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../translations") @@ -45,25 +45,24 @@ file(GLOB INSTALL_QM_FILES ../translations/*.qm) #源文件、头文件和资源文件 include_directories(${PROJECT_SOURCE_DIR}) -include_directories(${DtkWidget_INCLUDE_DIRS}) -include_directories(${DtkCore_INCLUDE_DIRS}) -include_directories(${DtkGui_INCLUDE_DIRS}) file(GLOB_RECURSE c_files RELATIVE ${PROJECT_SOURCE_DIR} source/*.cpp source/*.c ../main.cpp) file(GLOB_RECURSE h_files RELATIVE ${PROJECT_SOURCE_DIR} source/*.h *.h) -file(GLOB_RECURSE res_files RELATIVE ${PROJECT_SOURCE_DIR} *.qrc) #添加资源文件 -QT5_ADD_RESOURCES(QRC_FILES ${res_files}) +file(GLOB_RECURSE QRC_SOURCE_FILES ./*.qrc) +qt_add_resources(QRC_FILES ${QRC_SOURCE_FILES}) #生成可执行程序 add_executable(${EXE_NAME} ${c_files} ${h_files} ${QRC_FILES}) -target_include_directories(${EXE_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${OBJECT_BINARY_DIR}) +target_include_directories(${EXE_NAME} PUBLIC ${OBJECT_BINARY_DIR}) target_link_libraries(${EXE_NAME} - ${DtkWidget_LIBRARIES} - ${Qt5Widgets_LIBRARIES} - Qt5::Multimedia + Dtk${DTK_VERSION}::Core + Dtk${DTK_VERSION}::Gui + Dtk${DTK_VERSION}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Multimedia ) # Install files diff --git a/src/main.cpp b/src/main.cpp index 50ee3b2..2cdf0c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,7 +10,9 @@ #include #include #include +#if QT_VERSION_MAJOR <= 5 #include +#endif #include #include #include @@ -52,7 +54,9 @@ int main(int argc, char *argv[]) DLogManager::registerConsoleAppender(); DLogManager::registerFileAppender(); +#if QT_VERSION_MAJOR <= 5 DApplicationSettings saveTheme; +#endif // QTime t; // t.start(); diff --git a/src/source/closewindowdialog.cpp b/src/source/closewindowdialog.cpp index 3f3a3a5..38b66c5 100644 --- a/src/source/closewindowdialog.cpp +++ b/src/source/closewindowdialog.cpp @@ -5,7 +5,6 @@ #include "closewindowdialog.h" -#include #include #include diff --git a/src/source/gamebutton.cpp b/src/source/gamebutton.cpp index 37204b2..4313ce4 100644 --- a/src/source/gamebutton.cpp +++ b/src/source/gamebutton.cpp @@ -131,7 +131,11 @@ void GameButton::paintEvent(QPaintEvent *e) QFontMetricsF mertic(m_font); qreal fontHeight = mertic.height(); +#if QT_VERSION_MAJOR > 5 + qreal fontWidth = mertic.boundingRect(m_text).width(); +#else qreal fontWidth = mertic.width(m_text); +#endif qreal textX = (rect().width() - fontWidth) / 2; qreal textY = (rect().height() - fontHeight - fontHeight / 2) / 2; p.setFont(shadowFont); @@ -199,7 +203,11 @@ void GameButton::mouseReleaseEvent(QMouseEvent *e) return QPushButton::mouseReleaseEvent(e); } +#if QT_VERSION_MAJOR > 5 +void GameButton::enterEvent(QEnterEvent *event) +#else void GameButton::enterEvent(QEvent *event) +#endif { if (!this->isEnabled()) { return; @@ -269,7 +277,11 @@ void GameButton::drawBackdrop(QPainter &p) QPen pen; pen.setWidth(0); p.setPen(pen); +#if QT_VERSION_MAJOR > 5 + p.drawRoundedRect(this->rect().x() + 3, this->rect().y() + 5, 42, 42, 40, 40); +#else p.drawRoundRect(this->rect().x() + 3, this->rect().y() + 5, 42, 42, 40, 40); +#endif } void GameButton::setBtnMask(QPixmap &pic) diff --git a/src/source/gamebutton.h b/src/source/gamebutton.h index 0327d52..3f98fbd 100644 --- a/src/source/gamebutton.h +++ b/src/source/gamebutton.h @@ -78,7 +78,11 @@ class GameButton : public QPushButton void paintEvent(QPaintEvent *event) override; void mousePressEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; +#if QT_VERSION_MAJOR > 5 + void enterEvent(QEnterEvent *event) override; +#else void enterEvent(QEvent *event) override; +#endif void leaveEvent(QEvent *event) override; private: diff --git a/src/source/gamelinescene.cpp b/src/source/gamelinescene.cpp index 95e49a2..4fb1f79 100644 --- a/src/source/gamelinescene.cpp +++ b/src/source/gamelinescene.cpp @@ -34,7 +34,11 @@ void GameLineScene::paintEvent(QPaintEvent *event) } else { QPainter painter(this); //反走样 +#if QT_VERSION_MAJOR > 5 + painter.setRenderHint(QPainter::Antialiasing, true); +#else painter.setRenderHint(QPainter::HighQualityAntialiasing, true); +#endif //获取爆炸图片 const QPixmap &pic = GameControl::m_picMap.value(qMakePair(ExplodePic, Default)); QPen pen; diff --git a/src/source/gameoverblureffectwidget.cpp b/src/source/gameoverblureffectwidget.cpp index cdd22bd..6d1fbde 100644 --- a/src/source/gameoverblureffectwidget.cpp +++ b/src/source/gameoverblureffectwidget.cpp @@ -110,7 +110,11 @@ void GameoverBlurEffectWidget::initUI() void GameoverBlurEffectWidget::initConnect() { +#if QT_VERSION_MAJOR > 5 + connect(m_OverBtnGroup, &QButtonGroup::idClicked, this, &GameoverBlurEffectWidget::onButtonPressed); +#else connect(m_OverBtnGroup, QOverload::of(&QButtonGroup::buttonClicked), this, &GameoverBlurEffectWidget::onButtonPressed); +#endif } void GameoverBlurEffectWidget::updateLabel(QString text) diff --git a/src/source/gamepage.cpp b/src/source/gamepage.cpp index 0ac8510..b966da6 100644 --- a/src/source/gamepage.cpp +++ b/src/source/gamepage.cpp @@ -12,7 +12,6 @@ #include #include -#include #include #include #include @@ -35,10 +34,16 @@ GamePage::GamePage(QWidget *parent) m_hintPicOffTimer = new QTimer(this); m_hintPicOffTimer->setInterval(200); m_flashCount = BtnFlashCount; +#if QT_VERSION_MAJOR > 5 + m_player = new QMediaPlayer(this); + m_audioOutput = new QAudioOutput(this); + m_player->setAudioOutput(m_audioOutput); +#else QSound *serachSuccess = new QSound(":/assets/Sound/ConnectSuccess.wav", this); QSound *serachFailed = new QSound(":/assets/Sound/ConnectFailed.wav", this); m_soundMap.insert("success", serachSuccess); m_soundMap.insert("failed", serachFailed); +#endif initUI(); initConnect(); } @@ -237,7 +242,11 @@ void GamePage::initUI() void GamePage::initConnect() { +#if QT_VERSION_MAJOR > 5 + QObject::connect(m_controlGrp, &QButtonGroup::idClicked, this, &GamePage::onControlBtnControl); +#else QObject::connect(m_controlGrp, QOverload::of(&QButtonGroup::buttonClicked), this, &GamePage::onControlBtnControl); +#endif QObject::connect(m_animalGrp, QOverload::of(&QButtonGroup::buttonPressed), this, &GamePage::onAnimalBtnControl); QObject::connect(m_progress, &GameProgressBar::valueChanged, this, &GamePage::onProgressChanged); QObject::connect(m_hintPicOnTimer, &QTimer::timeout, this, &GamePage::onhintPicOnTimerOut); @@ -330,8 +339,13 @@ void GamePage::successAction(GameButton *preBtn, GameButton *currentBtn) updateConnection(preBtn, currentBtn); //连线成功音效 - if (m_soundSwitch) + if (m_soundSwitch) { +#if QT_VERSION_MAJOR > 5 + m_player->setSource(QUrl("qrc:/assets/Sound/ConnectSuccess.wav")); +#else m_soundMap.value("success")->play(); +#endif + } //更新地图 GameControl::m_map[currentBtn->location().x()][currentBtn->location().y()] = GameBtnFlag::ButtonBlank; GameControl::m_map[preBtn->location().x()][preBtn->location().y()] = GameBtnFlag::ButtonBlank; @@ -366,8 +380,13 @@ void GamePage::successAction(GameButton *preBtn, GameButton *currentBtn) void GamePage::failedAction(GameButton *preBtn, GameButton *currentBtn) { //连线失败音效 - if (m_soundSwitch) + if (m_soundSwitch) { +#if QT_VERSION_MAJOR > 5 + m_player->setSource(QUrl("qrc:/assets/Sound/ConnectFailed.wav")); +#else m_soundMap.value("failed")->play(); +#endif + } //添加当前选中按钮,pop前一个按钮 m_locationVec.append(currentBtn); m_locationVec.pop_front(); diff --git a/src/source/gamepage.h b/src/source/gamepage.h index 3b5ae23..6912495 100644 --- a/src/source/gamepage.h +++ b/src/source/gamepage.h @@ -15,7 +15,12 @@ #include #include #include +#if QT_VERSION_MAJOR > 5 +#include +#include +#else #include +#endif class GameLineScene; DWIDGET_USE_NAMESPACE @@ -200,7 +205,12 @@ public slots: QGridLayout *m_gameBtngridLayout; //游戏按钮布局 QButtonGroup *m_animalGrp; //游戏动物按钮组 QButtonGroup *m_controlGrp; //控制按钮组 +#if QT_VERSION_MAJOR > 5 + QMediaPlayer *m_player; + QAudioOutput *m_audioOutput; +#else QMap m_soundMap; //游戏音效 +#endif QTimer *m_timer; //定时器 QTimer *m_hintPicOnTimer;//提示闪烁定时器(展示) QTimer *m_hintPicOffTimer;//提示闪烁定时器(隐藏) diff --git a/src/source/gameprogressbar.cpp b/src/source/gameprogressbar.cpp index e056d92..9fe248e 100644 --- a/src/source/gameprogressbar.cpp +++ b/src/source/gameprogressbar.cpp @@ -83,7 +83,11 @@ void GameProgressBar::paintEvent(QPaintEvent *e) BackFont.setWeight(QFont::DemiBold); BackFont.setPointSize(15); QFontMetricsF mertic(textFont); +#if QT_VERSION_MAJOR > 5 + qreal merticWidth = mertic.boundingRect(text).width(); +#else qreal merticWidth = mertic.width(text); +#endif qreal merticHeight = mertic.height(); //绘制字体阴影效果 diff --git a/src/source/mainpage.cpp b/src/source/mainpage.cpp index 59ee20b..e858548 100644 --- a/src/source/mainpage.cpp +++ b/src/source/mainpage.cpp @@ -59,7 +59,11 @@ void MainPage::initUI() void MainPage::initConnect() { +#if QT_VERSION_MAJOR > 5 + connect(m_btnGrp, &QButtonGroup::idClicked, this, &MainPage::buttonPress); +#else connect(m_btnGrp, static_cast(&QButtonGroup::buttonClicked), this, &MainPage::buttonPress); +#endif connect(m_soundBtn, &GameButton::pressed, this, [&] { this->setSoundState(!m_soundState); }); diff --git a/src/source/shadowlabel.cpp b/src/source/shadowlabel.cpp index ccd2c0e..fa0f249 100644 --- a/src/source/shadowlabel.cpp +++ b/src/source/shadowlabel.cpp @@ -11,7 +11,11 @@ ShadowLabel::ShadowLabel(QWidget *parent) : DLabel (parent) { m_font.setFamily("Noto Sans CJK SC"); m_font.setPixelSize(21); +#if QT_VERSION_MAJOR > 5 + m_font.setWeight(QFont::Medium); +#else m_font.setWeight(580); +#endif setFont(m_font); } @@ -23,10 +27,11 @@ void ShadowLabel::paintEvent(QPaintEvent *event) painterText.setRenderHint(QPainter::Antialiasing, true); QFontMetrics fm(m_font); + int textWidth = fm.boundingRect(text).width(); //设置渐变区域,参数为区域右上角和右下角。表示垂直线性渐变 - QLinearGradient lg(rect().width()/2 - fm.width(text)/2, + QLinearGradient lg(rect().width()/2 - textWidth/2, rect().y(), - rect().width()/2 - fm.width(text)/2, + rect().width()/2 - textWidth/2, rect().y() + fm.height()); lg.setSpread(QGradient::RepeatSpread); if (m_result) { @@ -45,8 +50,8 @@ void ShadowLabel::paintEvent(QPaintEvent *event) QPen textcolor; textcolor.setBrush(lg); painterText.setPen(textcolor); - painterText.drawText(QRectF(rect().width()/2 - fm.width(text)/2, + painterText.drawText(QRectF(rect().width()/2 - textWidth/2, rect().y(), - fm.width(text), + textWidth, fm.height()), text); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 49d88a4..79bb8b5 100755 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,16 +8,16 @@ if (NOT DEFINED VERSION) set(VERSION 1.0.0) endif () configure_file(../src/environments.h.in environments.h @ONLY) -set(LINK_LIBS - Qt5::Core - Qt5::Widgets - Qt5::Gui - Qt5::Multimedia - Qt5::Test - ${DtkWidget_LIBRARIES} - ${DtkCore_LIBRARIES} - ${DtkGUI_LIBRARIES} -) +# set(LINK_LIBS +# Qt5::Core +# Qt5::Widgets +# Qt5::Gui +# Qt5::Multimedia +# Qt5::Test +# ${DtkWidget_LIBRARIES} +# ${DtkCore_LIBRARIES} +# ${DtkGUI_LIBRARIES} +# ) #可访问private ADD_COMPILE_OPTIONS(-fno-access-control) ADD_COMPILE_OPTIONS(-fno-inline) @@ -50,15 +50,14 @@ endif() # Find the library find_package(PkgConfig REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5Gui REQUIRED) -find_package(Qt5Core REQUIRED) -find_package(DtkWidget REQUIRED) -find_package(DtkGui REQUIRED) -find_package(DtkCore REQUIRED) -find_package(Qt5LinguistTools REQUIRED) -find_package(Qt5Test REQUIRED) -find_package(Qt5Multimedia REQUIRED) +find_package(Qt${QT_VERSION_MAJOR}Gui REQUIRED) +find_package(Qt${QT_VERSION_MAJOR}Core REQUIRED) +find_package(Qt${QT_VERSION_MAJOR}Test REQUIRED) +find_package(Qt${QT_VERSION_MAJOR}Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Multimedia REQUIRED) +find_package(Dtk${DTK_VERSION}Core REQUIRED) +find_package(Dtk${DTK_VERSION}Widget REQUIRED) +find_package(Dtk${DTK_VERSION}Gui REQUIRED) add_definitions(${Qt5Test_DEFINITIONS}) FILE(GLOB allSource ../src/source/closewindowdialog.cpp @@ -99,10 +98,6 @@ endfunction() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_sub_directories_recursively("${CMAKE_CURRENT_SOURCE_DIR}/../src/source") -include_directories(${DtkWidget_INCLUDE_DIRS}) -include_directories(${DtkCore_INCLUDE_DIRS}) -include_directories(${DtkGui_INCLUDE_DIRS}) -include_directories( ${Qt5TestLib_LIBRARIES}) find_package(GTest REQUIRED) include_directories(${GTEST_INCLUDE_DIRS}) @@ -114,7 +109,15 @@ include_directories(src) add_executable (${PROJECT_NAME_TEST} ${allSource} ${APP_QRC_FILES} ${APP_QM_FILES} ${qrcFiles} ${allTestSource}) - - -target_link_libraries(${PROJECT_NAME_TEST} ${LINK_LIBS} ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread -ldl -fPIC) +target_link_libraries(${PROJECT_NAME_TEST} + ${LINK_LIBS} + ${GTEST_LIBRARIES} + ${GTEST_MAIN_LIBRARIES} + pthread -ldl -fPIC + Dtk${DTK_VERSION}::Core + Dtk${DTK_VERSION}::Gui + Dtk${DTK_VERSION}::Widget + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Multimedia +) diff --git a/tests/src/ut_closewindowdialog.cpp b/tests/src/ut_closewindowdialog.cpp index 6415337..059c2f3 100644 --- a/tests/src/ut_closewindowdialog.cpp +++ b/tests/src/ut_closewindowdialog.cpp @@ -17,7 +17,7 @@ class UT_CloseWindowDialog : public testing::Test void SetUp() //TEST跑之前会执行SetUp { m_dialog = new CloseWindowDialog(); - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -25,7 +25,7 @@ class UT_CloseWindowDialog : public testing::Test delete m_dialog; m_dialog = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } CloseWindowDialog *m_dialog; }; diff --git a/tests/src/ut_gameblureffectwidget.cpp b/tests/src/ut_gameblureffectwidget.cpp index c335b31..8679c24 100644 --- a/tests/src/ut_gameblureffectwidget.cpp +++ b/tests/src/ut_gameblureffectwidget.cpp @@ -17,7 +17,7 @@ class UT_GameBlurEffectWidget : public testing::Test void SetUp() //TEST跑之前会执行SetUp { m_widget = new GameBlurEffectWidget(Default); - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -26,7 +26,7 @@ class UT_GameBlurEffectWidget : public testing::Test m_widget = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } GameBlurEffectWidget *m_widget; }; diff --git a/tests/src/ut_gamebutton.cpp b/tests/src/ut_gamebutton.cpp index 307e4d0..13f5b9b 100644 --- a/tests/src/ut_gamebutton.cpp +++ b/tests/src/ut_gamebutton.cpp @@ -18,7 +18,7 @@ class UT_GameButton : public testing::Test void SetUp() //TEST跑之前会执行SetUp { m_btn = new GameButton(ButtonNormal, Default, "test"); - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -26,7 +26,7 @@ class UT_GameButton : public testing::Test delete m_btn; m_btn = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } GameButton *m_btn; }; @@ -89,7 +89,11 @@ TEST_F(UT_GameButton, UT_GameButton_updatePic) { QPixmap pic; m_btn->updatePic(pic); +#if QT_VERSION_MAJOR > 5 + EXPECT_EQ(m_btn->m_pic.cacheKey(), pic.cacheKey()) << "check the status after UT_GameButton_updatePic()"; +#else EXPECT_EQ(m_btn->m_pic, pic) << "check the status after UT_GameButton_updatePic()"; +#endif EXPECT_EQ(m_btn->m_gameBtnPressd, false) << "check the status after UT_GameButton_updatePic()"; } @@ -188,14 +192,16 @@ TEST_F(UT_GameButton, UT_GameButton_mousePressEvent) QMouseEvent rightBtnEvent(QEvent::MouseButtonPress, QPointF(m_btn->x(), m_btn->y()), Qt::RightButton, Qt::RightButton, Qt::NoModifier); m_btn->mousePressEvent(&rightBtnEvent); - QMouseEvent leftBtnEvent(QEvent::MouseButtonPress, QPointF(m_btn->x(), m_btn->y()), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QMouseEvent leftBtnEvent(QEvent::MouseButtonPress, QPointF(1000, 1000), QPointF(m_btn->x(), m_btn->y()), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); m_btn->m_btnType = TextOnPic; m_btn->mousePressEvent(&leftBtnEvent); m_btn->m_btnType = IconOnPic; m_btn->mousePressEvent(&leftBtnEvent); m_btn->m_btnType = OnlyPic; m_btn->mousePressEvent(&leftBtnEvent); +#if QT_VERSION_MAJOR <= 5 leftBtnEvent.setLocalPos(QPointF(1000, 1000)); +#endif m_btn->mousePressEvent(&leftBtnEvent); m_btn->m_btnType = IconOnPic; m_btn->mousePressEvent(&leftBtnEvent); @@ -214,7 +220,11 @@ TEST_F(UT_GameButton, UT_GameButton_mouseReleaseEvent) TEST_F(UT_GameButton, UT_GameButton_enterEvent) { +#if QT_VERSION_MAJOR > 5 + QEnterEvent enterEvent(QPointF(1, 1), QPointF(1, 1), QPointF(1, 1)); +#else QEvent enterEvent(QEvent::Enter); +#endif m_btn->m_btnType = OnlyPic; m_btn->enterEvent(&enterEvent); m_btn->m_btnType = TextOnPic; diff --git a/tests/src/ut_gamecontrol.cpp b/tests/src/ut_gamecontrol.cpp index 57863c9..8e8048c 100644 --- a/tests/src/ut_gamecontrol.cpp +++ b/tests/src/ut_gamecontrol.cpp @@ -31,11 +31,11 @@ class UT_GameControl : public testing::Test public: void SetUp() //TEST跑之前会执行SetUp { - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } }; @@ -169,11 +169,11 @@ class UT_BtnFactory : public testing::Test public: void SetUp() //TEST跑之前会执行SetUp { - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } }; diff --git a/tests/src/ut_gamelinescene.cpp b/tests/src/ut_gamelinescene.cpp index 72dbcac..6e3c274 100644 --- a/tests/src/ut_gamelinescene.cpp +++ b/tests/src/ut_gamelinescene.cpp @@ -18,7 +18,7 @@ class UT_GameLineScene : public testing::Test void SetUp() //TEST跑之前会执行SetUp { m_scene = new GameLineScene; - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -26,7 +26,7 @@ class UT_GameLineScene : public testing::Test delete m_scene; m_scene = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } GameLineScene *m_scene; }; diff --git a/tests/src/ut_gameoverblureffectwidget.cpp b/tests/src/ut_gameoverblureffectwidget.cpp index 73f854d..60cfa61 100644 --- a/tests/src/ut_gameoverblureffectwidget.cpp +++ b/tests/src/ut_gameoverblureffectwidget.cpp @@ -17,7 +17,7 @@ class UT_GameoverBlurEffectWidget : public testing::Test void SetUp() //TEST跑之前会执行SetUp { m_overWidget = new GameoverBlurEffectWidget; - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -25,7 +25,7 @@ class UT_GameoverBlurEffectWidget : public testing::Test delete m_overWidget; m_overWidget = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } GameoverBlurEffectWidget *m_overWidget; }; diff --git a/tests/src/ut_gamepage.cpp b/tests/src/ut_gamepage.cpp index 1066af8..c3cec8e 100644 --- a/tests/src/ut_gamepage.cpp +++ b/tests/src/ut_gamepage.cpp @@ -62,7 +62,7 @@ class UT_GamePage : public testing::Test m_window = new MainWindow; m_gamePage = new GamePage(m_window->m_stackedWidget); Stub stub; - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -73,7 +73,7 @@ class UT_GamePage : public testing::Test m_window = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } GamePage *m_gamePage; MainWindow *m_window; diff --git a/tests/src/ut_gameprogressbar.cpp b/tests/src/ut_gameprogressbar.cpp index 0fd4100..c2a140a 100644 --- a/tests/src/ut_gameprogressbar.cpp +++ b/tests/src/ut_gameprogressbar.cpp @@ -17,7 +17,7 @@ class UT_GameProgressBar : public testing::Test void SetUp() //TEST跑之前会执行SetUp { m_progress = new GameProgressBar; - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -25,7 +25,7 @@ class UT_GameProgressBar : public testing::Test delete m_progress; m_progress = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } GameProgressBar *m_progress; }; diff --git a/tests/src/ut_mainpage.cpp b/tests/src/ut_mainpage.cpp index 592c09b..b2e8a28 100644 --- a/tests/src/ut_mainpage.cpp +++ b/tests/src/ut_mainpage.cpp @@ -16,7 +16,7 @@ class UT_MainPage : public testing::Test public: void SetUp() //TEST跑之前会执行SetUp { - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; m_mainPage = new MainPage; } void TearDown() //TEST跑完之后会执行TearDown @@ -26,7 +26,7 @@ class UT_MainPage : public testing::Test m_mainPage = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } MainPage *m_mainPage; }; diff --git a/tests/src/ut_mainwindow.cpp b/tests/src/ut_mainwindow.cpp index 603caae..62d0e1b 100644 --- a/tests/src/ut_mainwindow.cpp +++ b/tests/src/ut_mainwindow.cpp @@ -53,7 +53,7 @@ class UT_MainWindow : public testing::Test void SetUp() //TEST跑之前会执行SetUp { m_mainwindow = new MainWindow(); - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -61,7 +61,7 @@ class UT_MainWindow : public testing::Test delete m_mainwindow; m_mainwindow = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } MainWindow *m_mainwindow; }; diff --git a/tests/src/ut_shadowlabel.cpp b/tests/src/ut_shadowlabel.cpp index da17c1f..eee849d 100644 --- a/tests/src/ut_shadowlabel.cpp +++ b/tests/src/ut_shadowlabel.cpp @@ -17,7 +17,7 @@ class UT_ShadowLabel : public testing::Test void SetUp() //TEST跑之前会执行SetUp { m_label = new ShadowLabel; - qInfo() << "SetUp" << endl; + qInfo() << "SetUp" << Qt::endl; } void TearDown() //TEST跑完之后会执行TearDown { @@ -26,7 +26,7 @@ class UT_ShadowLabel : public testing::Test m_label = nullptr; } - qInfo() << "TearDown" << endl; + qInfo() << "TearDown" << Qt::endl; } ShadowLabel *m_label; };