dde-control-center
Deepin Control Center
载入中...
搜索中...
未找到
dccslider.h
1//SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
2//
3//SPDX-License-Identifier: GPL-3.0-or-later
4#pragma once
5
6#include "interface/namespace.h"
7#include <DSlider>
8namespace DCC_NAMESPACE {
9
10class DCCSlider : public DTK_WIDGET_NAMESPACE::DSlider
11{
12 Q_OBJECT
13public:
14 enum SliderType {
15 Normal,
16 Vernier,
17 Progress
18 };
19
20public:
21 explicit DCCSlider(SliderType type = Normal, QWidget *parent = nullptr);
22 explicit DCCSlider(Qt::Orientation orientation, QWidget *parent = nullptr);
23
24 inline DCCSlider *slider() const { return const_cast<DCCSlider *>(this); }
25 QSlider *qtSlider();
26
27 void setType(SliderType type);
28 void setRange(int min, int max);
29 void setTickPosition(QSlider::TickPosition tick);
30 void setTickInterval(int ti);
31 void setSliderPosition(int Position);
32 void setAnnotations(const QStringList &annotations);
33 void setOrientation(Qt::Orientation orientation);
34 //当value大于0时,在slider中插入一条分隔线
35 void setSeparateValue(int value = 0);
36
37protected:
38 void wheelEvent(QWheelEvent *e);
39 void paintEvent(QPaintEvent *e);
40private:
41 QSlider::TickPosition tickPosition = QSlider::TicksBelow;
42 int m_separateValue;
43};
44
45}
Definition dccslider.h:11