refs #335, style sheet fixes / improvements and support methods

style sheets:
* style sheets with background textures
* scroll area / toolbox style sheet fix
* floating dock widgets
* kept 1st version of stylesheets in backup directory
* removed maininfoarea stylesheet, no longer needed with fixed style sheet

code
* central paintEvent method to enable style sheets in derived widgets
* detect frameless windows, dynamic properties
This commit is contained in:
Klaus Basan
2014-10-01 17:05:37 +02:00
committed by Roland Winklmeier
parent 65c2ed9db4
commit c965fbb785
27 changed files with 1056 additions and 156 deletions

View File

@@ -8,6 +8,7 @@
*/
#include "flightplancomponent.h"
#include "../stylesheetutility.h"
#include "ui_flightplancomponent.h"
#include "blackmisc/logmessage.h"
#include "blackcore/context_network.h"
@@ -16,6 +17,7 @@
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackGui;
namespace BlackGui
{
@@ -25,6 +27,8 @@ namespace BlackGui
QTabWidget(parent), CRuntimeBasedComponent(nullptr, false), ui(new Ui::CFlightPlanComponent)
{
ui->setupUi(this);
// fix style
this->tabBar()->setExpanding(false);
connect(this->ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::sendFlightPlan);

View File

@@ -9,6 +9,7 @@
#include "infowindowcomponent.h"
#include "ui_infowindowcomponent.h"
#include "../stylesheetutility.h"
#include "blackmisc/icon.h"
#include <QTimer>
#include <QDesktopWidget>
@@ -16,6 +17,7 @@
using namespace BlackMisc;
using namespace BlackMisc::Network;
namespace BlackGui
{
namespace Components
@@ -31,8 +33,11 @@ namespace BlackGui
this->hide();
this->m_hideTimer = new QTimer(this);
this->m_hideTimer->setSingleShot(true);
this->onStyleSheetsChanged();
connect(this->m_hideTimer, &QTimer::timeout, this, &CInfoWindowComponent::hide);
connect(this->ui->pb_Close, &QPushButton::pressed, this, &CInfoWindowComponent::hide);
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CInfoWindowComponent::onStyleSheetsChanged);
}
/*
@@ -145,5 +150,14 @@ namespace BlackGui
{
this->ui->sw_DifferentModes->setCurrentWidget(widget);
}
/*
* Style sheet changed
*/
void CInfoWindowComponent::onStyleSheetsChanged()
{
QString st = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameInfoWindow());
this->setStyleSheet(st);
}
}
} // namespace

View File

@@ -68,6 +68,10 @@ namespace BlackGui
//! Current page
void setCurrentPage(QWidget *widget);
private slots:
//! Style sheet changed
void onStyleSheetsChanged();
};
}
}

View File

@@ -14,37 +14,7 @@
<string>WizardPage</string>
</property>
<property name="styleSheet">
<string notr="true">QFrame#fr_InfoWindow {
border-style: solid;
border-width: 2px;
border-radius: 10px;
border-color: white;
}
QStackedWidget {
font-family: arial-rounded;
font: bold 10px;
color: white; /** font not in text edit **/
}
QPushButton {
background-color: transparent;
border-style: solid;
border-width: 0px;
border-radius:3px;
border-color: green;
max-height:20px;
}
QTextEdit {
background-color: rgba(255, 255, 0, 240); /* transparent yellow */
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
opacity: 0.5;
color: black; /** font **/
}</string>
<string notr="true"/>
</property>
<property name="title">
<string>Information</string>
@@ -107,8 +77,8 @@ QTextEdit {
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>:/blackgui/icons/close.png</normaloff>:/blackgui/icons/close.png</iconset>
<iconset resource="../../blackmisc/blackmisc.qrc">
<normaloff>:/diagona/icons/diagona/icons/cross-button.png</normaloff>:/diagona/icons/diagona/icons/cross-button.png</iconset>
</property>
</widget>
</item>
@@ -240,6 +210,8 @@ QTextEdit {
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../../blackmisc/blackmisc.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -9,6 +9,9 @@
#include "logcomponent.h"
#include "ui_logcomponent.h"
#include "../stylesheetutility.h"
using namespace BlackGui;
namespace BlackGui
{

View File

@@ -38,8 +38,8 @@
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>3</number>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QToolBox" name="tb_StatusPage">
@@ -97,8 +97,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>71</height>
<width>398</width>
<height>250</height>
</rect>
</property>
<attribute name="label">

View File

@@ -7,6 +7,7 @@
* contained in the LICENSE file.
*/
#include "guiutility.h"
#include "dockwidgetinfobar.h"
#include "components/maininfoareacomponent.h"
#include "stylesheetutility.h"
@@ -21,6 +22,7 @@ namespace BlackGui
{
CDockWidgetInfoBar::CDockWidgetInfoBar(QWidget *parent) : CDockWidget(parent)
{
this->setProperty("mainframeless", CGuiUtility::isMainWindowFrameless());
this->setMarginsWhenDocked(0, 0, 0, -1);
this->setWindowTitle("Info bar");
this->setWindowIcon(CIcons::swift24());

View File

@@ -27,6 +27,14 @@ namespace BlackGui
return nullptr;
}
bool CGuiUtility::isMainWindowFrameless()
{
QMainWindow *mw = mainWindow();
Q_ASSERT(mw); // there should be a main window
if (!mw) return false;
return (mw->windowFlags() & Qt::FramelessWindowHint);
}
QWidgetList CGuiUtility::topLevelApplicationWidgetsWithName()
{
QWidgetList tlw = QApplication::topLevelWidgets();

View File

@@ -26,6 +26,9 @@ namespace BlackGui
//! Main application window
static QMainWindow *mainWindow();
//! Is main window frameless?
static bool isMainWindowFrameless();
//! Top level widgets with names
static QWidgetList topLevelApplicationWidgetsWithName();

View File

@@ -15,6 +15,7 @@
#include <QListIterator>
#include <QSignalMapper>
#include <QCloseEvent>
#include <QStatusBar>
using namespace BlackMisc;
@@ -156,6 +157,12 @@ namespace BlackGui
return this->getDockableWidgetByTabBarIndex(tabBarIndex) == infoArea;
}
void CInfoArea::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
CStyleSheetUtility::useStyleSheetInDerivedWidget(this);
}
void CInfoArea::dockAllWidgets()
{
this->tabifyAllWidgets();
@@ -421,8 +428,6 @@ namespace BlackGui
void CInfoArea::ps_onStyleSheetChanged()
{
QString qss = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameMainInfoArea());
this->setStyleSheet(qss);
if (this->m_tabBar)
{
QString qss = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameDockWidgetTab());

View File

@@ -1,10 +1,10 @@
QTabBar::tab {
margin-top: 2px;
margin-bottom: 2px;
margin-left: 2px;
margin-right: 2px;
padding-top: 2px;
padding-bottom: 2px;
border: 0px;
border-radius: 0px;
margin-top: 2px;
margin-bottom: 2px;
margin-left: 2px;
margin-right: 2px;
padding-top: 2px;
padding-bottom: 2px;
border: 0px;
border-radius: 0px;
}

View File

@@ -0,0 +1,10 @@
QTabBar::tab {
margin-top: 2px;
margin-bottom: 2px;
margin-left: 2px;
margin-right: 2px;
padding-top: 2px;
padding-bottom: 2px;
border: 0px;
border-radius: 0px;
}

View File

@@ -0,0 +1,7 @@
QWidget {
color: white;
font-family: "Arial";
font-size: 8pt;
font-style: normal;
font-weight: bold;
}

View File

@@ -0,0 +1,7 @@
QFrame {
background-color: darkslategray;
margin: 0px;
padding-left: 6px;
padding-right: 6px;
padding-bottom: 0px;
}

View File

@@ -0,0 +1,323 @@
/** http://qt-project.org/doc/qt-5.3/stylesheet-examples.html **/
/** http://web.forret.com/tools/color.asp?RGB=2F4F4F&name=Dark+slate+gray **/
#MainWindow {
background-color: darkslategray;
/** rgba(47,79,79,10%); darkslategray **/
}
QWidget {
background-color: black;
}
QProgressBar {
border: 1px solid green;
border-radius: 5px;
text-align: center;
padding: 0px;
height: 16px;
}
QProgressBar::chunk {
background-color: darkblue;
width: 10px;
margin: 0.5px;
}
#wi_CentralWidgetOutside {
/** there is no opacity with background image, so we need semitransparent images **/
/** background-image: url(:/blackgui/icons/titaniumtexture.jpg) **/
/** border: 2px solid green; **/
/** border-radius: 20px; **/
background-color: darkslategray;
margin: 0px;
padding: 5px;
}
#fr_CentralFrameInside {
background-color: darkslategray;
margin: 5px;
}
#wi_MainKeypadArea {
background-color: darkslategray;
}
#gb_AtcStationsOnlineInfo {
border-style: none;
}
#sw_MainMiddle {
padding: 3px;
border: 0px;
border-radius: 10px;
}
#sw_MainMiddle QPushButton {
background-color: rgba(0, 0, 255, 128);
border-style: none;
border-radius:3px;
color: yellow;
padding: 3px;
}
/* No style for Dial
#sw_MainMiddel QDial {
background-color: rgba(0, 0, 255, 128);
}
*/
#wi_MainKeypadArea QPushButton {
background-color: black;
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
max-height:20px;
min-width:60px;
min-height:20px;
}
#wi_MainKeypadAreaWindow {
background-color: darkslategray;
}
#le_CommandLineInput {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
QTabWidget::pane { /* The tab widget frame */
border: none;
}
QTabWidget::tab-bar {
left: 5px; /* move to the right by 5px */
}
QTabBar::tab {
border: 1px solid green;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
min-width: 30px;
padding: 2px;
padding-left: 4px;
padding-right: 4px;
margin-right: 3px;
}
QTabBar::tab::selected {
background-color: rgba(0, 0, 255, 128);
}
QLabel {
background: transparent;
}
QLineEdit {
background: black;
border: 1px solid green;
border-radius: 5px;
}
QLineEdit[readOnly="true"] {
background: black;
}
QCheckBox {
border: 0px solid green;
background: transparent;
}
QTextEdit {
border: 1px solid green;
background: transparent;
border-radius: 5px;
}
QPlainTextEdit {
border: 1px solid green;
background: transparent;
border-radius: 5px;
}
QGroupBox {
border: 1px solid green;
margin-top: 2ex; /* leave space at the top for the title */
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: middle center; /* position at the top center */
padding: 0 3px;
}
QToolBox {
border: none;
}
QToolBox::tab {
border: 1px solid green;
border-radius: 6px;
min-width: 30px;
padding: 2px;
padding-left: 4px;
padding-right: 4px;
}
QToolBox::tab::selected {
background-color: rgba(0, 0, 255, 128);
}
QComboBox {
border: 1px solid green;
border-radius: 5px;
padding: 1px;
background: transparent;
}
QDoubleSpinBox {
border: 1px solid green;
border-radius: 5px;
padding: 1px;
background: transparent;
}
QMenuBar {
background: darkslategray;
}
QMenuBar::item {
spacing: 3px; /* spacing between menu bar items */
padding: 1px 4px;
background: transparent;
border-radius: 4px;
}
QMenuBar::item:selected { /* when selected using mouse or keyboard */
background: black;
}
QMenuBar::item:pressed {
background: black;
}
QMenu {
border: 2px solid darkslategray; /* reserve space for selection border */
background: lightgray;
color: black;
padding: 2px;
}
QScrollArea {
border: 1px solid green;
border-radius: 5px;
}
QScrollBar:horizontal {
border: 2px solid gray;
background: slategray;
height: 10px;
margin: 0px 5px 0 5px;
}
QScrollBar:vertical {
border: 2px solid gray;
background: slategray;
width: 10px;
margin: 5px 0 5px 0;
}
QScrollBar::handle:horizontal {
background: black;
min-width: 15px;
}
QScrollBar::handle:vertical {
background: black;
min-height: 15px;
}
QScrollBar::add-line:horizontal {
border: 2px solid gray;
background: blue;
width: 5px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 2px solid gray;
background: blue;
width: 5px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar::add-line:vertical {
border: 2px solid gray;
background: blue;
height: 5px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 2px solid gray;
background: blue;
height: 5px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QHeaderView::section {
border: 1px solid black;
background-color: darkslategray;
padding: 1px;
margin: 0px;
}
QTableView {
border: 1px solid green;
border-radius: 5px;
background-color: black;
alternate-background-color: darkslategray;
selection-background-color: blue;
margin-left: 2px;
margin-top: 1px;
margin-bottom: 0;
padding:0;
}
QSlider::groove:horizontal {
border: 1px solid gray;
height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background: darkslategray;
}
QSlider::handle:horizontal {
background: lightgray;
border: 1px solid darkslategray;
width: 18px;
margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 3px;
}
QSizeGrip {
image: url(:/diagona/icons/diagona/icons/arrow-resize-135.png);
width: 16px;
height: 16px;
}
QStatusBar {
background: darkslategray;
}
QStatusBar::item {
border: none;
}
QStatusBar QLabel {
border: none;
}

View File

@@ -0,0 +1,23 @@
QWidget {
font-family: arial-rounded;
font: bold 10px;
color: black; /** font **/
}
QPushButton {
background-color: rgba(255, 255, 0, 175);
border-style: solid;
border-width:1px;
border-radius:0px;
border-color: green;
max-height:20px;
}
QTextEdit {
background-color: rgba(255, 255, 0, 175);
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
opacity: 0.5;
}

View File

@@ -0,0 +1,23 @@
QWidget {
font-family: arial-rounded;
font: bold 10px;
color: black; /** font **/
}
QPushButton {
background-color: rgba(255, 255, 0, 175);
border-style: solid;
border-width:1px;
border-radius:0px;
border-color: green;
max-height:20px;
}
QTextEdit {
background-color: rgba(255, 255, 0, 175);
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
opacity: 0.5;
}

View File

@@ -1,7 +1,7 @@
QWidget {
color: white;
font-family: "Arial";
font-size: 8pt;
font-style: normal;
font-weight: bold;
color: white;
font-family: "Arial";
font-size: 8pt;
font-style: normal;
font-weight: bold;
}

View File

@@ -1,7 +1,11 @@
QFrame {
background-color: darkslategray;
margin: 0px;
padding-left: 6px;
padding-right: 6px;
padding-bottom: 0px;
}
/** mainframeless is dynamic property**/
QDockWidget[mainframeless="true"] QFrame {
background-color: darkslategray;
}

View File

@@ -1,13 +1,120 @@
/** http://qt-project.org/doc/qt-5.3/stylesheet-examples.html **/
/**
Resources:
http://qt-project.org/doc/qt-5.3/stylesheet-examples.html
http://web.forret.com/tools/color.asp?RGB=2F4F4F&name=Dark+slate+gray
Remarks:
there is no opacity with background image, so we need semitransparent images
use -- instead of :: for namespaces
Used dynamic properties
mainframeless (infobar.qss)
**/
/** putting background here works for framed, but not for frameless window **/
#MainWindow {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
QWidget {
/** required when dock widget is floating **/
#sw_MainMiddle QDockWidget {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
background-color: black;
}
/** required when info area is floating **/
BlackGui--CInfoArea {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
background-color: black;
}
/** fix scroll areas **/
/** in flight plan **/
QAbstractScrollArea #qw_FlightPlanTabMain { background-color: black; }
QAbstractScrollArea #qw_RemarksGenerator { background-color: black; }
/** in log component **/
QAbstractScrollArea #pg_StatusPageMessages { background-color: black; }
QAbstractScrollArea #pg_StatusPageConsole { background-color: black; }
/** main GUI parts **/
#dw_InfoBarStatus {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
#wi_CentralWidgetOutside {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
margin: 0px;
padding: 5px;
}
#fr_CentralFrameInside {
margin: 5px;
}
#gb_AtcStationsOnlineInfo {
border-style: none;
}
#sw_MainMiddle {
padding: 3px;
border: 1px solid green;
border-radius: 10px;
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
#sw_MainMiddle QPushButton {
background-color: rgba(0, 0, 255, 128);
border-style: none;
border-radius:3px;
color: yellow;
padding: 3px;
}
#wi_MainKeypadArea QPushButton {
/** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/
/** need to fix pressed button first **/
background: black;
border-style: solid;
border-width: 1px;
border-radius:6px;
border-color: green;
max-height:20px;
min-width:60px;
min-height:20px;
}
/** cockpit needs to come after sw_MainMiddle **/
#comp_CockpitComComponent QPushButton {
background-color: transparent;
border-style: solid;
border-radius:3px;
border-width: 0px;
border-color: blue;
color: lightblue;
padding: 1px;
margin: 2px;
}
#wip_CockpitComPanelShowHideBar QPushButton {
background-color: transparent;
border-style: solid;
border-radius:3px;
border-width: 0px;
border-color: blue;
}
#le_CommandLineInput {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
QProgressBar {
border: 1px solid green;
border-radius: 5px;
@@ -22,70 +129,6 @@ QProgressBar::chunk {
margin: 0.5px;
}
#wi_CentralWidgetOutside {
/** there is no opacity with background image, so we need semitransparent images **/
/** background-image: url(:/blackgui/icons/titaniumtexture.jpg) **/
/** border: 2px solid green; **/
/** border-radius: 20px; **/
background-color: darkslategray;
margin: 0px;
padding: 5px;
}
#fr_CentralFrameInside {
background-color: darkslategray;
margin: 5px;
}
#wi_MainKeypadArea {
background-color: darkslategray;
}
#gb_AtcStationsOnlineInfo {
border-style: none;
}
#sw_MainMiddle {
padding: 3px;
border: 0px;
border-radius: 10px;
}
#sw_MainMiddle QPushButton {
background-color: rgba(0, 0, 255, 128);
border-style: none;
border-radius:3px;
color: yellow;
padding: 3px;
}
/* No style for Dial
#sw_MainMiddel QDial {
background-color: rgba(0, 0, 255, 128);
}
*/
#wi_MainKeypadArea QPushButton {
background-color: black;
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
max-height:20px;
min-width:60px;
min-height:20px;
}
#wi_MainKeypadAreaWindow {
background-color: darkslategray;
}
#le_CommandLineInput {
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
QTabWidget::pane { /* The tab widget frame */
border: none;
}
@@ -109,22 +152,32 @@ QTabBar::tab::selected {
background-color: rgba(0, 0, 255, 128);
}
QTabBar::tear {
image: url(:/own/icons/own/transparent1px.png);
max-width: 1px;
}
QTabBar QToolButton { /* the scroll buttons are tool buttons */
background-color: rgba(0, 0, 255, 200);
border: 1px solid green;
}
QLabel {
background: transparent;
}
QLineEdit {
background: black;
background: transparent;
border: 1px solid green;
border-radius: 5px;
}
QLineEdit[readOnly="true"] {
background: black;
background: transparent;
}
QCheckBox {
border: 0px solid green;
border: 0px solid green; /** also borders label **/
background: transparent;
}
@@ -146,13 +199,9 @@ QGroupBox {
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: middle center; /* position at the top center */
padding: 0 3px;
}
QToolBox {
border: none;
subcontrol-origin: margin;
subcontrol-position: middle center; /* position at the top center */
padding: 0 3px;
}
QToolBox::tab {
@@ -168,6 +217,11 @@ QToolBox::tab::selected {
background-color: rgba(0, 0, 255, 128);
}
/** no border on page */
QToolBox > QWidget {
border: 0px;
}
QComboBox {
border: 1px solid green;
border-radius: 5px;
@@ -175,6 +229,12 @@ QComboBox {
background: transparent;
}
/** drop down list **/
QComboBox QAbstractItemView {
background-color: lightgray;
color: black;
}
QDoubleSpinBox {
border: 1px solid green;
border-radius: 5px;
@@ -183,7 +243,8 @@ QDoubleSpinBox {
}
QMenuBar {
background: darkslategray;
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
QMenuBar::item {
@@ -279,13 +340,14 @@ QHeaderView::section {
QTableView {
border: 1px solid green;
border-radius: 5px;
background-color: black;
background-color: transparent;
alternate-background-color: darkslategray;
selection-background-color: blue;
margin-left: 2px;
margin-top: 1px;
margin-bottom: 0;
padding:0;
margin-right: 2px;
margin-top: 2px;
margin-bottom: 2px;
padding:0px;
}
QSlider::groove:horizontal {
@@ -309,7 +371,8 @@ QSizeGrip {
}
QStatusBar {
background: darkslategray;
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
QStatusBar::item {

View File

@@ -1,23 +1,32 @@
QWidget {
font-family: arial-rounded;
font: bold 10px;
color: black; /** font **/
QFrame#fr_InfoWindow {
border-style: solid;
border-width: 2px;
border-radius: 10px;
border-color: white;
background-color: rgba(0,0,0,200);
}
QStackedWidget {
font-family: arial-rounded;
font: bold 10px;
color: white; /** font not in text edit **/
}
QPushButton {
background-color: rgba(255, 255, 0, 175);
border-style: solid;
border-width:1px;
border-radius:0px;
border-color: green;
max-height:20px;
background-color: transparent;
border-style: solid;
border-width: 0px;
border-radius:3px;
border-color: green;
max-height:20px;
}
QTextEdit {
background-color: rgba(255, 255, 0, 175);
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
opacity: 0.5;
background-color: rgba(255, 255, 0, 240); /* transparent yellow */
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
opacity: 0.5;
color: black; /** font **/
}

View File

@@ -0,0 +1,11 @@
QFrame {
margin: 0px;
padding-left: 6px;
padding-right: 6px;
padding-bottom: 0px;
}
/** mainframeless dynamic property**/
QDockWidget[mainframeless="true"] QFrame {
background-color: darkslategray;
}

View File

@@ -0,0 +1,349 @@
/** http://qt-project.org/doc/qt-5.3/stylesheet-examples.html **/
/** http://web.forret.com/tools/color.asp?RGB=2F4F4F&name=Dark+slate+gray **/
/** there is no opacity with background image, so we need semitransparent images **/
/** putting background here works for framed, but not for frameless window **/
#MainWindow {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
/** required when dock widget is floating **/
#sw_MainMiddle QDockWidget {
/** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/
/** texture not working when floating **/
background-color: black;
}
/** fix scroll areas **/
/** in flight plan **/
QAbstractScrollArea #qw_FlightPlanTabMain { background-color: black; }
QAbstractScrollArea #qw_RemarksGenerator { background-color: black; }
/** in log component **/
QAbstractScrollArea #pg_StatusPageMessages { background-color: black; }
QAbstractScrollArea #pg_StatusPageConsole { background-color: black; }
/** main GUI parts **/
#dw_InfoBarStatus {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
#wi_CentralWidgetOutside {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
margin: 0px;
padding: 5px;
}
#fr_CentralFrameInside {
margin: 5px;
}
#gb_AtcStationsOnlineInfo {
border-style: none;
}
#sw_MainMiddle {
padding: 3px;
border: 1px solid green;
border-radius: 10px;
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
#sw_MainMiddle QPushButton {
background-color: rgba(0, 0, 255, 128);
border-style: none;
border-radius:3px;
color: yellow;
padding: 3px;
}
#wi_MainKeypadArea QPushButton {
/** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/
/** need to fix pressed button first **/
background: black;
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
max-height:20px;
min-width:60px;
min-height:20px;
}
#le_CommandLineInput {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
QProgressBar {
border: 1px solid green;
border-radius: 5px;
text-align: center;
padding: 0px;
height: 16px;
}
QProgressBar::chunk {
background-color: darkblue;
width: 10px;
margin: 0.5px;
}
QTabWidget::pane { /* The tab widget frame */
border: none;
}
QTabWidget::tab-bar {
left: 5px; /* move to the right by 5px */
}
QTabBar::tab {
border: 1px solid green;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
min-width: 30px;
padding: 2px;
padding-left: 4px;
padding-right: 4px;
margin-right: 3px;
}
QTabBar::tab::selected {
background-color: rgba(0, 0, 255, 128);
}
QTabBar::tear {
image: url(:/own/icons/own/transparent1px.png);
max-width: 1px;
}
QTabBar QToolButton { /* the scroll buttons are tool buttons */
background-color: rgba(0, 0, 255, 200);
border: 1px solid green;
}
QLabel {
background: transparent;
}
QLineEdit {
background: transparent;
border: 1px solid green;
border-radius: 5px;
}
QLineEdit[readOnly="true"] {
background: transparent;
}
QCheckBox {
border: 0px solid green; /** also borders label **/
background: transparent;
}
QTextEdit {
border: 1px solid green;
background: transparent;
border-radius: 5px;
}
QPlainTextEdit {
border: 1px solid green;
background: transparent;
border-radius: 5px;
}
QGroupBox {
border: 1px solid green;
margin-top: 2ex; /* leave space at the top for the title */
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: middle center; /* position at the top center */
padding: 0 3px;
}
QToolBox::tab {
border: 1px solid green;
border-radius: 6px;
min-width: 30px;
padding: 2px;
padding-left: 4px;
padding-right: 4px;
}
QToolBox::tab::selected {
background-color: rgba(0, 0, 255, 128);
}
/** no border on page */
QToolBox > QWidget {
border: 0px;
}
QComboBox {
border: 1px solid green;
border-radius: 5px;
padding: 1px;
background: transparent;
}
/** drop down list **/
QComboBox QAbstractItemView {
background-color: lightgray;
color: black;
}
QDoubleSpinBox {
border: 1px solid green;
border-radius: 5px;
padding: 1px;
background: transparent;
}
QMenuBar {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
QMenuBar::item {
spacing: 3px; /* spacing between menu bar items */
padding: 1px 4px;
background: transparent;
border-radius: 4px;
}
QMenuBar::item:selected { /* when selected using mouse or keyboard */
background: black;
}
QMenuBar::item:pressed {
background: black;
}
QMenu {
border: 2px solid darkslategray; /* reserve space for selection border */
background: lightgray;
color: black;
padding: 2px;
}
QScrollArea {
border: 1px solid green;
border-radius: 5px;
}
QScrollBar:horizontal {
border: 2px solid gray;
background: slategray;
height: 10px;
margin: 0px 5px 0 5px;
}
QScrollBar:vertical {
border: 2px solid gray;
background: slategray;
width: 10px;
margin: 5px 0 5px 0;
}
QScrollBar::handle:horizontal {
background: black;
min-width: 15px;
}
QScrollBar::handle:vertical {
background: black;
min-height: 15px;
}
QScrollBar::add-line:horizontal {
border: 2px solid gray;
background: blue;
width: 5px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 2px solid gray;
background: blue;
width: 5px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar::add-line:vertical {
border: 2px solid gray;
background: blue;
height: 5px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 2px solid gray;
background: blue;
height: 5px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QHeaderView::section {
border: 1px solid black;
background-color: darkslategray;
padding: 1px;
margin: 0px;
}
QTableView {
border: 1px solid green;
border-radius: 5px;
background-color: transparent;
alternate-background-color: darkslategray;
selection-background-color: blue;
margin-left: 2px;
margin-right: 2px;
margin-top: 2px;
margin-bottom: 2px;
padding:0px;
}
QSlider::groove:horizontal {
border: 1px solid gray;
height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background: darkslategray;
}
QSlider::handle:horizontal {
background: lightgray;
border: 1px solid darkslategray;
width: 18px;
margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 3px;
}
QSizeGrip {
image: url(:/diagona/icons/diagona/icons/arrow-resize-135.png);
width: 16px;
height: 16px;
}
QStatusBar {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
QStatusBar::item {
border: none;
}
QStatusBar QLabel {
border: none;
}

View File

@@ -0,0 +1,31 @@
QFrame#fr_InfoWindow {
border-style: solid;
border-width: 2px;
border-radius: 10px;
border-color: white;
}
QStackedWidget {
font-family: arial-rounded;
font: bold 10px;
color: white; /** font not in text edit **/
}
QPushButton {
background-color: transparent;
border-style: solid;
border-width: 0px;
border-radius:3px;
border-color: green;
max-height:20px;
}
QTextEdit {
background-color: rgba(255, 255, 0, 240); /* transparent yellow */
border-style: solid;
border-width:1px;
border-radius:6px;
border-color: green;
opacity: 0.5;
color: black; /** font **/
}

View File

@@ -13,6 +13,8 @@
#include <QTextStream>
#include <QDebug>
#include <QRegExp>
#include <QStyleOption>
#include <QPainter>
namespace BlackGui
{
@@ -120,7 +122,7 @@ namespace BlackGui
QString CStyleSheetUtility::style(const QString &fileName) const
{
if (!this->containsStyle(fileName)) return QString();
return this->m_styleSheets[fileName.toLower()];
return this->m_styleSheets[fileName.toLower()].trimmed();
}
QString CStyleSheetUtility::styles(const QStringList &fileNames) const
@@ -129,7 +131,7 @@ namespace BlackGui
foreach(QString fileName, fileNames)
{
if (!this->containsStyle(fileName)) continue;
QString s = this->m_styleSheets[fileName.toLower()];
QString s = this->m_styleSheets[fileName.toLower()].trimmed();
if (s.isEmpty()) continue;
if (!style.isEmpty()) style.append("\n\n");
style.append("/** file: ").append(fileName).append(" **/\n");
@@ -219,4 +221,16 @@ namespace BlackGui
dirPath.append("qss");
return dirPath;
}
void CStyleSheetUtility::useStyleSheetInDerivedWidget(QWidget *usedWidget)
{
Q_ASSERT(usedWidget);
if (!usedWidget) { return; }
Q_ASSERT(usedWidget->style());
if (!usedWidget->style()) { return; }
QStyleOption opt;
opt.initFrom(usedWidget);
QPainter p(usedWidget);
usedWidget->style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, usedWidget);
}
}

View File

@@ -89,9 +89,9 @@ namespace BlackGui
}
//! File name maininfoarea.qss
static const QString &fileNameMainInfoArea()
static const QString &fileNameInfoWindow()
{
static const QString f("maininfoarea.qss");
static const QString f("stylesheetinfo.qss");
return f;
}
@@ -109,6 +109,13 @@ namespace BlackGui
return s;
}
//! Transparent background color
static const QString &transparentBackgroundColor()
{
static const QString t = "background-color: transparent;";
return t;
}
//! qss directory
static QString qssDirectory();
@@ -121,6 +128,10 @@ namespace BlackGui
//! Font as combined weight and style
static QString fontAsCombinedWeightStyle(const QFont &font);
//! Use style sheets in derived widgets
//! \sa QWidget::paintEvent
static void useStyleSheetInDerivedWidget(QWidget *derivedWidget);
signals:
//! Sheets have been changed
void styleSheetsChanged();