You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
880 B
C++
45 lines
880 B
C++
#ifndef NMGUIDRAWERWIDGET_H
|
|
#define NMGUIDRAWERWIDGET_H
|
|
|
|
#include "nmGUI_global.h"
|
|
|
|
#include <QWidget>
|
|
#include <QLabel>
|
|
#include <QToolButton>
|
|
#include <QVBoxLayout>
|
|
|
|
class NM_GUI_EXPORT nmGUIDrawerWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit nmGUIDrawerWidget(const QString &sTitle, QWidget *parent = nullptr);
|
|
|
|
void initUI();
|
|
|
|
// 折叠控制
|
|
void setExpanded(bool expanded);
|
|
bool isExpanded() const;
|
|
|
|
// 内容区域
|
|
void setContentLayout(QLayout *layout);
|
|
|
|
// 设置样式
|
|
void setStyleSheet(const QString &style);
|
|
|
|
signals:
|
|
void expansionChanged(bool expanded);
|
|
|
|
private slots:
|
|
void toggleExpand();
|
|
|
|
private:
|
|
bool m_bExpanded; // 折叠状态
|
|
QString m_sTitle; // 标题
|
|
|
|
QHBoxLayout *m_pHeaderLayout; // 标题栏布局
|
|
QToolButton *m_pToggleButton; // 折叠按钮
|
|
QLabel* m_pTitleLabel; // 标题标签
|
|
QWidget *m_pWidgetContent; // 内容区域
|
|
};
|
|
|
|
#endif // NMGUIDRAWERWIDGET_H
|