代码拉取完成,页面将自动刷新
#ifndef NAVIGATIONMENU_H
#define NAVIGATIONMENU_H
#include <QWidget>
#include <QFont>
#include <QPen>
#include <QPropertyAnimation>
#include "uicommondef.h"
#include "ikeyenbale.h"
class NavigationMenu : public QWidget, public IKeyEnable
{
Q_OBJECT
public:
Q_PROPERTY(int textOffset READ textOffset WRITE setTextOffset)
explicit NavigationMenu(QWidget *parent = nullptr);
~NavigationMenu();
void setMaxDisplaNum(int maxDisplayNum);
void setSelectIndex(int index);
int getSelectIndex() const;
MenuItemNode_S* getSelectItem();
void setNavigationInfo(const QList<MenuItemNode_S*>& lst, int selectIndex = 0);
void turnUpEvent();
void turnDownEvent();
virtual void eventTurnLeft() override;
virtual void eventTurnRight() override;
virtual void eventShortPress() override;
virtual void eventLongPress() override;
int textOffset() const;
void setTextOffset(int rect);
signals:
void sglSelectItem(MenuItemNode_S* item);
void sglExit();
private:
void calcTextDuration();
void drawItemText(QPainter* painter, MenuItemNode_S* item, QPoint basePt);
// QWidget interface
protected:
virtual void paintEvent(QPaintEvent *event) override;
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override;
private:
QPoint m_mouseStartPos;
qint64 m_pressTimeStamp = -1;
QRect m_touchRect = QRect();
private:
MenuItemNode_S* nullItem = nullptr;
int m_selectIndex = -1;
QSize m_normalSize = QSize(46, 46);
QSize m_selectSize = QSize(104, 104);
QList<MenuItemNode_S*> m_itemInfoLst;
QList<MenuItemNode_S*> m_showInfoLst;
int m_endPadding = 16;
int m_spacing = 8;
int m_iconSetp = 8;
int m_maxDisplayNum = 5; //最大显示数量
int m_fixIndex = -1; //上方固定数量
private:
QFont m_textFont;
QFont m_valueFont;
QPen m_textPen;
int m_textOffset = 0; //文本动画左侧偏移量
QPropertyAnimation* m_textAnimation = nullptr;
};
#endif // NAVIGATIONMENU_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。