mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
.. the side bar, bottom bar and related buttons were still following a skeuomorphic design that has long since fallen into disuse. .. now have a more muted feel with hover/press colors active on mouse events. .. moved the whatsthis button to the far right since this is quite a common placement in other apps. .. it is noticeable how we use many many different schemes for hover/pressed colors across the UI- at some point this should be unified. .. also deprecated the segmentcontrol.
78 lines
2.2 KiB
C++
78 lines
2.2 KiB
C++
/*
|
|
A whole bunch of stuff here.
|
|
*/
|
|
|
|
#include <QWidget>
|
|
class QMenu;
|
|
class QStyleOption;
|
|
|
|
class QtSegmentControlPrivate;
|
|
|
|
class QtSegmentControl : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
Q_ENUMS(SelectionBehavior)
|
|
Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior)
|
|
Q_PROPERTY(int selectedSegment READ selectedSegment NOTIFY segmentSelected)
|
|
Q_PROPERTY(int count READ count WRITE setCount)
|
|
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
|
|
public:
|
|
enum SelectionBehavior { SelectOne, SelectAll, SelectNone };
|
|
|
|
QtSegmentControl(QWidget *parent = 0);
|
|
~QtSegmentControl();
|
|
|
|
int count() const;
|
|
void setCount(int newConut);
|
|
|
|
bool isSegmentSelected(int index) const;
|
|
int selectedSegment() const;
|
|
void setSegmentSelected(int index, bool selected);
|
|
|
|
void setSegmentEnabled(int index, bool enable);
|
|
bool segmentEnabled(int index) const;
|
|
|
|
void setSelectionBehavior(SelectionBehavior behavior);
|
|
SelectionBehavior selectionBehavior() const;
|
|
|
|
void setSegmentText(int index, const QString &text);
|
|
QString segmentText(int index) const;
|
|
|
|
void setSegmentIcon(int index, const QIcon &icon);
|
|
QIcon segmentIcon(int index) const;
|
|
|
|
void setIconSize(const QSize &size);
|
|
QSize iconSize() const;
|
|
|
|
void setSegmentMenu(int segment, QMenu *menu);
|
|
QMenu *segmentMenu(int segment) const;
|
|
|
|
void setSegmentToolTip(int segment, const QString &tipText);
|
|
QString segmentToolTip(int segment) const;
|
|
|
|
void setSegmentWhatsThis(int segment, const QString &whatsThisText);
|
|
QString segmentWhatsThis(int segment) const;
|
|
|
|
virtual QSize segmentSizeHint(int segment) const;
|
|
QSize sizeHint() const;
|
|
|
|
QRect segmentRect(int index) const;
|
|
int segmentAt(const QPoint &pos) const;
|
|
|
|
protected:
|
|
void initStyleOption(int segment, QStyleOption *option) const;
|
|
void paintEvent(QPaintEvent *pe);
|
|
void mousePressEvent(QMouseEvent *event);
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
void mouseReleaseEvent(QMouseEvent *event);
|
|
void keyPressEvent(QKeyEvent *event);
|
|
void keyReleaseEvent(QKeyEvent *event);
|
|
bool event(QEvent *event);
|
|
|
|
Q_SIGNALS:
|
|
void segmentSelected(int selected);
|
|
|
|
private:
|
|
QtSegmentControlPrivate *d;
|
|
};
|