From 5c2c2bead28c74c4a1f489ca0f8deaac5dd05131 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 17 Jun 2022 18:18:12 +0800 Subject: [PATCH] - fix: when messages panel is docked at right, its width not correctly restored when restart. --- NEWS.md | 1 + RedPandaIDE/compiler/compilerinfo.h | 2 -- RedPandaIDE/mainwindow.cpp | 18 +++++++++--------- RedPandaIDE/mainwindow.ui | 14 +++++++------- RedPandaIDE/settings.cpp | 2 +- RedPandaIDE/widgets/shrinkabletabwidget.cpp | 2 ++ 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/NEWS.md b/NEWS.md index 381d9d26..2a33904c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,7 @@ Red Panda C++ Version 1.1.1 - 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: reduce height of the message panel when dragging from right to bottom + - fix: when messages panel is docked at right, its width not correctly restored when restart. 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/compiler/compilerinfo.h b/RedPandaIDE/compiler/compilerinfo.h index c6fd2d81..de4cc80e 100644 --- a/RedPandaIDE/compiler/compilerinfo.h +++ b/RedPandaIDE/compiler/compilerinfo.h @@ -108,8 +108,6 @@ private: QMap mInfos; }; -extern PCompilerInfoManager pCompilerInfoManager; - class ClangCompilerInfo: public CompilerInfo{ public: ClangCompilerInfo(); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index a996c169..41625b51 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -6266,19 +6266,24 @@ static void setSplitterInDockLocation(QSplitter* splitter, const Qt::DockWidgetA } void MainWindow::setDockExplorerToArea(const Qt::DockWidgetArea &area) { - if (area==Qt::DockWidgetArea::NoDockWidgetArea) - return; - setDockTitlebarLocation(ui->dockExplorer,area); - setTabsInDockLocation(ui->tabExplorer,area); ui->dockMessages->setAllowedAreas( (Qt::DockWidgetArea::LeftDockWidgetArea | Qt::DockWidgetArea::BottomDockWidgetArea | Qt::DockWidgetArea::RightDockWidgetArea) & ~area); + if (area==Qt::DockWidgetArea::NoDockWidgetArea) + return; + setDockTitlebarLocation(ui->dockExplorer,area); + setTabsInDockLocation(ui->tabExplorer,area); } void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area) { + ui->dockExplorer->setAllowedAreas( + (Qt::DockWidgetArea::LeftDockWidgetArea | + Qt::DockWidgetArea::BottomDockWidgetArea | + Qt::DockWidgetArea::RightDockWidgetArea) + & ~area); Qt::DockWidgetArea effectiveArea; if (area==Qt::DockWidgetArea::NoDockWidgetArea) { switch (mMessagesDockLocation) { @@ -6300,11 +6305,6 @@ void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area) setTabsInDockLocation(ui->tabMessages,effectiveArea); setSplitterInDockLocation(ui->splitterDebug,effectiveArea); setSplitterInDockLocation(ui->splitterProblem,effectiveArea); - ui->dockExplorer->setAllowedAreas( - (Qt::DockWidgetArea::LeftDockWidgetArea | - Qt::DockWidgetArea::BottomDockWidgetArea | - Qt::DockWidgetArea::RightDockWidgetArea) - & ~effectiveArea); QGridLayout* layout=(QGridLayout*)ui->panelProblemCase->layout(); layout->removeWidget(ui->widgetProblemCaseInputCaption); layout->removeWidget(ui->widgetProblemCaseOutputCaption); diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index cd64aff0..0fabf49d 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -463,7 +463,7 @@ QTabWidget::West - 4 + 1 true @@ -858,7 +858,7 @@ QTabWidget::South - 6 + 2 @@ -1003,16 +1003,16 @@ - 11 + 7 - 11 + 7 - 11 + 7 - 11 + 7 @@ -1054,7 +1054,7 @@ QTabWidget::North - 0 + 3 diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index a946c186..f1ad48a1 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -2682,7 +2682,7 @@ void Settings::CompilerSets::saveSet(int index) savePath("profiler", pSet->profiler()); mSettings->mSettings.remove("Options"); - foreach(const PCompilerOption& option, pCompilerInfoManager->getCompilerOptions(pSet->compilerType())) { + foreach(const PCompilerOption& option, CompilerInfoManager::getInstance()->getCompilerOptions(pSet->compilerType())) { mSettings->mSettings.remove(option->key); } // Save option string diff --git a/RedPandaIDE/widgets/shrinkabletabwidget.cpp b/RedPandaIDE/widgets/shrinkabletabwidget.cpp index 62f55630..02cd253e 100644 --- a/RedPandaIDE/widgets/shrinkabletabwidget.cpp +++ b/RedPandaIDE/widgets/shrinkabletabwidget.cpp @@ -137,6 +137,8 @@ QSize ShrinkableTabWidget::minimumSizeHint() const void ShrinkableTabWidget::resizeEvent(QResizeEvent *event) { QTabWidget::resizeEvent(event); + if (!isVisible()) + return; if (!isShrinked()) setBeforeShrinkSize(event->size()); }