remember left/bottom panel's new size, when resized
This commit is contained in:
parent
d1024e4c9d
commit
83d1ce0741
|
@ -701,8 +701,8 @@ void MainWindow::applySettings()
|
||||||
|
|
||||||
ui->menuGit->menuAction()->setVisible(pSettings->vcs().gitOk());
|
ui->menuGit->menuAction()->setVisible(pSettings->vcs().gitOk());
|
||||||
|
|
||||||
openCloseExplorerPanel(!ui->tabExplorer->isShrinked());
|
stretchExplorerPanel(!ui->tabExplorer->isShrinked());
|
||||||
openCloseMessagesPanel(!ui->tabMessages->isShrinked());
|
stretchMessagesPanel(!ui->tabMessages->isShrinked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::applyUISettings()
|
void MainWindow::applyUISettings()
|
||||||
|
@ -1157,7 +1157,7 @@ void MainWindow::openProject(const QString &filename, bool openFiles)
|
||||||
}
|
}
|
||||||
ui->tabProject->setVisible(true);
|
ui->tabProject->setVisible(true);
|
||||||
ui->tabExplorer->setCurrentWidget(ui->tabProject);
|
ui->tabExplorer->setCurrentWidget(ui->tabProject);
|
||||||
openCloseExplorerPanel(true);
|
stretchExplorerPanel(true);
|
||||||
// {
|
// {
|
||||||
// LeftPageControl.ActivePage := LeftProjectSheet;
|
// LeftPageControl.ActivePage := LeftProjectSheet;
|
||||||
// fLeftPageControlChanged := False;
|
// fLeftPageControlChanged := False;
|
||||||
|
@ -1517,7 +1517,7 @@ bool MainWindow::compile(bool rebuild)
|
||||||
if (mCompileSuccessionTask) {
|
if (mCompileSuccessionTask) {
|
||||||
mCompileSuccessionTask->filename = mProject->executable();
|
mCompileSuccessionTask->filename = mProject->executable();
|
||||||
}
|
}
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
ui->tabMessages->setCurrentWidget(ui->tabToolsOutput);
|
ui->tabMessages->setCurrentWidget(ui->tabToolsOutput);
|
||||||
mCompilerManager->compileProject(mProject,rebuild);
|
mCompilerManager->compileProject(mProject,rebuild);
|
||||||
updateCompileActions();
|
updateCompileActions();
|
||||||
|
@ -1533,7 +1533,7 @@ bool MainWindow::compile(bool rebuild)
|
||||||
if (mCompileSuccessionTask) {
|
if (mCompileSuccessionTask) {
|
||||||
mCompileSuccessionTask->filename = getCompiledExecutableName(editor->filename());
|
mCompileSuccessionTask->filename = getCompiledExecutableName(editor->filename());
|
||||||
}
|
}
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
ui->tabMessages->setCurrentWidget(ui->tabToolsOutput);
|
ui->tabMessages->setCurrentWidget(ui->tabToolsOutput);
|
||||||
mCompilerManager->compile(editor->filename(),editor->fileEncoding(),rebuild);
|
mCompilerManager->compile(editor->filename(),editor->fileEncoding(),rebuild);
|
||||||
updateCompileActions();
|
updateCompileActions();
|
||||||
|
@ -1593,7 +1593,7 @@ void MainWindow::runExecutable(const QString &exeName,const QString &filename,Ru
|
||||||
if (problem) {
|
if (problem) {
|
||||||
mCompilerManager->runProblem(exeName,params,QFileInfo(exeName).absolutePath(),
|
mCompilerManager->runProblem(exeName,params,QFileInfo(exeName).absolutePath(),
|
||||||
problem->cases);
|
problem->cases);
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
||||||
}
|
}
|
||||||
} else if (runType == RunType::CurrentProblemCase) {
|
} else if (runType == RunType::CurrentProblemCase) {
|
||||||
|
@ -1602,7 +1602,7 @@ void MainWindow::runExecutable(const QString &exeName,const QString &filename,Ru
|
||||||
POJProblemCase problemCase =mOJProblemModel.getCase(index.row());
|
POJProblemCase problemCase =mOJProblemModel.getCase(index.row());
|
||||||
mCompilerManager->runProblem(exeName,params,QFileInfo(exeName).absolutePath(),
|
mCompilerManager->runProblem(exeName,params,QFileInfo(exeName).absolutePath(),
|
||||||
problemCase);
|
problemCase);
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1867,7 +1867,7 @@ void MainWindow::debug()
|
||||||
|
|
||||||
void MainWindow::showSearchPanel(bool showReplace)
|
void MainWindow::showSearchPanel(bool showReplace)
|
||||||
{
|
{
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
showSearchReplacePanel(showReplace);
|
showSearchReplacePanel(showReplace);
|
||||||
ui->tabMessages->setCurrentWidget(ui->tabSearch);
|
ui->tabMessages->setCurrentWidget(ui->tabSearch);
|
||||||
}
|
}
|
||||||
|
@ -1890,7 +1890,7 @@ static void setDockMovable(QDockWidget* dock, bool movable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openCloseMessagesPanel(bool open)
|
void MainWindow::stretchMessagesPanel(bool open)
|
||||||
{
|
{
|
||||||
//ui->dockMessages->setVisible(open);
|
//ui->dockMessages->setVisible(open);
|
||||||
ui->tabMessages->setShrinked(!open);
|
ui->tabMessages->setShrinked(!open);
|
||||||
|
@ -1903,7 +1903,7 @@ void MainWindow::openCloseMessagesPanel(bool open)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::openCloseExplorerPanel(bool open)
|
void MainWindow::stretchExplorerPanel(bool open)
|
||||||
{
|
{
|
||||||
ui->tabExplorer->setShrinked(!open);
|
ui->tabExplorer->setShrinked(!open);
|
||||||
if (open) {
|
if (open) {
|
||||||
|
@ -1932,8 +1932,8 @@ void MainWindow::prepareDebugger()
|
||||||
ui->tabExplorer->setCurrentWidget(ui->tabWatch);
|
ui->tabExplorer->setCurrentWidget(ui->tabWatch);
|
||||||
ui->tabMessages->setCurrentWidget(ui->tabDebug);
|
ui->tabMessages->setCurrentWidget(ui->tabDebug);
|
||||||
ui->debugViews->setCurrentWidget(ui->tabLocals);
|
ui->debugViews->setCurrentWidget(ui->tabLocals);
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
openCloseExplorerPanel(true);
|
stretchExplorerPanel(true);
|
||||||
|
|
||||||
// Reset watch vars
|
// Reset watch vars
|
||||||
// mDebugger->deleteWatchVars(false);
|
// mDebugger->deleteWatchVars(false);
|
||||||
|
@ -2690,11 +2690,11 @@ void MainWindow::buildEncodingMenu()
|
||||||
void MainWindow::maximizeEditor()
|
void MainWindow::maximizeEditor()
|
||||||
{
|
{
|
||||||
if (ui->tabExplorer->isShrinked() && ui->tabExplorer->isShrinked()) {
|
if (ui->tabExplorer->isShrinked() && ui->tabExplorer->isShrinked()) {
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
openCloseExplorerPanel(true);
|
stretchExplorerPanel(true);
|
||||||
} else {
|
} else {
|
||||||
openCloseMessagesPanel(false);
|
stretchMessagesPanel(false);
|
||||||
openCloseExplorerPanel(false);
|
stretchExplorerPanel(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3181,7 +3181,7 @@ void MainWindow::onProblemSetIndexChanged(const QModelIndex ¤t, const QMod
|
||||||
} else {
|
} else {
|
||||||
onProblemCaseIndexChanged(QModelIndex(),QModelIndex());
|
onProblemCaseIndexChanged(QModelIndex(),QModelIndex());
|
||||||
}
|
}
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
||||||
ui->tabProblem->setEnabled(true);
|
ui->tabProblem->setEnabled(true);
|
||||||
ui->btnOpenProblemAnswer->setEnabled(!problem->answerProgram.isEmpty());
|
ui->btnOpenProblemAnswer->setEnabled(!problem->answerProgram.isEmpty());
|
||||||
|
@ -4138,7 +4138,7 @@ void MainWindow::updateProjectView()
|
||||||
} else
|
} else
|
||||||
mProjectProxyModel->invalidate();
|
mProjectProxyModel->invalidate();
|
||||||
ui->projectView->expandAll();
|
ui->projectView->expandAll();
|
||||||
openCloseExplorerPanel(true);
|
stretchExplorerPanel(true);
|
||||||
ui->tabProject->setVisible(true);
|
ui->tabProject->setVisible(true);
|
||||||
ui->tabExplorer->setCurrentWidget(ui->tabProject);
|
ui->tabExplorer->setCurrentWidget(ui->tabProject);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4567,12 +4567,12 @@ void MainWindow::onCompileFinished(bool isCheckSyntax)
|
||||||
} else if (ui->tableIssues->count() == 0) {
|
} else if (ui->tableIssues->count() == 0) {
|
||||||
// Close it if there's nothing to show
|
// Close it if there's nothing to show
|
||||||
if (ui->tabMessages->currentIndex() == i)
|
if (ui->tabMessages->currentIndex() == i)
|
||||||
openCloseMessagesPanel(false);
|
stretchMessagesPanel(false);
|
||||||
} else {
|
} else {
|
||||||
if (ui->tabMessages->currentIndex() != i) {
|
if (ui->tabMessages->currentIndex() != i) {
|
||||||
ui->tabMessages->setCurrentIndex(i);
|
ui->tabMessages->setCurrentIndex(i);
|
||||||
}
|
}
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor * e = mEditorList->getEditor();
|
Editor * e = mEditorList->getEditor();
|
||||||
|
@ -4915,9 +4915,9 @@ void MainWindow::on_actionConvert_to_UTF_8_triggered()
|
||||||
void MainWindow::on_tabMessages_tabBarClicked(int index)
|
void MainWindow::on_tabMessages_tabBarClicked(int index)
|
||||||
{
|
{
|
||||||
if (index == ui->tabMessages->currentIndex() && !ui->tabMessages->isShrinked()) {
|
if (index == ui->tabMessages->currentIndex() && !ui->tabMessages->isShrinked()) {
|
||||||
openCloseMessagesPanel(false);
|
stretchMessagesPanel(false);
|
||||||
} else {
|
} else {
|
||||||
openCloseMessagesPanel(true);
|
stretchMessagesPanel(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5340,9 +5340,9 @@ void MainWindow::on_actionForward_triggered()
|
||||||
void MainWindow::on_tabExplorer_tabBarClicked(int index)
|
void MainWindow::on_tabExplorer_tabBarClicked(int index)
|
||||||
{
|
{
|
||||||
if (index == ui->tabExplorer->currentIndex() && !ui->tabExplorer->isShrinked()) {
|
if (index == ui->tabExplorer->currentIndex() && !ui->tabExplorer->isShrinked()) {
|
||||||
openCloseExplorerPanel(false);
|
stretchExplorerPanel(false);
|
||||||
} else {
|
} else {
|
||||||
openCloseExplorerPanel(true);
|
stretchExplorerPanel(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6468,7 +6468,7 @@ void MainWindow::on_btnReplace_clicked()
|
||||||
editor->setSelText(contents.join(editor->lineBreak()));
|
editor->setSelText(contents.join(editor->lineBreak()));
|
||||||
}
|
}
|
||||||
showSearchReplacePanel(false);
|
showSearchReplacePanel(false);
|
||||||
openCloseMessagesPanel(false);
|
stretchMessagesPanel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_btnCancelReplace_clicked()
|
void MainWindow::on_btnCancelReplace_clicked()
|
||||||
|
@ -6665,7 +6665,7 @@ void MainWindow::on_actionLocate_in_Files_View_triggered()
|
||||||
ui->treeFiles->setCurrentIndex(index);
|
ui->treeFiles->setCurrentIndex(index);
|
||||||
ui->treeFiles->scrollTo(index, QAbstractItemView::PositionAtCenter);
|
ui->treeFiles->scrollTo(index, QAbstractItemView::PositionAtCenter);
|
||||||
ui->tabExplorer->setCurrentWidget(ui->tabFiles);
|
ui->tabExplorer->setCurrentWidget(ui->tabFiles);
|
||||||
openCloseExplorerPanel(true);
|
stretchExplorerPanel(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,8 +232,8 @@ private:
|
||||||
void updateProjectView();
|
void updateProjectView();
|
||||||
CompileTarget getCompileTarget();
|
CompileTarget getCompileTarget();
|
||||||
bool debugInferiorhasBreakpoint();
|
bool debugInferiorhasBreakpoint();
|
||||||
void openCloseMessagesPanel(bool open);
|
void stretchMessagesPanel(bool open);
|
||||||
void openCloseExplorerPanel(bool open);
|
void stretchExplorerPanel(bool open);
|
||||||
void prepareDebugger();
|
void prepareDebugger();
|
||||||
void doAutoSave(Editor *e);
|
void doAutoSave(Editor *e);
|
||||||
void buildContextMenus();
|
void buildContextMenus();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "shrinkabletabwidget.h"
|
#include "shrinkabletabwidget.h"
|
||||||
#include <QTabBar>
|
#include <QTabBar>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
|
||||||
QHash<const ShrinkableTabWidget*,QSize> ShrinkableTabWidget::BeforeShrinkSizes;
|
QHash<const ShrinkableTabWidget*,QSize> ShrinkableTabWidget::BeforeShrinkSizes;
|
||||||
|
|
||||||
|
@ -132,3 +133,10 @@ QSize ShrinkableTabWidget::minimumSizeHint() const
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShrinkableTabWidget::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
QTabWidget::resizeEvent(event);
|
||||||
|
if (!isShrinked())
|
||||||
|
setBeforeShrinkSize(event->size());
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,10 @@ public:
|
||||||
private:
|
private:
|
||||||
bool mShrinked;
|
bool mShrinked;
|
||||||
static QHash<const ShrinkableTabWidget*,QSize> BeforeShrinkSizes;
|
static QHash<const ShrinkableTabWidget*,QSize> BeforeShrinkSizes;
|
||||||
|
|
||||||
|
// QWidget interface
|
||||||
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHRINKABLETABWIDGET_H
|
#endif // SHRINKABLETABWIDGET_H
|
||||||
|
|
Loading…
Reference in New Issue