From f8cd0e63addfb93f28e9c34c1ce4687ce83f5dd6 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 15 Jun 2022 11:27:12 +0800 Subject: [PATCH] - change: swap position of problem case's output and expected input controls - enhancement: when problem case panel is positioned at right, problem case's input, output and expected controls is layouted vertically --- NEWS.md | 2 + RedPandaIDE/mainwindow.cpp | 37 +++++++++++++++++ RedPandaIDE/mainwindow.ui | 84 +++++++++++++++++++------------------- 3 files changed, 81 insertions(+), 42 deletions(-) diff --git a/NEWS.md b/NEWS.md index 2f523179..e0da6500 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ Red Panda C++ Version 1.1.1 - enhancement: adjust the appearance of problem case's input/output/expected control + - change: swap position of problem case's output and expected input controls + - enhancement: when problem case panel is positioned at right, problem case's input, output and expected controls is layouted vertically Red Panda C++ Version 1.1.0 - enhancement: when ctrl+mouse cursor hovered an identifier or header name, use underline to highlight it diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 2c8ff42f..e6f99df6 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -6244,7 +6244,44 @@ void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area) Qt::DockWidgetArea::BottomDockWidgetArea | Qt::DockWidgetArea::RightDockWidgetArea) & ~area); + QGridLayout* layout=(QGridLayout*)ui->panelProblemCase->layout(); + layout->removeWidget(ui->widgetProblemCaseInputCaption); + layout->removeWidget(ui->lblProblemCaseOutputCaption); + layout->removeWidget(ui->widgetProblemCaseExpectedCaption); + layout->removeWidget(ui->txtProblemCaseInput); + layout->removeWidget(ui->txtProblemCaseOutput); + layout->removeWidget(ui->txtProblemCaseExpected); + layout->removeWidget(ui->lblProblemCaseInput); + layout->removeWidget(ui->lblProblemCaseOutput); + layout->removeWidget(ui->lblProblemCaseExpected); + switch(area) { + case Qt::DockWidgetArea::BottomDockWidgetArea: + case Qt::DockWidgetArea::TopDockWidgetArea: + layout->addWidget(ui->widgetProblemCaseInputCaption, 0, 0, 1, 1); + layout->addWidget(ui->txtProblemCaseInput, 1, 0, 1, 1); + layout->addWidget(ui->lblProblemCaseInput, 2, 0, 1, 1); + layout->addWidget(ui->lblProblemCaseOutputCaption, 0, 2, 1, 1); + layout->addWidget(ui->txtProblemCaseOutput, 1, 2, 1, 1); + layout->addWidget(ui->lblProblemCaseOutput, 2, 2, 1, 1); + + layout->addWidget(ui->widgetProblemCaseExpectedCaption, 0, 1, 1, 1); + layout->addWidget(ui->txtProblemCaseExpected, 1, 1, 1, 1); + layout->addWidget(ui->lblProblemCaseExpected, 2, 1, 1, 1); + break; + default: + layout->addWidget(ui->widgetProblemCaseInputCaption, 0, 0, 1, 1); + layout->addWidget(ui->txtProblemCaseInput, 1, 0, 1, 1); + layout->addWidget(ui->lblProblemCaseInput, 2, 0, 1, 1); + + layout->addWidget(ui->widgetProblemCaseExpectedCaption, 3, 0, 1, 1); + layout->addWidget(ui->txtProblemCaseExpected, 4, 0, 1, 1); + layout->addWidget(ui->lblProblemCaseExpected, 5, 0, 1, 1); + + layout->addWidget(ui->lblProblemCaseOutputCaption, 6, 0, 1, 1); + layout->addWidget(ui->txtProblemCaseOutput, 7, 0, 1, 1); + layout->addWidget(ui->lblProblemCaseOutput, 8, 0, 1, 1); + } } void MainWindow::updateVCSActions() diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index dc26e31f..968e0bb0 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -1508,7 +1508,7 @@ Qt::Horizontal - + 3 @@ -1710,7 +1710,7 @@ - + 0 @@ -1724,18 +1724,29 @@ 0 - - + + + + + + + + + + + + + + + + QPlainTextEdit::NoWrap - - true - - + 0 @@ -1759,13 +1770,6 @@ - - - - Input - - - @@ -1791,18 +1795,18 @@ + + + + Input + + + - - - - Output - - - - + 0 @@ -1861,13 +1865,6 @@ - - - - QPlainTextEdit::NoWrap - - - @@ -1875,27 +1872,30 @@ - - - - + + + + QPlainTextEdit::NoWrap + + + true - + + + + Output + + + + - - - - - - -