- fix: reduce height of the message panel when dragging from right to bottom

This commit is contained in:
Roy Qu 2022-06-17 12:12:12 +08:00
parent 9dacc9bbb9
commit 2f0a7a3d89
4 changed files with 46 additions and 6 deletions

View File

@ -8,6 +8,7 @@ Red Panda C++ Version 1.1.1
- fix: when run/debug the executable, add current compiler set's bin folders to path - fix: when run/debug the executable, add current compiler set's bin folders to path
- fix: when open in shell, add current compiler set's bin folders to path - fix: when open in shell, add current compiler set's bin folders to path
- fix: when debug the executable using gdb server, add current compiler set's bin folders to path - fix: when debug the executable using gdb server, add current compiler set's bin folders to path
- fix: reduce height of the message panel when dragging from right to bottom
Red Panda C++ Version 1.1.0 Red Panda C++ Version 1.1.0
- enhancement: when ctrl+mouse cursor hovered an identifier or header name, use underline to highlight it - enhancement: when ctrl+mouse cursor hovered an identifier or header name, use underline to highlight it

View File

@ -6266,6 +6266,8 @@ static void setSplitterInDockLocation(QSplitter* splitter, const Qt::DockWidgetA
} }
void MainWindow::setDockExplorerToArea(const Qt::DockWidgetArea &area) void MainWindow::setDockExplorerToArea(const Qt::DockWidgetArea &area)
{ {
if (area==Qt::DockWidgetArea::NoDockWidgetArea)
return;
setDockTitlebarLocation(ui->dockExplorer,area); setDockTitlebarLocation(ui->dockExplorer,area);
setTabsInDockLocation(ui->tabExplorer,area); setTabsInDockLocation(ui->tabExplorer,area);
ui->dockMessages->setAllowedAreas( ui->dockMessages->setAllowedAreas(
@ -6277,15 +6279,32 @@ void MainWindow::setDockExplorerToArea(const Qt::DockWidgetArea &area)
void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area) void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area)
{ {
setDockTitlebarLocation(ui->dockMessages,area); Qt::DockWidgetArea effectiveArea;
setTabsInDockLocation(ui->tabMessages,area); if (area==Qt::DockWidgetArea::NoDockWidgetArea) {
setSplitterInDockLocation(ui->splitterDebug,area); switch (mMessagesDockLocation) {
setSplitterInDockLocation(ui->splitterProblem,area); case Qt::DockWidgetArea::BottomDockWidgetArea:
case Qt::DockWidgetArea::TopDockWidgetArea:
effectiveArea = Qt::DockWidgetArea::RightDockWidgetArea;
break;
default:
if (dockWidgetArea(ui->dockExplorer)!=Qt::DockWidgetArea::BottomDockWidgetArea)
effectiveArea = Qt::DockWidgetArea::BottomDockWidgetArea;
else
effectiveArea = Qt::DockWidgetArea::LeftDockWidgetArea;
}
} else {
effectiveArea = area;
mMessagesDockLocation = area;
setDockTitlebarLocation(ui->dockMessages,effectiveArea);
}
setTabsInDockLocation(ui->tabMessages,effectiveArea);
setSplitterInDockLocation(ui->splitterDebug,effectiveArea);
setSplitterInDockLocation(ui->splitterProblem,effectiveArea);
ui->dockExplorer->setAllowedAreas( ui->dockExplorer->setAllowedAreas(
(Qt::DockWidgetArea::LeftDockWidgetArea | (Qt::DockWidgetArea::LeftDockWidgetArea |
Qt::DockWidgetArea::BottomDockWidgetArea | Qt::DockWidgetArea::BottomDockWidgetArea |
Qt::DockWidgetArea::RightDockWidgetArea) Qt::DockWidgetArea::RightDockWidgetArea)
& ~area); & ~effectiveArea);
QGridLayout* layout=(QGridLayout*)ui->panelProblemCase->layout(); QGridLayout* layout=(QGridLayout*)ui->panelProblemCase->layout();
layout->removeWidget(ui->widgetProblemCaseInputCaption); layout->removeWidget(ui->widgetProblemCaseInputCaption);
layout->removeWidget(ui->widgetProblemCaseOutputCaption); layout->removeWidget(ui->widgetProblemCaseOutputCaption);
@ -6296,7 +6315,7 @@ void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area)
layout->removeWidget(ui->lblProblemCaseInput); layout->removeWidget(ui->lblProblemCaseInput);
layout->removeWidget(ui->lblProblemCaseOutput); layout->removeWidget(ui->lblProblemCaseOutput);
layout->removeWidget(ui->lblProblemCaseExpected); layout->removeWidget(ui->lblProblemCaseExpected);
switch(area) { switch(effectiveArea) {
case Qt::DockWidgetArea::BottomDockWidgetArea: case Qt::DockWidgetArea::BottomDockWidgetArea:
case Qt::DockWidgetArea::TopDockWidgetArea: case Qt::DockWidgetArea::TopDockWidgetArea:
layout->addWidget(ui->widgetProblemCaseInputCaption, 0, 0, 1, 1); layout->addWidget(ui->widgetProblemCaseInputCaption, 0, 0, 1, 1);
@ -7934,3 +7953,4 @@ void MainWindow::on_chkIgnoreSpaces_stateChanged(int /*arg1*/)
pSettings->executor().setIgnoreSpacesWhenValidatingCases(ui->chkIgnoreSpaces->isChecked()); pSettings->executor().setIgnoreSpacesWhenValidatingCases(ui->chkIgnoreSpaces->isChecked());
} }

View File

@ -713,6 +713,7 @@ private:
QElapsedTimer mParserTimer; QElapsedTimer mParserTimer;
QFileSystemWatcher mFileSystemWatcher; QFileSystemWatcher mFileSystemWatcher;
std::shared_ptr<Project> mProject; std::shared_ptr<Project> mProject;
Qt::DockWidgetArea mMessagesDockLocation;
std::shared_ptr<CodeCompletionPopup> mCompletionPopup; std::shared_ptr<CodeCompletionPopup> mCompletionPopup;
std::shared_ptr<HeaderCompletionPopup> mHeaderCompletionPopup; std::shared_ptr<HeaderCompletionPopup> mHeaderCompletionPopup;

View File

@ -1747,6 +1747,12 @@
</item> </item>
<item row="2" column="3"> <item row="2" column="3">
<widget class="LineNumberTextEditor" name="txtProblemCaseOutput"> <widget class="LineNumberTextEditor" name="txtProblemCaseOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWrapMode"> <property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum> <enum>QPlainTextEdit::NoWrap</enum>
</property> </property>
@ -1757,6 +1763,12 @@
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="LineNumberTextEditor" name="txtProblemCaseExpected"> <widget class="LineNumberTextEditor" name="txtProblemCaseExpected">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWrapMode"> <property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum> <enum>QPlainTextEdit::NoWrap</enum>
</property> </property>
@ -1884,6 +1896,12 @@
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="LineNumberTextEditor" name="txtProblemCaseInput"> <widget class="LineNumberTextEditor" name="txtProblemCaseInput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWrapMode"> <property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum> <enum>QPlainTextEdit::NoWrap</enum>
</property> </property>