From 175ffec58f9e4f513004ec53ab03f06561096913 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Sun, 20 Sep 2015 22:48:09 +0300 Subject: Allow to use the stylesheet to customize UI Now it is possible to set a stylesheet file to customize the wizard's UI. The stylesheet adds to the config.xml file using the new "StyleSheet" element. Change-Id: I66271f755a0f742e96cf433fe557423a2261e432 Reviewed-by: Iikka Eklund Reviewed-by: Leena Miettinen --- examples/doc/images/qtifw-examples-stylesheet.png | Bin 0 -> 14796 bytes examples/doc/stylesheet.qdoc | 51 +++++++++++++++++++++ examples/examples.pro | 3 +- examples/stylesheet/README | 6 +++ examples/stylesheet/config/config.xml | 12 +++++ examples/stylesheet/config/style.qss | 25 ++++++++++ .../meta/installscript.qs | 39 ++++++++++++++++ .../meta/package.xml | 8 ++++ examples/stylesheet/stylesheet.pro | 13 ++++++ 9 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 examples/doc/images/qtifw-examples-stylesheet.png create mode 100644 examples/doc/stylesheet.qdoc create mode 100644 examples/stylesheet/README create mode 100644 examples/stylesheet/config/config.xml create mode 100644 examples/stylesheet/config/style.qss create mode 100644 examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/installscript.qs create mode 100644 examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/package.xml create mode 100644 examples/stylesheet/stylesheet.pro (limited to 'examples') diff --git a/examples/doc/images/qtifw-examples-stylesheet.png b/examples/doc/images/qtifw-examples-stylesheet.png new file mode 100644 index 000000000..eaa42b8b8 Binary files /dev/null and b/examples/doc/images/qtifw-examples-stylesheet.png differ diff --git a/examples/doc/stylesheet.qdoc b/examples/doc/stylesheet.qdoc new file mode 100644 index 000000000..cc408df33 --- /dev/null +++ b/examples/doc/stylesheet.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Installer Framework. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example stylesheet + \ingroup qtifwexamples + \title Stylesheet Example + + \brief Using a stylesheet to customize a UI. + + \image qtifw-examples-stylesheet.png + + \e {Stylesheet} demonstrates how to use a stylesheet to customize + a wizard UI. + + \include installerfw-examples-configuring.qdocinc + + \list + \li The \c element sets the wizard style to be used. + \li The \c element sets the stylesheet file. + \li The \c element sets the color of the titles and subtitles. + \endlist + + \quotefile stylesheet/config/config.xml + + \include installerfw-examples-generating.qdocinc +*/ diff --git a/examples/examples.pro b/examples/examples.pro index 92a976ff2..377632b9c 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -12,4 +12,5 @@ SUBDIRS += \ quitinstaller \ registerfileextension \ startmenu \ - systeminfo + systeminfo \ + stylesheet diff --git a/examples/stylesheet/README b/examples/stylesheet/README new file mode 100644 index 000000000..ee0d445db --- /dev/null +++ b/examples/stylesheet/README @@ -0,0 +1,6 @@ +Shows how to customize a UI using stylesheet. + +Generate installer with + +binarycreator --offline-only -c config/config.xml -p packages installer + diff --git a/examples/stylesheet/config/config.xml b/examples/stylesheet/config/config.xml new file mode 100644 index 000000000..3cd8e6060 --- /dev/null +++ b/examples/stylesheet/config/config.xml @@ -0,0 +1,12 @@ + + + Stylesheet Example + 1.0.0 + Stylesheet Example + Qt-Project + Qt IFW Examples + @HomeDir@/IfwExamples/stylesheet + Classic + style.qss + #FFFFFF + diff --git a/examples/stylesheet/config/style.qss b/examples/stylesheet/config/style.qss new file mode 100644 index 000000000..8d4f75d65 --- /dev/null +++ b/examples/stylesheet/config/style.qss @@ -0,0 +1,25 @@ +QWidget +{ + color: white; + background-color: rgb(65, 65, 65); +} + +QPushButton +{ + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(150, 150, 150, 60%), stop:1 rgba(50, 50, 50, 60%)); + border-color: rgb(60, 60, 60); + border-style: solid; + border-width: 2px; + border-radius: 9px; + min-height: 20px; + max-height: 20px; + min-width: 60px; + max-width: 60px; + padding-left: 15px; + padding-right: 15px; +} + +QPushButton:pressed, QPushButton:checked +{ + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(50, 50, 50, 60%), stop:1 rgba(150, 150, 150, 60%)); +} diff --git a/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/installscript.qs b/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/installscript.qs new file mode 100644 index 000000000..e99733ff3 --- /dev/null +++ b/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/installscript.qs @@ -0,0 +1,39 @@ +/************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Installer Framework. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** +** $QT_END_LICENSE$ +** +**************************************************************************/ + +function Component() +{ + // constructor + installer.setDefaultPageVisible(QInstaller.ComponentSelection, false); +} diff --git a/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/package.xml b/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/package.xml new file mode 100644 index 000000000..c0698a4e4 --- /dev/null +++ b/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/package.xml @@ -0,0 +1,8 @@ + + + Dummy + 2015-09-09 + 1.0.1 + true + + diff --git a/examples/stylesheet/stylesheet.pro b/examples/stylesheet/stylesheet.pro new file mode 100644 index 000000000..415df49d5 --- /dev/null +++ b/examples/stylesheet/stylesheet.pro @@ -0,0 +1,13 @@ +TEMPLATE = aux + +INSTALLER = installer + +INPUT = $$PWD/config/config.xml $$PWD/packages +example.input = INPUT +example.output = $$INSTALLER +example.commands = ../../bin/binarycreator -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT} +example.CONFIG += target_predeps no_link combine + +QMAKE_EXTRA_COMPILERS += example + +OTHER_FILES = README -- cgit v1.2.3