Added init after timer. single shot.
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//#include <QToolButton>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "qassert.h"
|
#include "qassert.h"
|
||||||
#include <bcmainwindow.h>
|
#include <bcmainwindow.h>
|
||||||
@@ -51,8 +51,11 @@ BCMainWindow::BCMainWindow(QWidget *parent)
|
|||||||
qRegisterMetaType<QList<BCValue>>("BCValueList");
|
qRegisterMetaType<QList<BCValue>>("BCValueList");
|
||||||
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
initMainWindow();
|
|
||||||
|
|
||||||
|
// BESTE PRAXIS: QTimer::singleShot mit Lambda
|
||||||
|
QTimer::singleShot(0, this, [this]() {
|
||||||
|
initMainWindow();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +114,7 @@ void BCMainWindow::initMainWindow()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Wir wollen die Devices den Views zuordnen können
|
// Wir wollen die Devices den Views zuordnen können
|
||||||
_devicePanels[BCDevice::ID::Console] = _consolePanel;
|
_devicePanels[BCDevice::ID::Console] = _consolePanel;
|
||||||
_devicePanels[BCDevice::ID::Battery] = _batteryPanel;
|
_devicePanels[BCDevice::ID::Battery] = _batteryPanel;
|
||||||
@@ -145,13 +149,10 @@ void BCMainWindow::initMainWindow()
|
|||||||
|
|
||||||
// besser: model::emit dataChanged
|
// besser: model::emit dataChanged
|
||||||
// also: emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole, ValueRole});
|
// also: emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole, ValueRole});
|
||||||
connect( _connectButton, &QToolButton::clicked, &_transmitter, &BCTransmitter::onToggleConnectionState );
|
connect( _connectButton, &QToolButton::clicked, &_transmitter, &BCTransmitter::onToggleConnectionState );
|
||||||
connect( _syncButton, &QToolButton::clicked, this, &BCMainWindow::onSyncFromDevice );
|
connect( _syncButton, &QToolButton::clicked, this, &BCMainWindow::onSyncFromDevice );
|
||||||
|
connect( &_transmitter, &BCTransmitter::valueUpdated, this, &BCMainWindow::onValueUpdated );
|
||||||
|
|
||||||
connect( &_transmitter, &BCTransmitter::valueUpdated, this, &BCMainWindow::onValueUpdated );
|
|
||||||
|
|
||||||
// die Daten des eBikes laden
|
|
||||||
_dataManager.loadXmlBikeData(":/bikeinfo.xml"_L1);
|
|
||||||
|
|
||||||
_transmitter.moveToThread(&_worker);
|
_transmitter.moveToThread(&_worker);
|
||||||
|
|
||||||
@@ -160,6 +161,10 @@ void BCMainWindow::initMainWindow()
|
|||||||
|
|
||||||
_worker.start();
|
_worker.start();
|
||||||
|
|
||||||
|
bc::processEventsFor(2000);
|
||||||
|
|
||||||
|
// die Daten des eBikes laden
|
||||||
|
_dataManager.loadXmlBikeData(":/bikeinfo.xml"_L1);
|
||||||
_consoleAction->trigger();
|
_consoleAction->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user