From 2bb07716b9179fcee5d57fc06b19c2447bf4eaaf Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Fri, 19 Feb 2016 16:02:00 +0100 Subject: [PATCH] Stylesheet support --- application/appRc.qrc | 1 + application/mainwindow.cpp | 7 +++++++ application/mainwindow.ui | 5 ++++- application/style.css | 16 ++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 application/style.css diff --git a/application/appRc.qrc b/application/appRc.qrc index 8954102..dda944f 100644 --- a/application/appRc.qrc +++ b/application/appRc.qrc @@ -2,5 +2,6 @@ icons/login_32.png icons/login_64.png + style.css diff --git a/application/mainwindow.cpp b/application/mainwindow.cpp index 2d26eb6..85e65ec 100644 --- a/application/mainwindow.cpp +++ b/application/mainwindow.cpp @@ -18,6 +18,13 @@ MainWindow::MainWindow(QWidget *parent) : m_loginDialog = new LoginDialog(this); + QFile styleFile(":/style.css"); + + if (styleFile.open(QIODevice::ReadOnly | QIODevice::Text)) + { + this->setStyleSheet(styleFile.readAll()); + } + connect(m_loginDialog, &LoginDialog::accepted, [this]{ PermissionService service; QSharedPointer u = service.loadUser(m_loginDialog->login()); diff --git a/application/mainwindow.ui b/application/mainwindow.ui index 901b429..35c69a0 100644 --- a/application/mainwindow.ui +++ b/application/mainwindow.ui @@ -21,6 +21,9 @@ 0 + + 0 + @@ -53,7 +56,7 @@ 0 0 1000 - 19 + 21 diff --git a/application/style.css b/application/style.css new file mode 100644 index 0000000..7125770 --- /dev/null +++ b/application/style.css @@ -0,0 +1,16 @@ +#navigation { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255)); +} + +#navigation QPushButton { + color: black; + border: 1px solid #555; + border-radius: 11px; + padding: 5px; + background: qradialgradient(cx: 0.3, cy: -0.4, + fx: 0.3, fy: -0.4, + radius: 1.35, stop: 0 #e3e67e, stop: 1 #f3f5d0); + min-width: 80px; + min-height: 40px; + font: 14px; +}