Added gui widgets as own classes, part I

This commit is contained in:
2026-01-10 14:39:43 +01:00
parent 9f0382965f
commit dc3669f513
6 changed files with 167 additions and 130 deletions

52
bcthemeswitchbutton.cpp Normal file
View File

@@ -0,0 +1,52 @@
#include <bcthemeswitchbutton.h>
BCThemeSwitchButton::BCThemeSwitchButton(QWidget *parent )
: QPushButton(parent)
{
// Visuelles Setup: Flach, keine Ränder, Hand-Cursor
setFlat(true);
setCursor(Qt::PointingHandCursor);
setFixedSize(24, 24);
updateIcon();
connect(this, &QPushButton::clicked, this, &BCThemeSwitchButton::toggleMode);
}
/**
* @brief Setzt den DarkMode
*/
void BCThemeSwitchButton::setDarkMode( bool isDark )
{
_isDarkMode = !isDark;
toggleMode();
}
/**
* @brief Schaltet den akutellen Mode um.
*/
void BCThemeSwitchButton::toggleMode()
{
_isDarkMode = !_isDarkMode;
updateIcon();
emit themeChanged(_isDarkMode);
}
/**
* @brief Icon & Tooltip anpassen
*/
void BCThemeSwitchButton::updateIcon()
{
// Logik:
// Ist Dark Mode an? Zeige Mond (oder Sonne, je nach Geschmack).
// Hier: Zeige das Symbol des AKTUELLEN Modus.
setText(_isDarkMode ? "🌙" : "☀️");
setToolTip(_isDarkMode ? "Zum LightMode wechseln" : "Zum DarkMode wechseln");
}