Skip to content

Commit

Permalink
ScopyStatusBar: Visual improvements for the status bar
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei-Fabian-Pop <[email protected]>
  • Loading branch information
Andrei-Fabian-Pop committed Oct 17, 2023
1 parent 6767bff commit b803ccb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions core/src/scopymainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ ScopyMainWindow::ScopyMainWindow(QWidget *parent)

void ScopyMainWindow::initStatusBar()
{
// clear all margin, except the bottom one, to make room the status bar
int margin = ui->centralwidget->layout()->margin();
ui->centralwidget->layout()->setMargin(0);
ui->centralwidget->setContentsMargins(margin, margin, margin, 0);
ui->animHolder->setContentsMargins(0, 0, 0, margin); // the left panel should keep the margin

statusBar = new ScopyStatusBar(this);
ui->mainWidget->layout()->addWidget(statusBar);
}
Expand Down
17 changes: 15 additions & 2 deletions gui/src/widgets/scopystatusbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QLoggingCategory>
#include <QApplication>
#include <QTimer>
#include <QSizeGrip>

using namespace scopy;

Expand All @@ -28,7 +29,19 @@ ScopyStatusBar::ScopyStatusBar(QWidget *parent)
void ScopyStatusBar::initUi()
{
StyleHelper::ScopyStatusBar(this, "ScopyStatusBar");
m_historyButton = new QPushButton("History", this);

auto *sizeGrip = this->findChild<QSizeGrip *>();
if(sizeGrip) {
// hackish, but hide() and setVisible(false) do not work here
sizeGrip->setStyleSheet("width: 0; height: 0;");
}

m_historyButton = new QPushButton(this);
m_historyButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_historyButton->setFixedSize(20, 20);
m_historyButton->setStyleSheet("background-color: #272730");
m_historyButton->setIcon(QIcon(":/gui/icons/scopy-default/icons/tool_calibration.svg"));
m_historyButton->setIconSize(m_historyButton->size());
m_historyButton->setCheckable(true);
connect(m_historyButton, &QPushButton::toggled, this, &ScopyStatusBar::showHistory);

Expand All @@ -44,7 +57,7 @@ void ScopyStatusBar::initHistory()
m_hoverWidget->setObjectName("statusHover");
m_hoverWidget->setAnchorPos(HP_TOP);
m_hoverWidget->setContentPos(HP_TOPLEFT);
m_hoverWidget->setAnchorOffset(QPoint(45, -20));
m_hoverWidget->setAnchorOffset(QPoint(0, -20));
}

void ScopyStatusBar::shouldDisplayNewStatus()
Expand Down

0 comments on commit b803ccb

Please sign in to comment.