Skip to content

Commit

Permalink
fix: use QStyle::PM_CheckBoxLabelSpacing
Browse files Browse the repository at this point in the history
  • Loading branch information
ouuan committed Jul 6, 2021
1 parent 855c6ff commit 4d784c3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Widgets/RichTextCheckBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "Widgets/RichTextCheckBox.hpp"
#include "Core/EventLogger.hpp"
#include "generated/SettingsHelper.hpp"
#include <QDesktopServices>
#include <QHBoxLayout>
#include <QMouseEvent>
Expand Down Expand Up @@ -69,7 +68,7 @@ void ClickableLabel::mouseMoveEvent(QMouseEvent *event)

HoverCheckBox::HoverCheckBox(QWidget *parent) : QCheckBox(parent)
{
setStyleSheet("QCheckBox{spacing:4px;}");
setStyleSheet("QCheckBox{spacing:0px;}");
}

void HoverCheckBox::paintEvent(QPaintEvent * /*unused*/)
Expand Down Expand Up @@ -124,13 +123,7 @@ RichTextCheckBox::RichTextCheckBox(const QString &text, QWidget *parent) : QWidg
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(checkBox);
#ifdef Q_OS_MACOS
QString currentStyle = SettingsHelper::getUIStyle();
if (currentStyle == "macintosh" || currentStyle == "default")
{
layout->addSpacing(5);
}
#endif
layout->addSpacing(style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing));
layout->addWidget(label);
layout->setAlignment(Qt::AlignLeft);
connect(label, &ClickableLabel::released, checkBox, &HoverCheckBox::toggle);
Expand Down

0 comments on commit 4d784c3

Please sign in to comment.