Skip to content

Commit

Permalink
more general fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei47w committed Sep 19, 2024
1 parent 7810dcb commit 7b92ab7
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 20 deletions.
5 changes: 3 additions & 2 deletions gui/src/stylehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void StyleHelper::initColorMap()
sh->colorMap.insert("WarningText", "#FFC904");
sh->colorMap.insert("GrayText", Style::getAttribute(json::theme::interactive_subtle_idle));
sh->colorMap.insert("SH_focus", Style::getAttribute(json::theme::content_inverse));
sh->colorMap.insert("stuff", Style::getAttribute(json::theme::background_subtle));
}

QString StyleHelper::getChannelColor(int index)
Expand Down Expand Up @@ -1039,7 +1040,7 @@ void StyleHelper::MenuCollapseHeaderLineEdit(QLineEdit *w, QString objectName)
QLineEdit {
color: white;
background-color: rgba(255,255,255,0);
font-weight: 500;
font-weight: 800;
font-family: Open Sans;
font-size: 14px;
font-style: normal;
Expand Down Expand Up @@ -1140,7 +1141,7 @@ void StyleHelper::HoverWidget(QWidget *w, bool draggable, QString objectName)

if(draggable) {
style.replace("&&Background&&", StyleHelper::getColor("UIElementBackground"));
style.replace("&&HoverBackground&&", StyleHelper::getColor("UIElementHighlight"));
style.replace("&&HoverBackground&&", StyleHelper::getColor("stuff"));
} else {
style.replace("&&Background&&", "transparent");
style.replace("&&HoverBackground&&", "transparent");
Expand Down
4 changes: 4 additions & 0 deletions gui/src/widgets/cursorsettings.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <QVBoxLayout>
#include <style.h>

#include <stylehelper.h>
#include <widgets/cursorsettings.h>
Expand Down Expand Up @@ -26,6 +27,7 @@ void CursorSettings::initUI()

// x controls
xControls = new MenuSectionWidget(this);
Style::setStyle(xControls, style::properties::widget::border);
layout->addWidget(xControls);
xControls->contentLayout()->setSpacing(10);

Expand All @@ -39,6 +41,7 @@ void CursorSettings::initUI()

// y controls
yControls = new MenuSectionWidget(this);
Style::setStyle(yControls, style::properties::widget::border);
layout->addWidget(yControls);
yControls->contentLayout()->setSpacing(10);

Expand All @@ -50,6 +53,7 @@ void CursorSettings::initUI()

// readouts controls
readoutsControls = new MenuSectionWidget(this);
Style::setStyle(readoutsControls, style::properties::widget::border);
layout->addWidget(readoutsControls);

readoutsDrag = new MenuOnOffSwitch(tr("Move readouts"), readoutsControls, false);
Expand Down
4 changes: 4 additions & 0 deletions gui/src/widgets/measurementpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QGridLayout>
#include <QScrollArea>
#include <QWidget>
#include <style.h>

#include <measurementlabel.h>

Expand Down Expand Up @@ -60,6 +61,8 @@ MeasurementsPanel::MeasurementsPanel(QWidget *parent)
int idx = panelLayout->indexOf(spacer);
m_stacks.append(new VerticalWidgetStack(stackSize, this));
panelLayout->insertWidget(idx, m_stacks.last());

setStyleSheet("background-color: " + Style::getAttribute(json::theme::background_subtle));
}

void MeasurementsPanel::addWidget(QWidget *meas)
Expand Down Expand Up @@ -208,6 +211,7 @@ StatsPanel::StatsPanel(QWidget *parent)

panelLayout->setAlignment(Qt::AlignLeft);
lay->addWidget(scrollArea);
setStyleSheet("background-color: " + Style::getAttribute(json::theme::background_subtle));
}

StatsPanel::~StatsPanel() {}
Expand Down
4 changes: 4 additions & 0 deletions gui/src/widgets/measurementsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <widgets/menuonoffswitch.h>
#include <widgets/menusectionwidget.h>
#include <style.h>

using namespace scopy;

Expand All @@ -14,6 +15,7 @@ MeasurementSettings::MeasurementSettings(QWidget *parent)
lay->setMargin(0);

measureSection = new MenuSectionWidget(this);
Style::setStyle(measureSection, style::properties::widget::border);
measurePanelSwitch = new MenuOnOffSwitch("Measure Panel", this);
measurePanelSwitch->onOffswitch()->setChecked(true);
QHBoxLayout *hlay1 = new QHBoxLayout();
Expand Down Expand Up @@ -74,6 +76,7 @@ MeasurementSettings::MeasurementSettings(QWidget *parent)
hlay2->addWidget(measureSortByType);

statsSection = new MenuSectionWidget(this);
Style::setStyle(statsSection, style::properties::widget::border);
statsPanelSwitch = new MenuOnOffSwitch("Stats Panel", this);
connect(statsPanelSwitch->onOffswitch(), &QAbstractButton::toggled, this,
[=](bool b) { Q_EMIT enableStatsPanel(b); });
Expand Down Expand Up @@ -139,6 +142,7 @@ MeasurementSettings::MeasurementSettings(QWidget *parent)
hlay4->addWidget(statsSortByType);

markerSection = new MenuSectionWidget(this);
Style::setStyle(markerSection, style::properties::widget::border);
markerPanelSwitch = new MenuOnOffSwitch("Marker Panel", this);
connect(markerPanelSwitch->onOffswitch(), &QAbstractButton::toggled, this,
[=](bool b) { Q_EMIT enableMarkerPanel(b); });
Expand Down
2 changes: 1 addition & 1 deletion gui/src/widgets/menucollapsesection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ MenuCollapseSection::MenuCollapseSection(QString title, MenuCollapseSection::Men
m_contLayout = new QVBoxLayout(container);
container->setLayout(m_contLayout);
m_contLayout->setMargin(0);
m_contLayout->setSpacing(0);
m_contLayout->setSpacing(10);

connect(m_header, &QAbstractButton::toggled, container, &QWidget::setVisible);
}
Expand Down
38 changes: 21 additions & 17 deletions gui/src/widgets/menuspinbox.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "menuspinbox.h"
#include <style.h>
#include <stylehelper.h>

namespace scopy {
Expand All @@ -12,8 +13,8 @@ MenuSpinbox::MenuSpinbox(QString name, double val, QString unit, double min, dou
m_label = new QLabel(name, parent);
m_edit = new QLineEdit("0", parent);
m_scaleCb = new QComboBox(parent);
m_plus = new QPushButton("+", parent);
m_minus = new QPushButton("-", parent);
m_plus = new QPushButton(parent);
m_minus = new QPushButton(parent);

m_plus->setAutoRepeat(true);
m_plus->setAutoRepeatDelay(300);
Expand Down Expand Up @@ -90,7 +91,6 @@ void MenuSpinbox::layoutVertically(bool left)
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Plain);
editLay->addWidget(line);
StyleHelper::MenuSpinboxLine(line);
editLay->addWidget(m_scaleCb);

if(left) {
Expand All @@ -101,14 +101,16 @@ void MenuSpinbox::layoutVertically(bool left)
lay->addLayout(btnLay);
}

StyleHelper::MenuSpinboxLabel(m_label);
StyleHelper::MenuSpinboxLineEdit(m_edit);
StyleHelper::MenuSpinComboBox(m_scaleCb);
int size = Style::getDimension(json::global::unit_3);
m_plus->setIcon(
Style::getPixmap(":/gui/icons/plus.svg", Style::getColor(json::theme::content_inverse)));
Style::setStyle(m_plus, style::properties::button::basicButton);
m_plus->setFixedSize(size, size);

StyleHelper::SpinBoxUpButton(m_plus, "plus_btn");
m_plus->setFixedSize(30, 30);
StyleHelper::SpinBoxDownButton(m_minus, "minus_btn");
m_minus->setFixedSize(30, 30);
m_minus->setIcon(
Style::getPixmap(":/gui/icons/minus.svg", Style::getColor(json::theme::content_inverse)));
Style::setStyle(m_minus, style::properties::button::basicButton);
m_minus->setFixedSize(size, size);
}

void MenuSpinbox::layoutHorizontally(bool left)
Expand Down Expand Up @@ -147,14 +149,16 @@ void MenuSpinbox::layoutHorizontally(bool left)
lay->addLayout(btnLay);
}

StyleHelper::MenuSmallLabel(m_label);
StyleHelper::MenuLineEdit(m_edit);
StyleHelper::MenuComboBox(m_scaleCb);
int size = Style::getDimension(json::global::unit_3);
m_plus->setIcon(
Style::getPixmap(":/gui/icons/plus.svg", Style::getColor(json::theme::content_inverse)));
Style::setStyle(m_plus, style::properties::button::basicButton);
m_plus->setFixedSize(size, size);

StyleHelper::SpinBoxUpButton(m_plus, "plus_btn");
m_plus->setFixedSize(30, 30);
StyleHelper::SpinBoxDownButton(m_minus, "minus_btn");
m_minus->setFixedSize(30, 30);
m_minus->setIcon(
Style::getPixmap(":/gui/icons/minus.svg", Style::getColor(json::theme::content_inverse)));
Style::setStyle(m_minus, style::properties::button::basicButton);
m_minus->setFixedSize(size, size);
}

double MenuSpinbox::value() const { return m_value; }
Expand Down
1 change: 1 addition & 0 deletions gui/style/qss/generic/global.qss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
color: &content_default&;
font-family: Arial, sans-serif;
font-size: &font_size&;
font-weight: 400;
}

*:focus {
Expand Down
1 change: 1 addition & 0 deletions plugins/adc/src/measurecomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MeasureComponent::MeasureComponent(ToolTemplate *tool, MeasurementPanelInterface
measurePanelManagerHover->setContent(m_measureSettings);
measurePanelManagerHover->setAnchorPos(HoverPosition::HP_TOPRIGHT);
measurePanelManagerHover->setContentPos(HoverPosition::HP_TOPLEFT);
measurePanelManagerHover->setAnchorOffset(QPoint(0, -10));
connect(measure->button(), &QPushButton::toggled, this, [=](bool b) {
measurePanelManagerHover->setVisible(b);
measurePanelManagerHover->raise();
Expand Down

0 comments on commit 7b92ab7

Please sign in to comment.