diff --git a/src/blackgui/components/flightplancomponent.cpp b/src/blackgui/components/flightplancomponent.cpp index f0ce3ed87..df105dd37 100644 --- a/src/blackgui/components/flightplancomponent.cpp +++ b/src/blackgui/components/flightplancomponent.cpp @@ -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); diff --git a/src/blackgui/components/infowindowcomponent.cpp b/src/blackgui/components/infowindowcomponent.cpp index b58e758f3..283d5c0cb 100644 --- a/src/blackgui/components/infowindowcomponent.cpp +++ b/src/blackgui/components/infowindowcomponent.cpp @@ -9,6 +9,7 @@ #include "infowindowcomponent.h" #include "ui_infowindowcomponent.h" +#include "../stylesheetutility.h" #include "blackmisc/icon.h" #include #include @@ -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 diff --git a/src/blackgui/components/infowindowcomponent.h b/src/blackgui/components/infowindowcomponent.h index 97a0452c4..03592aa0a 100644 --- a/src/blackgui/components/infowindowcomponent.h +++ b/src/blackgui/components/infowindowcomponent.h @@ -68,6 +68,10 @@ namespace BlackGui //! Current page void setCurrentPage(QWidget *widget); + + private slots: + //! Style sheet changed + void onStyleSheetsChanged(); }; } } diff --git a/src/blackgui/components/infowindowcomponent.ui b/src/blackgui/components/infowindowcomponent.ui index f48b82d62..ef3096ce9 100644 --- a/src/blackgui/components/infowindowcomponent.ui +++ b/src/blackgui/components/infowindowcomponent.ui @@ -14,37 +14,7 @@ WizardPage - 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 **/ -} + Information @@ -107,8 +77,8 @@ QTextEdit { - - :/blackgui/icons/close.png:/blackgui/icons/close.png + + :/diagona/icons/diagona/icons/cross-button.png:/diagona/icons/diagona/icons/cross-button.png @@ -240,6 +210,8 @@ QTextEdit { - + + + diff --git a/src/blackgui/components/logcomponent.cpp b/src/blackgui/components/logcomponent.cpp index 7e3faf91c..0179d6ec4 100644 --- a/src/blackgui/components/logcomponent.cpp +++ b/src/blackgui/components/logcomponent.cpp @@ -9,6 +9,9 @@ #include "logcomponent.h" #include "ui_logcomponent.h" +#include "../stylesheetutility.h" + +using namespace BlackGui; namespace BlackGui { diff --git a/src/blackgui/components/logcomponent.ui b/src/blackgui/components/logcomponent.ui index 56ded9030..3ae1f1d70 100644 --- a/src/blackgui/components/logcomponent.ui +++ b/src/blackgui/components/logcomponent.ui @@ -38,8 +38,8 @@ 0 - - 3 + + 0 @@ -97,8 +97,8 @@ 0 0 - 98 - 71 + 398 + 250 diff --git a/src/blackgui/dockwidgetinfobar.cpp b/src/blackgui/dockwidgetinfobar.cpp index bc140b761..392b9b3f2 100644 --- a/src/blackgui/dockwidgetinfobar.cpp +++ b/src/blackgui/dockwidgetinfobar.cpp @@ -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()); diff --git a/src/blackgui/guiutility.cpp b/src/blackgui/guiutility.cpp index 1d8973946..b24145040 100644 --- a/src/blackgui/guiutility.cpp +++ b/src/blackgui/guiutility.cpp @@ -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(); diff --git a/src/blackgui/guiutility.h b/src/blackgui/guiutility.h index 978fc7853..e5c768ae8 100644 --- a/src/blackgui/guiutility.h +++ b/src/blackgui/guiutility.h @@ -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(); diff --git a/src/blackgui/infoarea.cpp b/src/blackgui/infoarea.cpp index 77a01091c..553912a7d 100644 --- a/src/blackgui/infoarea.cpp +++ b/src/blackgui/infoarea.cpp @@ -15,6 +15,7 @@ #include #include #include +#include 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()); diff --git a/src/blackgui/qss/dockwidgettab.qss b/src/blackgui/qss/dockwidgettab.qss index c6ac37ada..8b82e46b3 100644 --- a/src/blackgui/qss/dockwidgettab.qss +++ b/src/blackgui/qss/dockwidgettab.qss @@ -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; } diff --git a/src/blackgui/qss/first.version/dockwidgettab.qss b/src/blackgui/qss/first.version/dockwidgettab.qss new file mode 100644 index 000000000..c6ac37ada --- /dev/null +++ b/src/blackgui/qss/first.version/dockwidgettab.qss @@ -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; +} diff --git a/src/blackgui/qss/first.version/fonts.qss b/src/blackgui/qss/first.version/fonts.qss new file mode 100644 index 000000000..67248d1ba --- /dev/null +++ b/src/blackgui/qss/first.version/fonts.qss @@ -0,0 +1,7 @@ +QWidget { + color: white; + font-family: "Arial"; + font-size: 8pt; + font-style: normal; + font-weight: bold; +} diff --git a/src/blackgui/qss/first.version/infobar.qss b/src/blackgui/qss/first.version/infobar.qss new file mode 100644 index 000000000..72695c822 --- /dev/null +++ b/src/blackgui/qss/first.version/infobar.qss @@ -0,0 +1,7 @@ +QFrame { + background-color: darkslategray; + margin: 0px; + padding-left: 6px; + padding-right: 6px; + padding-bottom: 0px; +} diff --git a/src/blackgui/qss/maininfoarea.qss b/src/blackgui/qss/first.version/maininfoarea.qss similarity index 100% rename from src/blackgui/qss/maininfoarea.qss rename to src/blackgui/qss/first.version/maininfoarea.qss diff --git a/src/blackgui/qss/first.version/mainwindow.qss b/src/blackgui/qss/first.version/mainwindow.qss new file mode 100644 index 000000000..df600bedc --- /dev/null +++ b/src/blackgui/qss/first.version/mainwindow.qss @@ -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; +} diff --git a/src/blackgui/qss/first.version/stylesheetinfo.qss b/src/blackgui/qss/first.version/stylesheetinfo.qss new file mode 100644 index 000000000..4baa689f7 --- /dev/null +++ b/src/blackgui/qss/first.version/stylesheetinfo.qss @@ -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; +} diff --git a/src/blackgui/qss/first.version/stylesheetintro.qss b/src/blackgui/qss/first.version/stylesheetintro.qss new file mode 100644 index 000000000..4baa689f7 --- /dev/null +++ b/src/blackgui/qss/first.version/stylesheetintro.qss @@ -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; +} diff --git a/src/blackgui/qss/fonts.qss b/src/blackgui/qss/fonts.qss index 67248d1ba..3a6ac6603 100644 --- a/src/blackgui/qss/fonts.qss +++ b/src/blackgui/qss/fonts.qss @@ -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; } diff --git a/src/blackgui/qss/infobar.qss b/src/blackgui/qss/infobar.qss index 72695c822..05b3437ac 100644 --- a/src/blackgui/qss/infobar.qss +++ b/src/blackgui/qss/infobar.qss @@ -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; +} diff --git a/src/blackgui/qss/mainwindow.qss b/src/blackgui/qss/mainwindow.qss index a63902e55..1ed205fa4 100644 --- a/src/blackgui/qss/mainwindow.qss +++ b/src/blackgui/qss/mainwindow.qss @@ -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 { diff --git a/src/blackgui/qss/stylesheetinfo.qss b/src/blackgui/qss/stylesheetinfo.qss index 4baa689f7..b8b3be331 100644 --- a/src/blackgui/qss/stylesheetinfo.qss +++ b/src/blackgui/qss/stylesheetinfo.qss @@ -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 **/ } diff --git a/src/blackgui/qss/texture.test/infobar.qss b/src/blackgui/qss/texture.test/infobar.qss new file mode 100644 index 000000000..ff4abb6b4 --- /dev/null +++ b/src/blackgui/qss/texture.test/infobar.qss @@ -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; +} \ No newline at end of file diff --git a/src/blackgui/qss/texture.test/mainwindow.qss b/src/blackgui/qss/texture.test/mainwindow.qss new file mode 100644 index 000000000..1845fd685 --- /dev/null +++ b/src/blackgui/qss/texture.test/mainwindow.qss @@ -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; +} diff --git a/src/blackgui/qss/texture.test/stylesheetinfo.qss b/src/blackgui/qss/texture.test/stylesheetinfo.qss new file mode 100644 index 000000000..bdca67460 --- /dev/null +++ b/src/blackgui/qss/texture.test/stylesheetinfo.qss @@ -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 **/ +} \ No newline at end of file diff --git a/src/blackgui/stylesheetutility.cpp b/src/blackgui/stylesheetutility.cpp index d3401abf9..0bdab8fe1 100644 --- a/src/blackgui/stylesheetutility.cpp +++ b/src/blackgui/stylesheetutility.cpp @@ -13,6 +13,8 @@ #include #include #include +#include +#include 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); + } } diff --git a/src/blackgui/stylesheetutility.h b/src/blackgui/stylesheetutility.h index fd86de643..8e7d2dfe6 100644 --- a/src/blackgui/stylesheetutility.h +++ b/src/blackgui/stylesheetutility.h @@ -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();