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 Factor = "Factor"_L1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#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 )
|
||||
{
|
||||
@@ -72,12 +67,7 @@ const BCValueList& BCDeviceView::getValueListX()
|
||||
return _valueModel.getValueList();
|
||||
}
|
||||
|
||||
/*
|
||||
BCValueModel& BCDeviceView::getValueModel()
|
||||
{
|
||||
return _valueModel;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// __FIX ist das ok so?
|
||||
void BCDeviceView::onValueListReady( BCDevice::ID deviceID, BCValueList valueList )
|
||||
|
||||
@@ -48,7 +48,6 @@ public:
|
||||
|
||||
explicit BCDeviceView(QWidget *parent = nullptr);
|
||||
|
||||
void setHeaderLabel( const QString& headerText);
|
||||
|
||||
void setDeviceID( BCDevice::ID deviceID );
|
||||
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.
|
||||
*/
|
||||
@@ -75,7 +85,7 @@ BCMainWindow::~BCMainWindow()
|
||||
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
|
||||
button->setDefaultAction( action);
|
||||
@@ -92,8 +102,6 @@ void BCMainWindow::initMainWindow()
|
||||
if( _devicePanels.contains(deviceID) )
|
||||
{
|
||||
BCDeviceView* currentPanel = _devicePanels[deviceID];
|
||||
// den Panels ihren title geben
|
||||
currentPanel->setHeaderLabel( panelTitle );
|
||||
// ... und ihre device ID
|
||||
currentPanel->setDeviceID( deviceID );
|
||||
// Wenn ein Device (entspricht einem Datenmodel) fertig eingelesen wurde,
|
||||
@@ -109,10 +117,10 @@ void BCMainWindow::initMainWindow()
|
||||
_devicePanels[BCDevice::ID::Motor] = _motorPanel;
|
||||
|
||||
// Die actions an die Buttons binden
|
||||
configureAction(_motorButton, _motorAction, BCDevice::ID::Motor, "Motor Settings"_L1 );
|
||||
configureAction(_consoleButton, _consoleAction, BCDevice::ID::Console, "Console Settings"_L1 );
|
||||
configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery, "Battery Settings"_L1 );
|
||||
configureAction(_pimpButton, _pimpAction, BCDevice::ID::Pimp, "Pimp my Ride"_L1 );
|
||||
configureAction(_motorButton, _motorAction, BCDevice::ID::Motor );
|
||||
configureAction(_consoleButton, _consoleAction, BCDevice::ID::Console );
|
||||
configureAction(_batteryButton, _batteryAction, BCDevice::ID::Battery );
|
||||
configureAction(_pimpButton, _pimpAction, BCDevice::ID::Pimp );
|
||||
|
||||
/*
|
||||
|
||||
@@ -186,8 +194,11 @@ void BCMainWindow::onShowDevicePanel( BCDevice::ID deviceID )
|
||||
BCDeviceView* nxtPanel = _devicePanels[deviceID];
|
||||
if( nxtPanel != _currentPanel )
|
||||
{
|
||||
_stackedWidget->setCurrentWidget( nxtPanel );
|
||||
_currentPanel = nxtPanel;
|
||||
qDebug() << " --- Firz: " << _currentPanel->property( BCKeyHeaderLabel );
|
||||
setHeaderLabel( _currentPanel->property( BCKeyHeaderLabel ).toString() );
|
||||
_stackedWidget->setCurrentWidget( nxtPanel );
|
||||
|
||||
// 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??
|
||||
void BCMainWindow::onSyncFromDevice()
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
BCMainWindow(QWidget *parent = nullptr);
|
||||
virtual ~BCMainWindow();
|
||||
|
||||
void setHeaderLabel( const QString& headerText);
|
||||
|
||||
public slots:
|
||||
|
||||
//void onValueListReady( BCDevice::ID deviceID );
|
||||
@@ -59,7 +61,6 @@ public slots:
|
||||
|
||||
// Slots für Rückmeldungen vom Runner
|
||||
void onValueUpdated( BCDevice::ID deviceID, int index, BC::State state, const QString& newValue="" );
|
||||
void onRunnerMessage(const QString &msg);
|
||||
void onSyncFromDevice();
|
||||
|
||||
signals:
|
||||
@@ -84,6 +85,9 @@ protected:
|
||||
|
||||
QThread _worker;
|
||||
BCTransmitter _transmitter;
|
||||
|
||||
static constexpr const char* BCKeyHeaderLabel = "BCHeaderLabel";
|
||||
|
||||
};
|
||||
|
||||
#endif // BCMAINWINDOW_H
|
||||
|
||||
@@ -23,6 +23,21 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<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">
|
||||
<string> Bionx Control</string>
|
||||
</property>
|
||||
@@ -190,6 +205,12 @@
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::PenStyle::NoPen</enum>
|
||||
</property>
|
||||
<property name="BCHeaderLabel" stdset="0">
|
||||
<string>Console Settings</string>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
@@ -213,6 +234,12 @@
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::PenStyle::NoPen</enum>
|
||||
</property>
|
||||
<property name="BCHeaderLabel" stdset="0">
|
||||
<string>Motor Settings</string>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
@@ -236,6 +263,12 @@
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::PenStyle::NoPen</enum>
|
||||
</property>
|
||||
<property name="BCHeaderLabel" stdset="0">
|
||||
<string>Battery Settings</string>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
@@ -259,6 +292,12 @@
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::PenStyle::NoPen</enum>
|
||||
</property>
|
||||
<property name="BCHeaderLabel" stdset="0">
|
||||
<string>Pimp my Ride ...</string>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</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
|
||||
@@ -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);
|
||||
|
||||
void setHeaderLabel( const QString& headerLabel );
|
||||
|
||||
void addValue(const BCValue& val);
|
||||
void takeValueList(BCValueList& valueList);
|
||||
const BCValueList& getValueList() const;
|
||||
@@ -62,7 +60,7 @@ public:
|
||||
int rowCount(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;
|
||||
|
||||
// Nötig für Editierbarkeit
|
||||
@@ -75,7 +73,6 @@ public slots:
|
||||
|
||||
protected:
|
||||
|
||||
QString _headerLabel;
|
||||
// Die eigentlichen Werte wohnen im tatsächlich hier, im Model.
|
||||
BCValueList _valueList;
|
||||
|
||||
|
||||
3
main.cpp
3
main.cpp
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
QApplication app(argc, argv);
|
||||
setApplicationStyleSheet( ":/claude_dark_mode.qss"_L1 );
|
||||
//setApplicationStyleSheet( ":/claude_light_mode.qss"_L1 );
|
||||
/*
|
||||
app.setStyleSheet(R"(
|
||||
QWidget {
|
||||
@@ -81,4 +81,5 @@ int main(int argc, char *argv[])
|
||||
|
||||
return app.exec();
|
||||
|
||||
// 🌙☀️ !
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user