Files
gcs-nf/qNavigationWidget/qnavigationwidget.h
T

71 lines
1.4 KiB
C++
Raw Normal View History

2020-03-18 23:31:54 +08:00
#ifndef QNAVIGATIONWIDGET_H
#define QNAVIGATIONWIDGET_H
#include <QWidget>
#include <QMouseEvent>
#pragma execution_character_set("utf-8")
#ifdef QNavigation
#include <qnavigantionglobal.h>
class QNAVGATIONSHARED_EXPORT QNavigationWidget : public QWidget {
#else
class QNavigationWidget : public QWidget
{
#endif
Q_OBJECT
public:
QNavigationWidget(QWidget *parent=nullptr);
~QNavigationWidget();
void addItem(const QString &title, QIcon &icon);
void setWidth(const int &width);
void setBackgroundColor(const QString &color);
void setSelectColor(const QString &color);
void setRowHeight(const int &height);
void setCurrentIndex(const int &index);
int Index(void);
signals:
void ItemChanged(const int &index);
2020-04-13 21:37:30 +08:00
void SizeChanged(QResizeEvent *);
2020-03-18 23:31:54 +08:00
protected:
void paintEvent(QPaintEvent *);
void mouseMoveEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
void enterEvent(QEvent *);
void leaveEvent(QEvent *);
2020-04-13 21:37:30 +08:00
void resizeEvent(QResizeEvent *);
2020-03-18 23:31:54 +08:00
private:
QList<QString> listItems;
QString backgroundColor;
QString selectedColor;
QString MouseColor;
QString controlBarColor;
QString controlSlideColor;
int controlBarWidth = 10;
int rowHeight;
int currentIndex;
int MouseIndex;
bool isHidden = false;
};
#endif