mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Ref T573, allow different color in XPDR mode component from stylesheet
* changed signal to trigger reload of stylesheet (only way to update dynamic properties) * made infobar left aligned (and not spacer aligned), better scaling * adjusted qss
This commit is contained in:
committed by
Mat Sutcliffe
parent
22d67d31a4
commit
e463689490
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "blackgui/components/infobarstatuscomponent.h"
|
||||
#include "blackgui/components/transpondermodecomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/led.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
@@ -49,7 +50,8 @@ namespace BlackGui
|
||||
this->adjustTextSize();
|
||||
|
||||
ui->lbl_Audio->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->lbl_Audio, &QLabel::customContextMenuRequested, this, &CInfoBarStatusComponent::onCustomAudioContextMenuRequested);
|
||||
connect(ui->lbl_Audio, &QLabel::customContextMenuRequested, this, &CInfoBarStatusComponent::onCustomAudioContextMenuRequested);
|
||||
connect(ui->comp_XpdrMode, &CTransponderModeComponent::changed, this, &CInfoBarStatusComponent::transponderModeChanged);
|
||||
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
|
||||
if (sGui->getIContextSimulator())
|
||||
|
||||
@@ -48,14 +48,18 @@ namespace BlackGui
|
||||
//! Set the spacing
|
||||
void setSpacing(int spacing);
|
||||
|
||||
signals:
|
||||
//! Mode changed
|
||||
void transponderModeChanged();
|
||||
|
||||
protected:
|
||||
//! \copydoc QWidget::resizeEvent
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CInfoBarStatusComponent> ui;
|
||||
BlackCore::CActionBind m_actionPtt { "/Voice/Activate push-to-talk", BlackMisc::CIcons::radio16(), this, &CInfoBarStatusComponent::onPttChanged };
|
||||
BlackMisc::CDigestSignal m_dsResize { this, &CInfoBarStatusComponent::adjustTextSize, 1000, 25 };
|
||||
BlackCore::CActionBind m_actionPtt { "/Voice/Activate push-to-talk", BlackMisc::CIcons::radio16(), this, &CInfoBarStatusComponent::onPttChanged };
|
||||
BlackMisc::CDigestSignal m_dsResize { this, &CInfoBarStatusComponent::adjustTextSize, 1000, 50 };
|
||||
|
||||
//! Init the LEDs
|
||||
void initLeds();
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<ui version="4.0">
|
||||
<class>CInfoBarStatusComponent</class>
|
||||
<widget class="QFrame" name="CInfoBarStatusComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>201</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@@ -153,19 +161,6 @@
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="BlackGui::CLedWidget" name="led_Audio" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_StatusComponent">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -57,6 +57,8 @@ namespace BlackGui
|
||||
|
||||
this->setProperty("xpdrmode", m_transponder.getTransponderMode());
|
||||
this->setProperty("xpdrmodeshort", m_transponder.getModeAsShortString());
|
||||
ui->tb_TransponderMode->setProperty("xpdrmode", m_transponder.getTransponderMode());
|
||||
ui->tb_TransponderMode->setProperty("xpdrmodeshort", m_transponder.getModeAsShortString());
|
||||
|
||||
this->setToolTip(m_transponder.toQString());
|
||||
}
|
||||
@@ -75,6 +77,7 @@ namespace BlackGui
|
||||
if (m_transponder == aircraft.getTransponder()) { return; }
|
||||
m_transponder = aircraft.getTransponder();
|
||||
this->init();
|
||||
emit this->changed();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace BlackGui
|
||||
//! Dtor
|
||||
virtual ~CTransponderModeComponent() override;
|
||||
|
||||
signals:
|
||||
//! value has been changed
|
||||
void changed();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CTransponderModeComponent> ui;
|
||||
BlackMisc::Aviation::CTransponder m_transponder;
|
||||
|
||||
@@ -31,6 +31,9 @@ namespace BlackGui
|
||||
//! Constructor
|
||||
explicit CDockWidgetInfoBar(QWidget *parent = nullptr);
|
||||
|
||||
//! Force an reload
|
||||
void reloadStyleSheet() { this->onStyleSheetsChanged(); }
|
||||
|
||||
protected:
|
||||
//! Contribute to menu
|
||||
virtual void addToContextMenu(QMenu *contextMenu) const override;
|
||||
|
||||
@@ -18,6 +18,21 @@ BlackGui--Components--CTransponderModeComponent {
|
||||
min-height: 2em;
|
||||
}
|
||||
|
||||
QToolButton[xpdrmodeshort="I"] {
|
||||
background-color: yellow;
|
||||
color: black;
|
||||
}
|
||||
|
||||
QToolButton[xpdrmodeshort="C"] {
|
||||
background-color: green;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QToolButton[xpdrmodeshort="S"] {
|
||||
background-color: blue;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
BlackGui--Components--CInfoBarStatusComponent {
|
||||
padding-left: 1.0em;
|
||||
padding-right: 1.0em;
|
||||
|
||||
Reference in New Issue
Block a user