-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- style guide Signed-off-by: Andrei Popa <[email protected]>
- Loading branch information
Showing
4 changed files
with
85 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.. _developer_guide: | ||
|
||
Scopy overview for developers | ||
================================================================================ | ||
|
||
About | ||
--------------------------------------------------------------------- | ||
Tutorials, coding guidelines and guides for developers. | ||
|
||
.. note:: | ||
|
||
These guides are for Scopy v2.0.0 and future versions. | ||
Follow the user guide for building Scopy an your local machine. Linux is recommended for development | ||
|
||
Source code | ||
--------------------------------------------------------------------- | ||
|
||
The source code for the entire application can be found on `github | ||
<https://github.com/analogdevicesinc/scopy>`_ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
.. _style: | ||
|
||
Style Tutorial | ||
============== | ||
|
||
**Style previewer tool is located in the test plugin** | ||
|
||
Create New Style Property | ||
------------------------- | ||
|
||
Before creating a new style, check if you can use an already existing one or combine multiple existing styles. Only create a new one if necessary. | ||
|
||
Navigate to ``style/qss/properties`` and pick/create a folder that matches the widget type you want to create a property for. Inside the folder, create a ``.qss`` file. | ||
|
||
- All style code must be surrounded by ``{}`` and have a set property ``*[&&property&&=true]{ }``. Do not replace the property name; keep it as ``&&property&&``. | ||
- The property value can be changed from ``true``, but when using it in the application, you also need to specify the correct value. | ||
- Use keys from the JSON files as much as possible. Example: ``&unit_1&``. | ||
|
||
Run CMake, and the new property should appear in ``style_properties.h`` with the same name as the ``.qss`` file. | ||
|
||
Add JSON Value | ||
-------------- | ||
|
||
JSON files should rarely be altered in any way. | ||
|
||
- **Global value:** Add a new key and value in ``style/json/global.json``. | ||
- **Theme value:** Add a new key and value in ``style/json/dark.json`` and all other theme JSON files accordingly. | ||
|
||
Run CMake, and you should find the new value in ``style_attributes.h``. | ||
|
||
Add Theme | ||
--------- | ||
|
||
Add a new ``.json`` file in ``style/json``. | ||
|
||
- Add at least all the values from ``dark.json``. | ||
- Other values from ``global.json`` can be overwritten in the new theme. Example: | ||
"unit_1": "20" (where "unit_1":"16" is in global.json) | ||
|
||
- Properties can also be overwritten. Example: | ||
"qss_properties_button_borderButton": "qss_properties_button_basicButton" | ||
|
||
Add Plugin Style | ||
---------------- | ||
|
||
Create a ``style`` folder in your plugin and use the exact same file structure. Only the ``qss`` folder is relevant since the JSON files cannot be overwritten from other plugins. You may add a folder in your ``style/qss/properties`` folder with the name of your plugin to avoid overwriting other core ``.qss`` style files with the same name. | ||
|
||
In your plugin ``CMakeLists.txt`` file, add the ``generate_style`` command. | ||
|
||
**Arguments:** ``option, style_folder, header_folder`` (option should always be ``--plugin``). | ||
|
||
Example: | ||
|
||
.. code-block:: cmake | ||
include(ScopyStyle) | ||
generate_style("--plugin" ${CMAKE_CURRENT_SOURCE_DIR}/style ${CMAKE_CURRENT_SOURCE_DIR}/include/pluginName) | ||
Run CMake, and you should see the new properties in ``header_folder/style_properties.h``. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,6 @@ Contents | |
user_guide/preferences | ||
user_guide/bugReport | ||
user_guide/troubleshooting | ||
|
||
|
||
developer_guide/style |
This file was deleted.
Oops, something went wrong.