mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-05-13 21:02:24 -04:00
freqdisplay: make only the display area transparent, not the settings bar
Agent-Logs-Url: https://github.com/srcejon/sdrangel/sessions/b295b0a4-ffcc-41dc-9e86-f204ec06d389 Co-authored-by: srcejon <57259258+srcejon@users.noreply.github.com>
This commit is contained in:
parent
8e87c391cf
commit
081f4d5644
@ -18,9 +18,6 @@ constexpr int minimumFrequencyFontPointSize = 10;
|
||||
// Reference point size used when probing text metrics in updateFrequencyFont().
|
||||
// Large enough that integer rounding in QFontMetrics is negligible.
|
||||
constexpr int fontProbePointSize = 200;
|
||||
// Stylesheet applied to this window when transparency is enabled.
|
||||
// The '*' universal selector cascades to every child widget.
|
||||
constexpr const char* transparentStyleSheet = "* { background: transparent; border: none; }";
|
||||
}
|
||||
|
||||
FreqDisplayGUI* FreqDisplayGUI::create(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature)
|
||||
@ -367,23 +364,14 @@ void FreqDisplayGUI::updateFrequencyFont()
|
||||
|
||||
void FreqDisplayGUI::applyTransparency()
|
||||
{
|
||||
if (m_settings.m_transparentBackground)
|
||||
{
|
||||
// Override the FeatureGUI stylesheet on the entire window using the '*'
|
||||
// universal selector so that every child widget's background is also
|
||||
// cleared. Combined with WA_TranslucentBackground (set in the constructor)
|
||||
// this makes the sub-window show whatever is rendered behind it in the
|
||||
// MDI area instead of the normal solid background.
|
||||
setStyleSheet(transparentStyleSheet);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restore the stylesheet that FeatureGUI set at construction time.
|
||||
setStyleSheet(m_normalStyleSheet);
|
||||
// Also clear any per-widget overrides from previous transparent runs.
|
||||
ui->settingsContainer->setStyleSheet(QString());
|
||||
ui->frequencyValue->setStyleSheet(QString());
|
||||
}
|
||||
// Always keep the window-level stylesheet and the settings bar looking normal.
|
||||
setStyleSheet(m_normalStyleSheet);
|
||||
ui->settingsContainer->setStyleSheet(QString());
|
||||
|
||||
// Apply or remove transparency on the display area only.
|
||||
const QString displayStyle = m_settings.m_transparentBackground ? "background: transparent;" : QString();
|
||||
ui->horizontalWidget->setStyleSheet(displayStyle);
|
||||
ui->frequencyValue->setStyleSheet(displayStyle);
|
||||
}
|
||||
|
||||
void FreqDisplayGUI::on_displayMode_currentIndexChanged(int index)
|
||||
|
||||
@ -124,7 +124,7 @@
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="transparentBackground">
|
||||
<property name="toolTip">
|
||||
<string>Toggle transparent window background</string>
|
||||
<string>Toggle transparent background for the display area</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>T</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user