From 86ed82aea4c20d22778a58fb283b7ff6b7bca7c5 Mon Sep 17 00:00:00 2001 From: Victor Zarubkin Date: Fri, 17 Nov 2017 21:22:53 +0300 Subject: [PATCH] #0 [GUI] Styling --- profiler_gui/default.css | 39 +++++++++++-------- profiler_gui/icons/attribution.txt | 12 ++++-- profiler_gui/icons/close-white-pressed.svg | 12 ++++++ profiler_gui/icons/maximize-white-hover.svg | 16 +++++--- profiler_gui/icons/maximize-white-pressed.svg | 16 ++++++++ profiler_gui/icons/maximize-white.svg | 16 +++++--- profiler_gui/icons/minimize-white-hover.svg | 16 ++++++++ profiler_gui/icons/minimize-white-pressed.svg | 16 ++++++++ profiler_gui/icons/minimize-white.svg | 16 ++++++++ profiler_gui/main_window.cpp | 7 +++- profiler_gui/main_window.h | 10 +++-- profiler_gui/resources.qrc | 5 +++ 12 files changed, 145 insertions(+), 36 deletions(-) create mode 100644 profiler_gui/icons/close-white-pressed.svg create mode 100644 profiler_gui/icons/maximize-white-pressed.svg create mode 100644 profiler_gui/icons/minimize-white-hover.svg create mode 100644 profiler_gui/icons/minimize-white-pressed.svg create mode 100644 profiler_gui/icons/minimize-white.svg diff --git a/profiler_gui/default.css b/profiler_gui/default.css index 07cf8ef..457f3df 100644 --- a/profiler_gui/default.css +++ b/profiler_gui/default.css @@ -27,18 +27,16 @@ QLineEdit, QPushButton { background-color: white; } -QPushButton { - padding: 2px 5px 2px 5px; -} +QLineEdit:focus { border: 1px ridge #f44336; } -QPushButton:hover { - border: 1px solid #f4a386; - color: #806070; -} +QPushButton { padding: 2px 5px 2px 5px; } +QPushButton:hover { border: 1px solid #f4a386; color: #806070; } +QPushButton:pressed { border: 1px solid #d47366; color: #705060; } -QPushButton:pressed { - border: 1px solid #d47366; - color: #705060; +QComboBox QListView { + background-color: white; + border: 1px solid #cccccc; + selection-background-color: rgba(96, 112, 208, 64); } /* ****************************************************************************************************************** */ @@ -152,16 +150,16 @@ QHeaderView::section { /* ****************************************************************************************************************** */ -QDockWidget QWidget#EasyDockWidgetTitle { +EasyDockWidget QWidget#EasyDockWidgetTitle { background-color: #666666; } -QDockWidget QWidget#EasyDockWidgetTitle QLabel { +EasyDockWidget QWidget#EasyDockWidgetTitle QLabel { color: white; margin-left: 4px; } -QDockWidget QWidget#EasyDockWidgetTitle QPushButton { +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton { background: none; border: none; max-height: 12px; @@ -170,10 +168,17 @@ QDockWidget QWidget#EasyDockWidgetTitle QPushButton { padding: 0; } -QDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton { image: url(":/DockMaximizeWhite"); } -QDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton:hover { image: url(":/DockMaximizeWhiteHover"); } -QDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetCloseButton { image: url(":/DockCloseWhite"); } -QDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetCloseButton:hover { image: url(":/DockCloseWhiteHover"); } +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton { image: url(":/DockMaximizeWhite"); } +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton:hover { image: url(":/DockMaximizeWhiteHover"); } +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton:pressed { image: url(":/DockMaximizeWhitePressed"); } + +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton[floating=true] { image: url(":/DockMinimizeWhite"); } +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton[floating=true]:hover { image: url(":/DockMinimizeWhiteHover"); } +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetFloatButton[floating=true]:pressed { image: url(":/DockMinimizeWhitePressed"); } + +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetCloseButton { image: url(":/DockCloseWhite"); } +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetCloseButton:hover { image: url(":/DockCloseWhiteHover"); } +EasyDockWidget QWidget#EasyDockWidgetTitle QPushButton#EasyDockWidgetCloseButton:pressed { image: url(":/DockCloseWhitePressed"); } diff --git a/profiler_gui/icons/attribution.txt b/profiler_gui/icons/attribution.txt index 00c05b6..675b5fa 100644 --- a/profiler_gui/icons/attribution.txt +++ b/profiler_gui/icons/attribution.txt @@ -24,8 +24,12 @@ search-next.svg - Icon made by Freepik from www.flaticon.com settings.svg - Icon made by Freepik from www.flaticon.com check.svg - Icon made by Kirill Kazachek from www.flaticon.com check-disabled.svg - Icon made by Kirill Kazachek from www.flaticon.com -close-white.svg - Icon made by Cole Bemis from www.flaticon.com -close-white-disabled.svg - Icon made by Cole Bemis from www.flaticon.com -maximize-white.svg - Icon made by Google from www.flaticon.com -maximize-white-disabled.svg - Icon made by Google from www.flaticon.com +close-white.svg - Icon made by Cole Bemis from www.flaticon.com +close-white-hover.svg - Icon made by Cole Bemis from www.flaticon.com +close-white-pressed.svg - Icon made by Cole Bemis from www.flaticon.com +maximize-white.svg - Icon made by Freepik from www.flaticon.com +maximize-white-hover.svg - Icon made by Freepik from www.flaticon.com +maximize-white-pressed.svg - Icon made by Freepik from www.flaticon.com +minimize-white.svg - Icon made by Freepik from www.flaticon.com +minimize-white-pressed.svg - Icon made by Freepik from www.flaticon.com diff --git a/profiler_gui/icons/close-white-pressed.svg b/profiler_gui/icons/close-white-pressed.svg new file mode 100644 index 0000000..5f39552 --- /dev/null +++ b/profiler_gui/icons/close-white-pressed.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/profiler_gui/icons/maximize-white-hover.svg b/profiler_gui/icons/maximize-white-hover.svg index b294f37..92f8257 100644 --- a/profiler_gui/icons/maximize-white-hover.svg +++ b/profiler_gui/icons/maximize-white-hover.svg @@ -1,10 +1,16 @@ + + + width="483.252px" height="483.252px" viewBox="0 0 483.252 483.252" style="enable-background:new 0 0 483.252 483.252;" + xml:space="preserve"> - - + diff --git a/profiler_gui/icons/maximize-white-pressed.svg b/profiler_gui/icons/maximize-white-pressed.svg new file mode 100644 index 0000000..73a95d0 --- /dev/null +++ b/profiler_gui/icons/maximize-white-pressed.svg @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/profiler_gui/icons/maximize-white.svg b/profiler_gui/icons/maximize-white.svg index 5c299a9..d6d86c9 100644 --- a/profiler_gui/icons/maximize-white.svg +++ b/profiler_gui/icons/maximize-white.svg @@ -1,10 +1,16 @@ + + + width="483.252px" height="483.252px" viewBox="0 0 483.252 483.252" style="enable-background:new 0 0 483.252 483.252;" + xml:space="preserve"> - - + diff --git a/profiler_gui/icons/minimize-white-hover.svg b/profiler_gui/icons/minimize-white-hover.svg new file mode 100644 index 0000000..828901c --- /dev/null +++ b/profiler_gui/icons/minimize-white-hover.svg @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/profiler_gui/icons/minimize-white-pressed.svg b/profiler_gui/icons/minimize-white-pressed.svg new file mode 100644 index 0000000..f575f28 --- /dev/null +++ b/profiler_gui/icons/minimize-white-pressed.svg @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/profiler_gui/icons/minimize-white.svg b/profiler_gui/icons/minimize-white.svg new file mode 100644 index 0000000..24c65de --- /dev/null +++ b/profiler_gui/icons/minimize-white.svg @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/profiler_gui/main_window.cpp b/profiler_gui/main_window.cpp index dc25cb4..765029a 100644 --- a/profiler_gui/main_window.cpp +++ b/profiler_gui/main_window.cpp @@ -138,8 +138,13 @@ EasyDockWidget::EasyDockWidget(const QString& title, QWidget* parent) : QDockWid { auto floatingButton = new QPushButton(); floatingButton->setObjectName("EasyDockWidgetFloatButton"); - connect(floatingButton, &QPushButton::clicked, [this] { + floatingButton->setProperty("floating", isFloating()); + connect(floatingButton, &QPushButton::clicked, [this, floatingButton] { setFloating(!isFloating()); + floatingButton->setProperty("floating", isFloating()); + floatingButton->style()->unpolish(floatingButton); + floatingButton->style()->polish(floatingButton); + floatingButton->update(); }); auto closeButton = new QPushButton(); diff --git a/profiler_gui/main_window.h b/profiler_gui/main_window.h index ff8663b..200cb90 100644 --- a/profiler_gui/main_window.h +++ b/profiler_gui/main_window.h @@ -194,10 +194,12 @@ private: ////////////////////////////////////////////////////////////////////////// -struct EasyDockWidget : public QDockWidget +class EasyDockWidget : public QDockWidget { - EasyDockWidget(const QString& title, QWidget* parent = nullptr); - virtual ~EasyDockWidget(); + Q_OBJECT +public: + explicit EasyDockWidget(const QString& title, QWidget* parent = nullptr); + ~EasyDockWidget() override; }; class EasyMainWindow : public QMainWindow @@ -252,7 +254,7 @@ protected: public: explicit EasyMainWindow(); - virtual ~EasyMainWindow(); + ~EasyMainWindow() override; // Public virtual methods diff --git a/profiler_gui/resources.qrc b/profiler_gui/resources.qrc index cde0f98..7220183 100644 --- a/profiler_gui/resources.qrc +++ b/profiler_gui/resources.qrc @@ -32,7 +32,12 @@ icons/radio-indicator-disabled.svg icons/maximize-white.svg icons/maximize-white-hover.svg + icons/maximize-white-pressed.svg + icons/minimize-white.svg + icons/minimize-white-hover.svg + icons/minimize-white-pressed.svg icons/close-white.svg icons/close-white-hover.svg + icons/close-white-pressed.svg