Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cm0use/switchbutton
Implementation of Material Design 2 for the Switch component.
https://github.com/cm0use/switchbutton
component cpp cpp-qt cpp17 material-design material-design-2 material-ui qt qt-gui qt-widget qt6 qt6-widgets qtdesigner widget
Last synced: 3 days ago
JSON representation
Implementation of Material Design 2 for the Switch component.
- Host: GitHub
- URL: https://github.com/cm0use/switchbutton
- Owner: CM0use
- License: gpl-3.0
- Created: 2023-11-11T12:36:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-13T20:51:28.000Z (about 1 year ago)
- Last Synced: 2023-11-13T21:38:29.736Z (about 1 year ago)
- Topics: component, cpp, cpp-qt, cpp17, material-design, material-design-2, material-ui, qt, qt-gui, qt-widget, qt6, qt6-widgets, qtdesigner, widget
- Language: C++
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
SwitchButton
Implementation of Material Design 2 for the Switch component.
Features •
Description •
Use •
Contributing •
References •
License![light](https://github.com/CM0use/SwitchButton/assets/102839710/9e9fbf61-2655-49ff-8eb9-27b5136700eb)
![dark](https://github.com/CM0use/SwitchButton/assets/102839710/7d848e43-4e2d-4760-a628-a991eb4987ca)## Features
* The color palette is based on Chrome aesthetics.
* You can customize the track and thumb colors.
* Easy to use and understand.## Description
Based on Material 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.## Use
```cpp
#include "switchbutton.h"int main()
{
// ...bool themeDarkIsOn{ true };
// Add the text "myText" next to the SwitchButton and enable Chrome's dark theme
SwitchButton *_switch{ new SwitchButton("myText", themeDarkIsOn) };// Add the text "myText" next to the SwitchButton and enable Chrome's light theme
SwitchButton *_switch2{ new SwitchButton("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();// ...
}
```## Contributing
**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 also open the issue tracker to report any improvements or bugs.## References
Toggle Switch in Qt
PyToggle
Qt Material Design Desktop Widgets## License
**Distributed under the GNU General Public License v3.0**
See accompanying file LICENSE
or copy at GNU General Public License