| 1 | // Copyright 2020 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h" |
| 5 | |
| 6 | #include <QStyle> |
| 7 | #include <QStyleOption> |
| 8 | |
| 9 | ToolTipSlider::ToolTipSlider(Qt::Orientation orientation) : ToolTipWidget(orientation) |
| 10 | { |
| 11 | } |
| 12 | |
| 13 | QPoint ToolTipSlider::GetToolTipPosition() const |
| 14 | { |
| 15 | QRect handle_rect(0, 0, 15, 15); |
| 16 | if (style()) |
| 17 | { |
| 18 | QStyleOptionSlider opt; |
| 19 | initStyleOption(&opt); |
| 20 | handle_rect = style()->subControlRect(QStyle::ComplexControl::CC_Slider, &opt, |
| 21 | QStyle::SubControl::SC_SliderHandle, this); |
| 22 | } |
| 23 | |
| 24 | return pos() + handle_rect.center(); |
| 25 | } |