Skip to content

Commit

Permalink
Add spacing between widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
shermp committed Jul 13, 2023
1 parent 58d3314 commit 0c8588b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nickelclock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ static void set_extra_props(QWidget* w) {
NC::NC(QRect const& screenGeom)
: QObject(nullptr),
settings(screenGeom),
footerMarginRe("qproperty-footerMargin:\\s*\\d+;")
footerMarginRe("qproperty-footerMargin:\\s*\\d+;"),
scrGeom(screenGeom)
{
getFooterStylesheet();
createNCLabelStylesheet();
Expand Down Expand Up @@ -176,6 +177,9 @@ void NC::addItemsToFooter(ReadingView *rv)
// Set the stretch value of the existing caption
layout->setStretch(0, 2);
setFooterStylesheet(rf);
// Add some spacing between widgets (as a percentage of screen width)
auto spacing = static_cast<int>(std::round(scrGeom.width() * 0.015f));
layout->setSpacing(spacing);
// Both clock & battery in the same postion and placement is not allowed
if (settings.clockInPlacement(p) && settings.batteryInPlacement(p)
&& settings.clockPosition() == settings.batteryPosition()) {
Expand Down
1 change: 1 addition & 0 deletions src/nickelclock.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class NC : public QObject
QString ncLblStylesheet;
QRegularExpression footerMarginRe;
QString batteryCapFilename;
QRect scrGeom;
void updateFooterMargins(QLayout *layout);
void getFooterStylesheet();
void createNCLabelStylesheet();
Expand Down

0 comments on commit 0c8588b

Please sign in to comment.