mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 07:21:32 +08:00
Move style sheets into resource *.css files.
Even keep vendor style sheets there.
This commit is contained in:
parent
3ec2d9d8f6
commit
91e0f62f3e
@ -12,5 +12,7 @@
|
||||
<file>img/split-top.png</file>
|
||||
<file>img/splitter-horizontal.png</file>
|
||||
<file>img/splitter-vertical.png</file>
|
||||
<file>stylesheets/default-windows.css</file>
|
||||
<file>stylesheets/vendor-partsolutions.css</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
28
AdvancedDockingSystem/res/stylesheets/default-windows.css
Normal file
28
AdvancedDockingSystem/res/stylesheets/default-windows.css
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Default style sheet on Windows Platforms
|
||||
* Note: Always use CSS-classes with and without "ads--" namespace to support Qt4 & Qt5
|
||||
*/
|
||||
|
||||
QSplitter::handle {
|
||||
background: palette(dark);
|
||||
}
|
||||
|
||||
ads--ContainerWidget, ContainerWidget {
|
||||
background: palette(dark);
|
||||
}
|
||||
|
||||
ads--SectionWidget, SectionWidget {
|
||||
background: palette(window);
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget, SectionTitleWidget {
|
||||
background: palette(window);
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget[activeTab="true"], SectionTitleWidget[activeTab="true"] {
|
||||
background: palette(light);
|
||||
}
|
||||
|
||||
ads--SectionContentWidget, SectionContentWidget {
|
||||
border: 1px solid palette(light);
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget, SectionTitleWidget {
|
||||
background: #7c9eb3;
|
||||
border-right: 1px solid #E7F3F8;
|
||||
}
|
||||
|
||||
ads--SectionTitleWidget[activeTab="true"], SectionTitleWidget[activeTab="true"] {
|
||||
background: #E7F3F8;
|
||||
border: 1px solid #E7F3F8;
|
||||
}
|
||||
|
||||
ads--SectionContentWidget, SectionContentWidget {
|
||||
background: #ffffff;
|
||||
border: 0px solid #E7F3F8;
|
||||
}
|
||||
|
||||
/* Special */
|
||||
/*
|
||||
ads--SectionTitleWidget IconTitleWidget QLabel { color: #000000; }
|
||||
ads--FloatingWidget QPushButton { background: #E7F3F8; }
|
||||
*/
|
@ -16,9 +16,9 @@ IconTitleWidget::IconTitleWidget(const QIcon& icon, const QString& title, QWidge
|
||||
// Icon label
|
||||
if (icon.isNull())
|
||||
{
|
||||
// QLabel* titleIcon = new QLabel();
|
||||
// titleIcon->setPixmap(style()->standardIcon(QStyle::SP_MessageBoxInformation).pixmap(16, 16));
|
||||
// l->addWidget(titleIcon);
|
||||
QLabel* titleIcon = new QLabel();
|
||||
titleIcon->setPixmap(style()->standardIcon(QStyle::SP_MessageBoxInformation).pixmap(16, 16));
|
||||
l->addWidget(titleIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -33,4 +33,4 @@ IconTitleWidget::IconTitleWidget(const QIcon& icon, const QString& title, QWidge
|
||||
titleFont.setBold(true);
|
||||
titleText->setFont(titleFont);
|
||||
l->addWidget(titleText, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +1,9 @@
|
||||
#include <QString>
|
||||
#include <QRect>
|
||||
#include <QFile>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
static void centerWidget(QWidget* widget)
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
QDesktopWidget deskWidget;
|
||||
const int screenIndex = deskWidget.primaryScreen();
|
||||
const QRect deskRect = deskWidget.availableGeometry(screenIndex);
|
||||
const int x = (deskRect.width() - widget->rect().width()) / 2;
|
||||
const int y = (deskRect.height() - widget->rect().height()) / 2;
|
||||
widget->move(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void resizeWidgetPerCent(QWidget* widget, qreal widthPC, qreal heightPC)
|
||||
{
|
||||
if (widget && widthPC >= 0.0 && heightPC >= 0.0)
|
||||
{
|
||||
QDesktopWidget deskWidget;
|
||||
const int screenIndex = deskWidget.primaryScreen();
|
||||
const QRect deskRect = deskWidget.availableGeometry(screenIndex);
|
||||
const int w = (deskRect.width() / 100) * widthPC;
|
||||
const int h = (deskRect.height() / 100) * heightPC;
|
||||
widget->resize(w, h);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
@ -38,18 +11,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
Q_INIT_RESOURCE(ads);
|
||||
|
||||
// Default style.
|
||||
a.setStyleSheet(""
|
||||
" QSplitter::handle { background: palette(dark); } "
|
||||
" ads--ContainerWidget, ContainerWidget { background: palette(dark); } "
|
||||
" ads--SectionWidget, SectionWidget { background: palette(window); } "
|
||||
" ads--SectionTitleWidget, SectionTitleWidget { background: palette(window); } "
|
||||
" ads--SectionTitleWidget[activeTab=\"true\"], SectionTitleWidget[activeTab=\"true\"] { background: palette(light); } "
|
||||
" ads--SectionContentWidget, SectionContentWidget { border: 1px solid palette(light); } "
|
||||
" "
|
||||
);
|
||||
// Load style sheet
|
||||
// QFile f(":/stylesheets/default-windows.css");
|
||||
QFile f(":/stylesheets/vendor-partsolutions.css");
|
||||
if (f.open(QFile::ReadOnly))
|
||||
{
|
||||
QByteArray ba = f.readAll();
|
||||
f.close();
|
||||
a.setStyleSheet(QString(ba));
|
||||
}
|
||||
|
||||
MainWindow mw;
|
||||
mw.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
// Development style.
|
||||
// a.setStyleSheet(""
|
||||
// " QSplitter::handle { border: 1px solid #000000; background: #000000; } "
|
||||
// " ads--ContainerWidget { border: 1px solid #ff0000; background: #FFE6E6; padding: 6px; } "
|
||||
@ -59,23 +35,28 @@ int main(int argc, char *argv[])
|
||||
// " ads--SectionContentWidget { border: 1px solid #FFFF00; background: #FFFFE6; padding: 6px; } "
|
||||
// );
|
||||
|
||||
// PARTsolutions style.
|
||||
// a.setStyleSheet(""
|
||||
// " QSplitter::handle:vertical { image: url(:/img/splitter-horizontal.png); } "
|
||||
// " QSplitter::handle:horizontal { image: url(:/img/splitter-vertical.png); } "
|
||||
// " ads--ContainerWidget { border: 0; background: #9ab6ca; } "
|
||||
// " ads--SectionWidget { border-width: 1px; border-color: #ffffff; border-style: solid; background: #7c9eb3; padding: 0; margin: 0; } "
|
||||
// " ads--SectionTitleWidget { border-right: 1px solid #E7F3F8; background: #7c9eb3; } "
|
||||
// " ads--SectionTitleWidget[activeTab=\"true\"] { border: 1px solid #E7F3F8; background: #E7F3F8; } "
|
||||
// " ads--SectionTitleWidget IconTitleWidget QLabel { color: #000000; } "
|
||||
// " ads--SectionContentWidget { border: 0px solid #E7F3F8; background: #ffffff; } "
|
||||
// " ads--FloatingWidget QPushButton { background: #E7F3F8; } "
|
||||
// );
|
||||
//static void centerWidget(QWidget* widget)
|
||||
//{
|
||||
// if (widget)
|
||||
// {
|
||||
// QDesktopWidget deskWidget;
|
||||
// const int screenIndex = deskWidget.primaryScreen();
|
||||
// const QRect deskRect = deskWidget.availableGeometry(screenIndex);
|
||||
// const int x = (deskRect.width() - widget->rect().width()) / 2;
|
||||
// const int y = (deskRect.height() - widget->rect().height()) / 2;
|
||||
// widget->move(x, y);
|
||||
// }
|
||||
//}
|
||||
|
||||
MainWindow mw;
|
||||
// resizeWidgetPerCent(&mw, 60, 80);
|
||||
// centerWidget(&mw);
|
||||
mw.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
//static void resizeWidgetPerCent(QWidget* widget, qreal widthPC, qreal heightPC)
|
||||
//{
|
||||
// if (widget && widthPC >= 0.0 && heightPC >= 0.0)
|
||||
// {
|
||||
// QDesktopWidget deskWidget;
|
||||
// const int screenIndex = deskWidget.primaryScreen();
|
||||
// const QRect deskRect = deskWidget.availableGeometry(screenIndex);
|
||||
// const int w = (deskRect.width() / 100) * widthPC;
|
||||
// const int h = (deskRect.height() / 100) * heightPC;
|
||||
// widget->resize(w, h);
|
||||
// }
|
||||
//}
|
Loading…
Reference in New Issue
Block a user