| 1 | // Copyright 2020 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h" |
| 5 | |
| 6 | #include <QStyle> |
| 7 | #include <QStyleOption> |
| 8 | |
| 9 | ToolTipCheckBox::ToolTipCheckBox(const QString& label) : ToolTipWidget(label) |
| 10 | { |
| 11 | SetTitle(label); |
| 12 | } |
| 13 | |
| 14 | QPoint ToolTipCheckBox::GetToolTipPosition() const |
| 15 | { |
| 16 | int checkbox_width = 18; |
| 17 | if (style()) |
| 18 | { |
| 19 | QStyleOptionButton opt; |
| 20 | initStyleOption(&opt); |
| 21 | checkbox_width = |
| 22 | style()->subElementRect(QStyle::SubElement::SE_CheckBoxIndicator, &opt, this).width(); |
| 23 | } |
| 24 | |
| 25 | return pos() + QPoint(checkbox_width / 2, height() / 2); |
| 26 | } |