Fixed light & dark modes.
This commit is contained in:
@@ -50,8 +50,12 @@ BCMainWindow::BCMainWindow(QWidget *parent)
|
||||
qRegisterMetaType<BCValue>("BCValue");
|
||||
qRegisterMetaType<QList<BCValue>>("BCValueList");
|
||||
|
||||
setupUi(this);
|
||||
#if defined(Q_OS_LINUX)
|
||||
// Für Touch screen: Window FRam weglassen
|
||||
//setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
||||
#endif
|
||||
|
||||
setupUi(this);
|
||||
|
||||
// Wir schreiben den 'initMainWindow()' Aufruf mit Hilfe des
|
||||
// timers in die Event-Queue, damit er erst ausgeführt wird,
|
||||
@@ -81,7 +85,6 @@ BCMainWindow::~BCMainWindow()
|
||||
|
||||
void BCMainWindow::initMainWindow()
|
||||
{
|
||||
|
||||
// Lambda um die buttons mit ihren Actions zu verbinden
|
||||
auto configureAction = [&]( QToolButton* button, QAction* action, BCDevice::ID deviceID )
|
||||
{
|
||||
@@ -89,9 +92,9 @@ void BCMainWindow::initMainWindow()
|
||||
button->setDefaultAction( action);
|
||||
// new way: die DeviceID muss aber explizit vom Lambda eingefanden werden.
|
||||
connect( action, &QAction::triggered, this, [this,deviceID]()
|
||||
{
|
||||
onShowDevicePanel( deviceID );
|
||||
});
|
||||
{
|
||||
onShowDevicePanel( deviceID );
|
||||
});
|
||||
|
||||
if( _devicePanels.contains(deviceID) )
|
||||
{
|
||||
@@ -110,34 +113,11 @@ void BCMainWindow::initMainWindow()
|
||||
_devicePanels[BCDevice::ID::Battery] = _batteryPanel;
|
||||
_devicePanels[BCDevice::ID::Motor] = _motorPanel;
|
||||
|
||||
// Die actions an die Buttons binden
|
||||
// Die actions an die Buttons binden
|
||||
configureAction(_motorButton, _motorAction, BCDevice::ID::Motor );
|
||||
configureAction(_consoleButton, _consoleAction, BCDevice::ID::Console );
|
||||
configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery );
|
||||
|
||||
/*
|
||||
bool m_isDarkMode = false;
|
||||
QString icon = m_isDarkMode ? "☀️" : "🌙";
|
||||
fitzeButton->setText(icon);
|
||||
|
||||
QString style = QString(
|
||||
"QPushButton {"
|
||||
" background-color: %1;"
|
||||
" border: 1px solid %2;"
|
||||
" border-radius: 6px;"
|
||||
" font-size: 12pt;"
|
||||
" padding: 0px;"
|
||||
"}"
|
||||
"QPushButton:hover {"
|
||||
" background-color: %3;"
|
||||
"}"
|
||||
).arg(m_isDarkMode ? "#2B2B2B" : "#FFFFFF")
|
||||
.arg(m_isDarkMode ? "#3F3F3F" : "#E1DFDD")
|
||||
.arg(m_isDarkMode ? "#3A3A3A" : "#F9F9F9");
|
||||
|
||||
fitzeButton->setStyleSheet(style);
|
||||
*/
|
||||
|
||||
initStatusBar();
|
||||
|
||||
_connectButton->setDefaultAction( _connectAction);
|
||||
@@ -165,12 +145,12 @@ void BCMainWindow::initMainWindow()
|
||||
//_batteryAction->trigger();
|
||||
|
||||
// Dummy sync beim starten
|
||||
|
||||
QTimer::singleShot(1000, this, [this]()
|
||||
{
|
||||
onSyncDeviceView();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
// 2. Bild für den Zustand UNCHECKED (Off) hinzufügen
|
||||
@@ -265,8 +245,8 @@ void BCMainWindow::onShowMessage( const QString& message, int timeOut )
|
||||
void BCMainWindow::autoConnect()
|
||||
{
|
||||
// __fix!
|
||||
// if( !connect)
|
||||
// fallBack
|
||||
// if( !connect)
|
||||
// fallBack
|
||||
}
|
||||
|
||||
void BCMainWindow::onDriverStateChanged( BCDriver::DriverState state, const QString& message )
|
||||
|
||||
Reference in New Issue
Block a user