mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Fixed some issues with restoreState function
This commit is contained in:
parent
e878bb47ed
commit
805e97946e
@ -2,7 +2,7 @@
|
||||
<project>
|
||||
<configuration id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" name="Default">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW" console="false" env-hash="-550644722333667955" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings MinGW" parameter="${COMMAND} ${FLAGS} -E -P -v -dD -std=c++14 "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW" console="false" env-hash="-1519829723851667984" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings MinGW" parameter="${COMMAND} ${FLAGS} -E -P -v -dD -std=c++14 "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QTime>
|
||||
#include <QLabel>
|
||||
@ -14,6 +15,7 @@
|
||||
#include <QSettings>
|
||||
#include <QDockWidget>
|
||||
#include <QDebug>
|
||||
#include <QResizeEvent>
|
||||
|
||||
#include "DockManager.h"
|
||||
#include "DockWidget.h"
|
||||
@ -90,6 +92,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->toolBar->addAction(ui->actionRestoreState);
|
||||
ui->actionRestoreState->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton));
|
||||
|
||||
m_SavePerspectiveAction = new QAction("Save Perspective", this);
|
||||
m_PerspectiveListAction = new QWidgetAction(this);
|
||||
m_PerspectiveComboBox = new QComboBox(this);
|
||||
m_PerspectiveListAction->setDefaultWidget(m_PerspectiveComboBox);
|
||||
ui->toolBar->addSeparator();
|
||||
ui->toolBar->addAction(m_PerspectiveListAction);
|
||||
ui->toolBar->addAction(m_SavePerspectiveAction);
|
||||
|
||||
m_DockManager = new ads::CDockManager(this);
|
||||
createContent();
|
||||
// Default window geometry
|
||||
|
@ -1,6 +1,10 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QAction>
|
||||
#include <QWidgetAction>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "DockManager.h"
|
||||
|
||||
@ -8,11 +12,20 @@ namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple main window for demo
|
||||
*/
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QAction* m_SavePerspectiveAction;
|
||||
QWidgetAction* m_PerspectiveListAction;
|
||||
QComboBox* m_PerspectiveComboBox;
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event) override;
|
||||
;
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
virtual ~MainWindow();
|
||||
|
@ -1002,7 +1002,6 @@ bool CDockContainerWidget::restoreState(QXmlStreamReader& s, bool Testing)
|
||||
{
|
||||
CFloatingDockContainer* FloatingWidget = internal::findParent<CFloatingDockContainer*>(this);
|
||||
FloatingWidget->restoreGeometry(Geometry);
|
||||
FloatingWidget->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,9 +346,9 @@ bool CDockManager::restoreState(const QByteArray &state, int version)
|
||||
{
|
||||
DockWidget->flagAsUnassigned();
|
||||
}
|
||||
else if (!DockWidget->property("closed").toBool())
|
||||
else
|
||||
{
|
||||
DockWidget->toggleView(true);
|
||||
DockWidget->toggleView(!DockWidget->property("closed").toBool());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,15 +300,16 @@ void CFloatingDockContainer::moveEvent(QMoveEvent *event)
|
||||
//============================================================================
|
||||
void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
std::cout << "closeEvent" << std::endl;
|
||||
d->setDraggingActive(false);
|
||||
QWidget::closeEvent(event);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
||||
{
|
||||
std::cout << "hideEvent" << std::endl;
|
||||
QWidget::hideEvent(event);
|
||||
auto OpenDockAreas = d->DockContainer->openedDockAreas();
|
||||
for (auto DockArea : OpenDockAreas)
|
||||
@ -316,7 +317,7 @@ void CFloatingDockContainer::hideEvent(QHideEvent *event)
|
||||
auto OpenDockWidgets = DockArea->openedDockWidgets();
|
||||
for (auto DockWidget : OpenDockWidgets)
|
||||
{
|
||||
DockWidget->setToggleViewActionChecked(false);
|
||||
DockWidget->toggleView(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user