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