Skip to content

Commit

Permalink
gui: fixed detached tools background
Browse files Browse the repository at this point in the history
- fixed pqm and debugger mamrgins

Signed-off-by: Andrei Popa <[email protected]>
  • Loading branch information
andrei47w committed Nov 13, 2024
1 parent e504773 commit 95a8c24
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 34 deletions.
2 changes: 2 additions & 0 deletions core/src/detachedtoolwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <QHBoxLayout>
#include <QIcon>
#include <QLoggingCategory>
#include <style.h>

#include <pluginbase/preferences.h>

Expand All @@ -46,6 +47,7 @@ DetachedToolWindow::DetachedToolWindow(QWidget *parent, ToolMenuEntry *tme)

lay->addWidget(w);
loadToolGeometry(tme, this);
Style::setBackgroundColor(this, json::theme::background_primary, true);
tme->tool()->show();
show();
}
Expand Down
2 changes: 1 addition & 1 deletion gui/src/plotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ PlotWidget::PlotWidget(QWidget *parent)
setupPlotButtonManager();

m_plot->canvas()->installEventFilter(this);
Style::setBackgroundColor(m_plot, "transparent");
Style::setBackgroundColor(m_plot, QString("transparent"));
Style::setBackgroundColor(m_plot->canvas(), json::theme::background_plot, true);
}

Expand Down
2 changes: 1 addition & 1 deletion gui/src/tooltemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ToolTemplate::ToolTemplate(QWidget *parent)
m_rightStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_topStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_bottomStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
Style::setBackgroundColor(m_ui->leftContainer, "transparent");
Style::setBackgroundColor(m_ui->leftContainer, QString("transparent"));
Style::setBackgroundColor(m_ui->topContainerMenuControl, json::theme::background_primary);
}

Expand Down
2 changes: 1 addition & 1 deletion gui/src/widgets/hoverwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ HoverWidget::HoverWidget(QWidget *content, QWidget *anchor, QWidget *parent)
, m_relative(false)
, m_relativeOffset(nullptr)
{
Style::setBackgroundColor(this, json::theme::background_primary);
Style::setBackgroundColor(this, QString("transparent"), true);
m_lay = new QHBoxLayout(this);
m_lay->setSizeConstraint(QLayout::SetFixedSize);
m_lay->setContentsMargins(0, 0, 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion gui/src/widgets/menulineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QLineEdit *MenuLineEdit::edit() { return m_edit; }
void MenuLineEdit::applyStylesheet()
{
Style::setStyle(m_edit, style::properties::lineedit::menuLineEdit);
Style::setBackgroundColor(this, "transparent");
Style::setBackgroundColor(this, QString("transparent"));
}

#include "moc_menulineedit.cpp"
1 change: 0 additions & 1 deletion gui/src/widgets/plotinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ void PlotInfo::addCustomInfo(QWidget *info, InfoPosition hpos, InfoPosition vpos
QLabel *PlotInfo::addLabelInfo(InfoPosition hpos, InfoPosition vpos)
{
QLabel *label = new QLabel();
Style::setStyle(label, style::properties::label::plotInfo, true, true);
addCustomInfo(label, hpos, vpos);

return label;
Expand Down
5 changes: 0 additions & 5 deletions gui/src/widgets/plotinfowidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ HDivInfo::HDivInfo(PlotWidget *plot, QWidget *parent)
: m_mpf(new MetricPrefixFormatter(this))
, m_plot(plot)
{
Style::setStyle(this, style::properties::label::plotInfo, true, true);
m_mpf->setTrimZeroes(true);
m_mpf->setTwoDecimalMode(false);
connect(m_plot->navigator(), &PlotNavigator::rectChanged, this, &HDivInfo::onRectChanged);
Expand Down Expand Up @@ -76,7 +75,6 @@ void HDivInfo::update(double val, bool zoomed)
TimeSamplingInfo::TimeSamplingInfo(QWidget *parent)
: m_mpf(new MetricPrefixFormatter(this))
{
Style::setStyle(this, style::properties::label::plotInfo, true, true);
m_mpf->setTrimZeroes(true);
m_mpf->setTwoDecimalMode(false);
}
Expand All @@ -99,7 +97,6 @@ void TimeSamplingInfo::update(SamplingInfo info)
FFTSamplingInfo::FFTSamplingInfo(QWidget *parent)
: m_mpf(new MetricPrefixFormatter(this))
{
Style::setStyle(this, style::properties::label::plotInfo, true, true);
m_mpf->setTrimZeroes(true);
m_mpf->setTwoDecimalMode(false);
}
Expand Down Expand Up @@ -127,7 +124,6 @@ FPSInfo::FPSInfo(PlotWidget *plot, QWidget *parent)
, m_lastTimeStamp(0)
, m_avgSize(10)
{
Style::setStyle(this, style::properties::label::plotInfo, true, true);
setVisible(Preferences::GetInstance()->get("general_show_plot_fps").toBool());

connect(m_plot, &PlotWidget::newData, this, [=]() { update(QDateTime::currentMSecsSinceEpoch()); });
Expand Down Expand Up @@ -165,7 +161,6 @@ void FPSInfo::update(qint64 timestamp)

TimestampInfo::TimestampInfo(PlotWidget *plot, QWidget *parent)
{
Style::setStyle(this, style::properties::label::plotInfo, true, true);
connect(plot, &PlotWidget::newData, this,
[=]() { setText(QDateTime::currentDateTime().time().toString("hh:mm:ss")); });
}
Expand Down
32 changes: 16 additions & 16 deletions gui/style/qss/generic/m2k.qss
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ QPushButton[tool_launcher_custom_widget="true"] {
border: none;
background-color: none;
}
.QWidget[tool_launcher_custom_widget="true"]:hover {
QWidget[tool_launcher_custom_widget="true"]:hover {
background-color: #3C&color_inverse_hexcode&;
border: 1px solid #1E&color_inverse_hexcode&;
border-radius: 5px;
Expand All @@ -421,25 +421,25 @@ QWidget#stackedWidgetPage1 {
border-radius: 12px;
background-color: &background_subtle&;
}
.scopy--m2k--StackedHomepage#stackedWidget {
scopy--m2k--StackedHomepage#stackedWidget {
background-color: &background_subtle&;
}
QFrame[line_separator="true"] {
background-color: #13&color_default_hexcode&;
}
.scopy--m2k--PowerController #leftPanel,
.scopy--m2k--DMM #leftPanel {
scopy--m2k--PowerController #leftPanel,
scopy--m2k--DMM #leftPanel {
background-color: #28&color_inverse_hexcode&;
}
.scopy--m2k--Oscilloscope #mainWidget,
.scopy--m2k--SpectrumAnalyzer #mainWidget,
.scopy--m2k--NetworkAnalyzer #mainWidget,
.scopy--m2k--SignalGenerator #mainWidget,
.scopy--m2k--logic--LogicAnalyzer #mainWidget,
.scopy--m2k--logic--PatternGenerator #mainWidget,
.scopy--m2k--DigitalIO #widget,
.scopy--m2k--DMM #hLayout_top_btn_area_voltmeter,
.scopy--m2k--PowerController #hWidget_top_area {
scopy--m2k--Oscilloscope #mainWidget,
scopy--m2k--SpectrumAnalyzer #mainWidget,
scopy--m2k--NetworkAnalyzer #mainWidget,
scopy--m2k--SignalGenerator #mainWidget,
scopy--m2k--logic--LogicAnalyzer #mainWidget,
scopy--m2k--logic--PatternGenerator #mainWidget,
scopy--m2k--DigitalIO #widget,
scopy--m2k--DMM #hLayout_top_btn_area_voltmeter,
scopy--m2k--PowerController #hWidget_top_area {
background-color: qlineargradient(
spread: pad,
x1: 0,
Expand All @@ -451,8 +451,8 @@ QFrame[line_separator="true"] {
stop: 1 transparent
);
}
.scopy--m2k--ExportSettings #mainWidget,
.scopy--m2k--ImportSettings #mainWidget {
scopy--m2k--ExportSettings #mainWidget,
scopy--m2k--ImportSettings #mainWidget {
background-color: none;
}
scopy--CursorReadouts {
Expand Down Expand Up @@ -530,7 +530,7 @@ scopy--ChannelWidget QWidget#widget {
scopy--ChannelWidget QWidget#widget[selected="true"] {
background-color: #40&color_inverse_hexcode&;
}
.scopy--ChannelWidget QWidget#widget::hover {
scopy--ChannelWidget QWidget#widget::hover {
background-color: #20&color_inverse_hexcode&;
font-weight: bold;
border-bottom: 0px solid none;
Expand Down
4 changes: 0 additions & 4 deletions gui/style/qss/properties/label/plotInfo.qss

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/debugger/src/iioexplorer/iioexplorerinstrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void IIOExplorerInstrument::setupUi()
StyleHelper::SplitterStyle(m_VSplitter, "VerticalSplitter");

m_mainWidget->setLayout(new QVBoxLayout(m_mainWidget));
m_mainWidget->layout()->setContentsMargins(10, 10, 10, 10);
m_mainWidget->layout()->setContentsMargins(0, 0, 0, 0);

bottom_container->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
bottom_container->setLayout(new QHBoxLayout(bottom_container));
Expand Down
1 change: 1 addition & 0 deletions plugins/pqm/src/harmonicsinstrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ HarmonicsInstrument::HarmonicsInstrument(ToolMenuEntry *tme, QString uri, QWidge
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QHBoxLayout *instrumentLayout = new QHBoxLayout(this);
setLayout(instrumentLayout);
instrumentLayout->setMargin(0);
StyleHelper::GetInstance()->initColorMap();

ToolTemplate *tool = new ToolTemplate(this);
Expand Down
1 change: 1 addition & 0 deletions plugins/pqm/src/rmsinstrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ RmsInstrument::RmsInstrument(ToolMenuEntry *tme, QString uri, QWidget *parent)
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QHBoxLayout *instrumentLayout = new QHBoxLayout(this);
setLayout(instrumentLayout);
instrumentLayout->setMargin(0);
StyleHelper::GetInstance()->initColorMap();

ToolTemplate *tool = new ToolTemplate(this);
Expand Down
1 change: 1 addition & 0 deletions plugins/pqm/src/settingsinstrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SettingsInstrument::SettingsInstrument(QWidget *parent)
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QVBoxLayout *instrumentLayout = new QVBoxLayout(this);
setLayout(instrumentLayout);
instrumentLayout->setMargin(0);

ToolTemplate *tool = new ToolTemplate(this);
tool->topContainer()->setVisible(false);
Expand Down
1 change: 1 addition & 0 deletions plugins/pqm/src/waveforminstrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ WaveformInstrument::WaveformInstrument(ToolMenuEntry *tme, QString uri, QWidget
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QHBoxLayout *layout = new QHBoxLayout(this);
setLayout(layout);
layout->setMargin(0);
StyleHelper::GetInstance()->initColorMap();

m_plottingStrategy = PlottingStrategyBuilder::build("trigger", m_plotSampleRate);
Expand Down
4 changes: 1 addition & 3 deletions plugins/test/src/styletool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ QWidget *StyleTool::buildStylePage()
addLabeledWidget("Menu Small Label", new QLabel("Menu Small Label"));
addLabeledWidget("Subtle Label", new QLabel("Subtle Label"));
addLabeledWidget("Menu Medium Label", new QLabel("Menu Medium Label"));
addLabeledWidget("Plot Info Label", new QLabel("Plot Info Label"));

// Style the labels
Style::setStyle(layout->itemAt(i++)->widget()->layout()->itemAt(1)->widget(),
Expand All @@ -158,8 +157,7 @@ QWidget *StyleTool::buildStylePage()
true, true);
Style::setStyle(layout->itemAt(i++)->widget()->layout()->itemAt(1)->widget(),
style::properties::label::menuMedium, true, true);
Style::setStyle(layout->itemAt(i++)->widget()->layout()->itemAt(1)->widget(),
style::properties::label::plotInfo, true, true);


// Set the layout to the container widget
containerWidget->setLayout(layout);
Expand Down

0 comments on commit 95a8c24

Please sign in to comment.