summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ToolTipControls/ToolTipCheckBox.cpp
blob: c2d4bb753b3e9b0417361e5630fef449d8f79692 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2020 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"

#include <QStyle>
#include <QStyleOption>

ToolTipCheckBox::ToolTipCheckBox(const QString& label) : ToolTipWidget(label)
{
  SetTitle(label);
}

QPoint ToolTipCheckBox::GetToolTipPosition() const
{
  int checkbox_width = 18;
  if (style())
  {
    QStyleOptionButton opt;
    initStyleOption(&opt);
    checkbox_width =
        style()->subElementRect(QStyle::SubElement::SE_CheckBoxIndicator, &opt, this).width();
  }

  return pos() + QPoint(checkbox_width / 2, height() / 2);
}