5#ifndef DSEGMENTEDCONTROL_H
6#define DSEGMENTEDCONTROL_H
8#include <dtkwidget_global.h>
10#if DTK_VERSION < DTK_VERSION_CHECK(6, 0, 0, 0)
15#include <QPropertyAnimation>
17#include <QEasingCurve>
20DWIDGET_BEGIN_NAMESPACE
22class LIBDTKWIDGETSHARED_EXPORT D_DECL_DEPRECATED DSegmentedHighlight :
public QToolButton
27 explicit DSegmentedHighlight(QWidget *parent = 0);
30class DSegmentedControlPrivate;
31class LIBDTKWIDGETSHARED_EXPORT D_DECL_DEPRECATED_X(
"Use DButtonBox") DSegmentedControl :
public QWidget,
public DCORE_NAMESPACE::DObject
34 D_DECLARE_PRIVATE(DSegmentedControl)
36 Q_PROPERTY(
int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
37 Q_PROPERTY(
int count READ count)
38 Q_PROPERTY(
int animationDuration READ animationDuration WRITE setAnimationDuration)
39 Q_PROPERTY(QEasingCurve::Type animationType READ animationType WRITE setAnimationType)
41 explicit DSegmentedControl(QWidget *parent = 0);
44 const DSegmentedHighlight *highlight()
const;
45 int currentIndex()
const;
46 QToolButton *at(
int index)
const;
47 QString getText(
int index)
const;
48 QIcon getIcon(
int index)
const;
49 int animationDuration()
const;
50 int indexByTitle(
const QString &title)
const;
52 QEasingCurve::Type animationType()
const;
55 int addSegmented(
const QString &title);
56 int addSegmented(
const QIcon &icon,
const QString &title);
57 void addSegmented(
const QStringList &titleList);
58 void addSegmented(
const QList<QIcon> &iconList,
const QStringList &titleList);
59 void insertSegmented(
int index,
const QString &title);
60 void insertSegmented(
int index,
const QIcon &icon,
const QString &title);
61 void removeSegmented(
int index);
63 bool setCurrentIndex(
int currentIndex);
64 bool setCurrentIndexByTitle(
const QString &title);
65 void setText(
int index,
const QString &title);
66 void setIcon(
int index,
const QIcon &icon);
67 void setAnimationDuration(
int animationDuration);
68 void setAnimationType(QEasingCurve::Type animationType);
71 void updateHighlightGeometry(
bool animation =
true);
75 void currentChanged(
int index);
76 void currentTitleChanged(QString title);
77 void animationDurationChanged(
int animationDuration);
80 bool eventFilter(QObject *, QEvent *)
override;
81 void resizeEvent(QResizeEvent *event)
override;