Changed main layout
This commit is contained in:
1
bc.h
1
bc.h
@@ -799,6 +799,7 @@ namespace BCTags
|
|||||||
inline constexpr auto Max = "Max"_L1;
|
inline constexpr auto Max = "Max"_L1;
|
||||||
inline constexpr auto Factor = "Factor"_L1;
|
inline constexpr auto Factor = "Factor"_L1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BC_H
|
#endif // BC_H
|
||||||
|
|||||||
@@ -48,11 +48,6 @@ BCDeviceView::BCDeviceView(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BCDeviceView::setHeaderLabel( const QString& headerText)
|
|
||||||
{
|
|
||||||
_valueModel.setHeaderLabel( headerText );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BCDeviceView::setDeviceID( BCDevice::ID deviceID )
|
void BCDeviceView::setDeviceID( BCDevice::ID deviceID )
|
||||||
{
|
{
|
||||||
@@ -72,12 +67,7 @@ const BCValueList& BCDeviceView::getValueListX()
|
|||||||
return _valueModel.getValueList();
|
return _valueModel.getValueList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
BCValueModel& BCDeviceView::getValueModel()
|
|
||||||
{
|
|
||||||
return _valueModel;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// __FIX ist das ok so?
|
// __FIX ist das ok so?
|
||||||
void BCDeviceView::onValueListReady( BCDevice::ID deviceID, BCValueList valueList )
|
void BCDeviceView::onValueListReady( BCDevice::ID deviceID, BCValueList valueList )
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ public:
|
|||||||
|
|
||||||
explicit BCDeviceView(QWidget *parent = nullptr);
|
explicit BCDeviceView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void setHeaderLabel( const QString& headerText);
|
|
||||||
|
|
||||||
void setDeviceID( BCDevice::ID deviceID );
|
void setDeviceID( BCDevice::ID deviceID );
|
||||||
BCDevice::ID getDeviceID() const;
|
BCDevice::ID getDeviceID() const;
|
||||||
|
|||||||
@@ -68,6 +68,16 @@ BCMainWindow::~BCMainWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Setzt den Headerlabel ( == die Device-Bezeichnung )
|
||||||
|
* @param headerLabel Der headerLabel
|
||||||
|
*/
|
||||||
|
|
||||||
|
void BCMainWindow::setHeaderLabel( const QString& headerText)
|
||||||
|
{
|
||||||
|
_headerLabel->setText( " BionxControl: " + headerText );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialisiert alle Komponenten des MainWindows.
|
* @brief Initialisiert alle Komponenten des MainWindows.
|
||||||
*/
|
*/
|
||||||
@@ -75,7 +85,7 @@ BCMainWindow::~BCMainWindow()
|
|||||||
void BCMainWindow::initMainWindow()
|
void BCMainWindow::initMainWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
auto configureAction = [&]( QToolButton* button, QAction* action, BCDevice::ID deviceID, const QString& panelTitle="" )
|
auto configureAction = [&]( QToolButton* button, QAction* action, BCDevice::ID deviceID )
|
||||||
{
|
{
|
||||||
// Action an den Button binden
|
// Action an den Button binden
|
||||||
button->setDefaultAction( action);
|
button->setDefaultAction( action);
|
||||||
@@ -92,8 +102,6 @@ void BCMainWindow::initMainWindow()
|
|||||||
if( _devicePanels.contains(deviceID) )
|
if( _devicePanels.contains(deviceID) )
|
||||||
{
|
{
|
||||||
BCDeviceView* currentPanel = _devicePanels[deviceID];
|
BCDeviceView* currentPanel = _devicePanels[deviceID];
|
||||||
// den Panels ihren title geben
|
|
||||||
currentPanel->setHeaderLabel( panelTitle );
|
|
||||||
// ... und ihre device ID
|
// ... und ihre device ID
|
||||||
currentPanel->setDeviceID( deviceID );
|
currentPanel->setDeviceID( deviceID );
|
||||||
// Wenn ein Device (entspricht einem Datenmodel) fertig eingelesen wurde,
|
// Wenn ein Device (entspricht einem Datenmodel) fertig eingelesen wurde,
|
||||||
@@ -109,10 +117,10 @@ void BCMainWindow::initMainWindow()
|
|||||||
_devicePanels[BCDevice::ID::Motor] = _motorPanel;
|
_devicePanels[BCDevice::ID::Motor] = _motorPanel;
|
||||||
|
|
||||||
// Die actions an die Buttons binden
|
// Die actions an die Buttons binden
|
||||||
configureAction(_motorButton, _motorAction, BCDevice::ID::Motor, "Motor Settings"_L1 );
|
configureAction(_motorButton, _motorAction, BCDevice::ID::Motor );
|
||||||
configureAction(_consoleButton, _consoleAction, BCDevice::ID::Console, "Console Settings"_L1 );
|
configureAction(_consoleButton, _consoleAction, BCDevice::ID::Console );
|
||||||
configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery, "Battery Settings"_L1 );
|
configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery );
|
||||||
configureAction(_pimpButton, _pimpAction, BCDevice::ID::Pimp, "Pimp my Ride"_L1 );
|
configureAction(_pimpButton, _pimpAction, BCDevice::ID::Pimp );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -186,8 +194,11 @@ void BCMainWindow::onShowDevicePanel( BCDevice::ID deviceID )
|
|||||||
BCDeviceView* nxtPanel = _devicePanels[deviceID];
|
BCDeviceView* nxtPanel = _devicePanels[deviceID];
|
||||||
if( nxtPanel != _currentPanel )
|
if( nxtPanel != _currentPanel )
|
||||||
{
|
{
|
||||||
_stackedWidget->setCurrentWidget( nxtPanel );
|
|
||||||
_currentPanel = nxtPanel;
|
_currentPanel = nxtPanel;
|
||||||
|
qDebug() << " --- Firz: " << _currentPanel->property( BCKeyHeaderLabel );
|
||||||
|
setHeaderLabel( _currentPanel->property( BCKeyHeaderLabel ).toString() );
|
||||||
|
_stackedWidget->setCurrentWidget( nxtPanel );
|
||||||
|
|
||||||
// knopf auch abschalten?
|
// knopf auch abschalten?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,12 +231,6 @@ void BCMainWindow::onValueUpdated(BCDevice::ID deviceID, int index, BC::State st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BCMainWindow::onRunnerMessage(const QString &msg)
|
|
||||||
{
|
|
||||||
qDebug() << "[Worker says]:" << msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// __fix move this to devicePanel??
|
// __fix move this to devicePanel??
|
||||||
void BCMainWindow::onSyncFromDevice()
|
void BCMainWindow::onSyncFromDevice()
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ public:
|
|||||||
BCMainWindow(QWidget *parent = nullptr);
|
BCMainWindow(QWidget *parent = nullptr);
|
||||||
virtual ~BCMainWindow();
|
virtual ~BCMainWindow();
|
||||||
|
|
||||||
|
void setHeaderLabel( const QString& headerText);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
//void onValueListReady( BCDevice::ID deviceID );
|
//void onValueListReady( BCDevice::ID deviceID );
|
||||||
@@ -59,7 +61,6 @@ public slots:
|
|||||||
|
|
||||||
// Slots für Rückmeldungen vom Runner
|
// Slots für Rückmeldungen vom Runner
|
||||||
void onValueUpdated( BCDevice::ID deviceID, int index, BC::State state, const QString& newValue="" );
|
void onValueUpdated( BCDevice::ID deviceID, int index, BC::State state, const QString& newValue="" );
|
||||||
void onRunnerMessage(const QString &msg);
|
|
||||||
void onSyncFromDevice();
|
void onSyncFromDevice();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -84,6 +85,9 @@ protected:
|
|||||||
|
|
||||||
QThread _worker;
|
QThread _worker;
|
||||||
BCTransmitter _transmitter;
|
BCTransmitter _transmitter;
|
||||||
|
|
||||||
|
static constexpr const char* BCKeyHeaderLabel = "BCHeaderLabel";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BCMAINWINDOW_H
|
#endif // BCMAINWINDOW_H
|
||||||
|
|||||||
@@ -23,8 +23,23 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="_headerLabel">
|
<widget class="QLabel" name="_headerLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>45</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>-2</number>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bionx Control</string>
|
<string> Bionx Control</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -190,6 +205,12 @@
|
|||||||
<property name="gridStyle">
|
<property name="gridStyle">
|
||||||
<enum>Qt::PenStyle::NoPen</enum>
|
<enum>Qt::PenStyle::NoPen</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="BCHeaderLabel" stdset="0">
|
||||||
|
<string>Console Settings</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
@@ -213,6 +234,12 @@
|
|||||||
<property name="gridStyle">
|
<property name="gridStyle">
|
||||||
<enum>Qt::PenStyle::NoPen</enum>
|
<enum>Qt::PenStyle::NoPen</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="BCHeaderLabel" stdset="0">
|
||||||
|
<string>Motor Settings</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
@@ -236,6 +263,12 @@
|
|||||||
<property name="gridStyle">
|
<property name="gridStyle">
|
||||||
<enum>Qt::PenStyle::NoPen</enum>
|
<enum>Qt::PenStyle::NoPen</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="BCHeaderLabel" stdset="0">
|
||||||
|
<string>Battery Settings</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
@@ -259,6 +292,12 @@
|
|||||||
<property name="gridStyle">
|
<property name="gridStyle">
|
||||||
<enum>Qt::PenStyle::NoPen</enum>
|
<enum>Qt::PenStyle::NoPen</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="BCHeaderLabel" stdset="0">
|
||||||
|
<string>Pimp my Ride ...</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|||||||
@@ -44,14 +44,6 @@ BCValueModel::BCValueModel(QObject *parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setzt den Headerlabel ( == die Devicebezeichnung )
|
|
||||||
* @param headerLabel
|
|
||||||
*/
|
|
||||||
void BCValueModel::setHeaderLabel( const QString& headerLabel )
|
|
||||||
{
|
|
||||||
_headerLabel = headerLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Einen Einzelwert hinzufügen
|
* @brief Einen Einzelwert hinzufügen
|
||||||
@@ -147,17 +139,6 @@ int BCValueModel::columnCount(const QModelIndex& parent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gibt die Header-Einträge zurück
|
|
||||||
*/
|
|
||||||
|
|
||||||
QVariant BCValueModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|
||||||
{
|
|
||||||
if (role != Qt::DisplayRole || orientation != Qt::Horizontal || section != 0)
|
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
return _headerLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ public:
|
|||||||
|
|
||||||
explicit BCValueModel(QObject *parent = nullptr);
|
explicit BCValueModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
void setHeaderLabel( const QString& headerLabel );
|
|
||||||
|
|
||||||
void addValue(const BCValue& val);
|
void addValue(const BCValue& val);
|
||||||
void takeValueList(BCValueList& valueList);
|
void takeValueList(BCValueList& valueList);
|
||||||
const BCValueList& getValueList() const;
|
const BCValueList& getValueList() const;
|
||||||
@@ -62,7 +60,7 @@ public:
|
|||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
//QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
// Nötig für Editierbarkeit
|
// Nötig für Editierbarkeit
|
||||||
@@ -75,7 +73,6 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
QString _headerLabel;
|
|
||||||
// Die eigentlichen Werte wohnen im tatsächlich hier, im Model.
|
// Die eigentlichen Werte wohnen im tatsächlich hier, im Model.
|
||||||
BCValueList _valueList;
|
BCValueList _valueList;
|
||||||
|
|
||||||
|
|||||||
3
main.cpp
3
main.cpp
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
setApplicationStyleSheet( ":/claude_dark_mode.qss"_L1 );
|
//setApplicationStyleSheet( ":/claude_light_mode.qss"_L1 );
|
||||||
/*
|
/*
|
||||||
app.setStyleSheet(R"(
|
app.setStyleSheet(R"(
|
||||||
QWidget {
|
QWidget {
|
||||||
@@ -81,4 +81,5 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
||||||
|
// 🌙☀️ !
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user