Moved stylesheet from demo into main library

This commit is contained in:
Uwe Kindler
2017-03-28 13:05:18 +02:00
parent 9af86c4136
commit 17dff82d12
8 changed files with 32 additions and 195 deletions

View File

@@ -35,6 +35,8 @@
#include <QMap>
#include <QVariant>
#include <QDebug>
#include <QFile>
#include <QApplication>
#include "FloatingDockContainer.h"
#include "DockOverlay.h"
@@ -78,6 +80,11 @@ struct DockManagerPrivate
* Restores the container with the given index
*/
bool restoreContainer(int Index, QDataStream& stream, bool Testing);
/**
* Loads the stylesheet
*/
void loadStylesheet();
};
// struct DockManagerPrivate
@@ -89,6 +96,19 @@ DockManagerPrivate::DockManagerPrivate(CDockManager* _public) :
}
//============================================================================
void DockManagerPrivate::loadStylesheet()
{
QString Result;
QFile StyleSheetFile(":ads/stylesheets/default.css");
StyleSheetFile.open(QIODevice::ReadOnly);
QTextStream StyleSheetStream(&StyleSheetFile);
Result = StyleSheetStream.readAll();
StyleSheetFile.close();
_this->setStyleSheet(Result);
}
//============================================================================
bool DockManagerPrivate::checkFormat(const QByteArray &state, int version)
{
@@ -202,6 +222,7 @@ CDockManager::CDockManager(QWidget *parent) :
d->DockAreaOverlay = new CDockOverlay(this, CDockOverlay::ModeDockAreaOverlay);
d->ContainerOverlay = new CDockOverlay(this, CDockOverlay::ModeContainerOverlay);
d->Containers.append(this);
d->loadStylesheet();
}
//============================================================================
@@ -314,11 +335,17 @@ bool CDockManager::restoreState(const QByteArray &state, int version)
DockWidget->setProperty("dirty", true);
}
//this->hide();
QMainWindow* MainWindow = internal::findParent<QMainWindow*>(this);
MainWindow->hide();
QApplication::processEvents();
if (!d->restoreState(state, version))
{
qDebug() << "restoreState: Error restoring state!!!!!!!";
return false;
}
MainWindow->show();
// this->show();
// All dock widgets, that have not been processed in the restore state
// function are invisible to the user now and have no assigned dock area