- Notifications
You must be signed in to change notification settings - Fork1
Implementation of Material Design 2 for the Switch component.
License
CM0use/SwitchButton
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Implementation of Material Design 2 for the Switch component.
Features •Description •Use •Contributing •References •License
- The color palette is based on Chrome aesthetics.
- You can customize the track and thumb colors.
- Easy to use and understand.
Based onMaterial Design 2 used by Google and other applications.
This repository was created to improve the functionality of Switch/Toggle that do not have the expected functionality or are too complex. These Switch/Toggle often do not allow to place a text next to it that is activated when clicking on it or in the surrounding area.
The color palette can be changed according to the theme you are using with the setThemeDark and setThemeLight methods.
You can also customize the color palette with the setTrackColor and setThumbColor methods to change the track and thumb colors.
#include"switchbutton.h"intmain(){// ...bool themeDarkIsOn{true };// Add the text "myText" next to the SwitchButton and enable Chrome's dark theme SwitchButton *_switch{newSwitchButton("myText", themeDarkIsOn) };// Add the text "myText" next to the SwitchButton and enable Chrome's light theme SwitchButton *_switch2{newSwitchButton("myText", !themeDarkIsOn) };// Change the track and thumb color palette _switch.setTrackColor(QColor{"#0f0" }, QColor{"#00f" }); _switch.setThumbColor(QColor{"#f00" }, QColor{"#ff0" });// Change the color palette of the SwitchButton _switch.setThemeLight(); _switch.setThemeDark();// ...}
Any contribution you make will be greatly appreciated.
If you have any ideas/suggestions to improve this repository, make a fork and create a pull request.
You can alsoopen the issue tracker to report any improvements or bugs.
Toggle Switch in Qt
PyToggle
Qt Material Design Desktop Widgets
Distributed under the GNU General Public License v3.0
See accompanying fileLICENSE
or copy atGNU General Public License