mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Moved stylesheet from demo into main library
This commit is contained in:
parent
9af86c4136
commit
17dff82d12
@ -5,17 +5,6 @@
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
static void initStyleSheet(QApplication& a)
|
||||
{
|
||||
QFile f(":ads/stylesheets/default-windows2.css");
|
||||
if (f.open(QFile::ReadOnly))
|
||||
{
|
||||
const QByteArray ba = f.readAll();
|
||||
f.close();
|
||||
a.setStyleSheet(QString(ba));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
@ -46,7 +35,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
a.setQuitOnLastWindowClosed(true);
|
||||
initStyleSheet(a);
|
||||
qInstallMessageHandler(myMessageOutput);
|
||||
qDebug() << "Message handler test";
|
||||
|
||||
|
@ -111,7 +111,7 @@ void MainWindow::createContent()
|
||||
m_DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
|
||||
m_DockManager->addDockWidget(ads::LeftDockWidgetArea, createLongTextLabelDockWidget(ViewMenu));
|
||||
m_DockManager->addDockWidget(ads::BottomDockWidgetArea, createFileSystemTreeDockWidget(ViewMenu));
|
||||
/*auto TopDockArea = m_DockManager->addDockWidget(ads::TopDockWidgetArea, createFileSystemTreeDockWidget(ViewMenu));
|
||||
auto TopDockArea = m_DockManager->addDockWidget(ads::TopDockWidgetArea, createFileSystemTreeDockWidget(ViewMenu));
|
||||
DockWidget = createCalendarDockWidget(ViewMenu);
|
||||
DockWidget->setFeatures(DockWidget->features().setFlag(ads::CDockWidget::DockWidgetClosable, false));
|
||||
m_DockManager->addDockWidget(ads::CenterDockWidgetArea, DockWidget, TopDockArea);
|
||||
@ -121,15 +121,15 @@ void MainWindow::createContent()
|
||||
m_DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
|
||||
auto BottomDockArea = m_DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
|
||||
m_DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
|
||||
m_DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);*/
|
||||
m_DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
/*QSettings Settings("Settings.ini", QSettings::IniFormat);
|
||||
QSettings Settings("Settings.ini", QSettings::IniFormat);
|
||||
Settings.setValue("mainWindow/Geometry", saveGeometry());
|
||||
Settings.setValue("mainWindow/DockingState", m_DockManager->saveState());*/
|
||||
Settings.setValue("mainWindow/DockingState", m_DockManager->saveState());
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,8 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/ads">
|
||||
<file>stylesheets/default-windows.css</file>
|
||||
<file>stylesheets/vendor-partsolutions.css</file>
|
||||
<file>stylesheets/modern-windows.css</file>
|
||||
<file>stylesheets/default-windows2.css</file>
|
||||
<file>stylesheets/default.css</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Default style sheet on Windows Platforms
|
||||
* Note: Always use CSS-classes with and without "ads--" namespace to support Qt4 & Qt5
|
||||
*/
|
||||
|
||||
ads--ContainerWidget,
|
||||
ContainerWidget
|
||||
{
|
||||
background: palette(dark);
|
||||
}
|
||||
|
||||
ads--ContainerWidget QSplitter::handle,
|
||||
ContainerWidget QSplitter::handle
|
||||
{
|
||||
background: palette(dark);
|
||||
}
|
||||
|
||||
ads--SectionWidget,
|
||||
SectionWidget
|
||||
{
|
||||
background: palette(window);
|
||||
border: 1px solid palette(light);
|
||||
}
|
||||
|
||||
ads--SectionWidget #tabsMenuButton::menu-indicator,
|
||||
SectionWidget #tabsMenuButton::menu-indicator
|
||||
{
|
||||
image: none;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget,
|
||||
SectionTitleWidget
|
||||
{
|
||||
background: palette(window);
|
||||
border-color: palette(light);
|
||||
border-style: solid;
|
||||
border-width: 0 1px 0 0;
|
||||
padding: 0 9px;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget[activeTab="true"],
|
||||
SectionTitleWidget[activeTab="true"]
|
||||
{
|
||||
/* background: palette(light);*/
|
||||
/* background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(240, 240, 240, 255));*/
|
||||
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:0.5, stop:0 palette(window), stop:1 palette(light));
|
||||
}
|
||||
|
||||
ads--SectionContentWidget,
|
||||
SectionContentWidget
|
||||
{
|
||||
background: palette(light);
|
||||
border-color: palette(light);
|
||||
border-style: solid;
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
|
||||
/* Special: QLabels inside SectionTitleWidget
|
||||
*/
|
||||
ads--SectionTitleWidget QLabel,
|
||||
SectionTitleWidget QLabel
|
||||
{
|
||||
color: palette(dark);
|
||||
}
|
||||
ads--SectionTitleWidget[activeTab="true"] QLabel,
|
||||
SectionTitleWidget[activeTab="true"] QLabel
|
||||
{
|
||||
color: palette(foreground);
|
||||
}
|
||||
|
||||
/* Special: QLabels inside SectionTitleWidget, which is floating
|
||||
*/
|
||||
ads--FloatingWidget ads--SectionTitleWidget QLabel,
|
||||
FloatingWidget SectionTitleWidget QLabel
|
||||
{
|
||||
color: palette(foreground);
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
QSplitter::handle {
|
||||
background: palette(light);
|
||||
}
|
||||
|
||||
ads--ContainerWidget, ContainerWidget {
|
||||
background: palette(light);
|
||||
}
|
||||
|
||||
ads--SectionWidget, SectionWidget {
|
||||
background: palette(light);
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget, SectionTitleWidget {
|
||||
background: #ffffff;
|
||||
}
|
||||
ads--SectionTitleWidget QLabel, SectionTitleWidget QLabel {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget[activeTab="true"], SectionTitleWidget[activeTab="true"] {
|
||||
background: #000000;
|
||||
border-right: 1px solid #000000;
|
||||
padding: 9px;
|
||||
}
|
||||
ads--SectionTitleWidget[activeTab="true"] QLabel, SectionTitleWidget[activeTab="true"] QLabel {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
ads--SectionContentWidget, SectionContentWidget {
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
|
||||
QAbstractItemView {
|
||||
border: 0;
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Style sheet used by CADENAS PARTsolutions product line
|
||||
* Requires Qt4 compatibility
|
||||
*/
|
||||
|
||||
QSplitter::handle:vertical {
|
||||
image: url(:/img/splitter-horizontal.png);
|
||||
}
|
||||
|
||||
QSplitter::handle:horizontal {
|
||||
image: url(:/img/splitter-vertical.png);
|
||||
}
|
||||
|
||||
ads--ContainerWidget, ContainerWidget {
|
||||
background: #9ab6ca;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
ads--SectionWidget, SectionWidget {
|
||||
background: #7c9eb3;
|
||||
border-color: #ffffff;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget, SectionTitleWidget {
|
||||
background: #7c9eb3;
|
||||
border-right: 1px solid #E7F3F8;
|
||||
padding: 6px 6px;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget[activeTab="true"], SectionTitleWidget[activeTab="true"] {
|
||||
background: #E7F3F8;
|
||||
border: 1px solid #E7F3F8;
|
||||
}
|
||||
|
||||
ads--SectionWidget QPushButton#closeButton, SectionWidget QPushButton#closeButton,
|
||||
ads--FloatingWidget QPushButton#closeButton, FloatingWidget QPushButton#closeButton {
|
||||
background: #ff0000;
|
||||
border: 1px solid red;
|
||||
}
|
||||
|
||||
ads--SectionContentWidget, SectionContentWidget {
|
||||
background: #ffffff;
|
||||
border: 0px solid #E7F3F8;
|
||||
}
|
||||
|
||||
/* Special */
|
||||
|
||||
IconTitleWidget {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget QLabel, SectionTitleWidget QLabel {
|
||||
color: #ffffff;
|
||||
background: #7c9eb3;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget[activeTab="true"] QLabel, SectionTitleWidget[activeTab="true"] QLabel {
|
||||
color: #000000;
|
||||
background: #E7F3F8;
|
||||
}
|
Loading…
Reference in New Issue
Block a user