更新文档

This commit is contained in:
feiyangqingyun
2023-09-08 13:52:30 +08:00
parent 9af16093a2
commit 8173abef29
39 changed files with 1556 additions and 1464 deletions

View File

@@ -44,36 +44,6 @@ void PanelWidget::resizeEvent(QResizeEvent *)
scrollArea->resize(this->size());
}
int PanelWidget::getMargin() const
{
return this->margin;
}
int PanelWidget::getSpace() const
{
return this->space;
}
bool PanelWidget::getAutoWidth() const
{
return this->autoWidth;
}
bool PanelWidget::getAutoHeight() const
{
return this->autoHeight;
}
int PanelWidget::getColumnCount() const
{
return this->columnCount;
}
QList<QWidget *> PanelWidget::getWidgets() const
{
return this->widgets;
}
QSize PanelWidget::sizeHint() const
{
return QSize(300, 200);
@@ -89,6 +59,11 @@ void PanelWidget::setMargin(int left, int top, int right, int bottom)
gridLayout->setContentsMargins(left, top, right, bottom);
}
int PanelWidget::getMargin() const
{
return this->margin;
}
void PanelWidget::setMargin(int margin)
{
if (this->margin != margin) {
@@ -96,6 +71,11 @@ void PanelWidget::setMargin(int margin)
}
}
int PanelWidget::getSpace() const
{
return this->space;
}
void PanelWidget::setSpace(int space)
{
if (this->space != space) {
@@ -103,6 +83,11 @@ void PanelWidget::setSpace(int space)
}
}
bool PanelWidget::getAutoWidth() const
{
return this->autoWidth;
}
void PanelWidget::setAutoWidth(bool autoWidth)
{
if (this->autoWidth != autoWidth) {
@@ -110,6 +95,11 @@ void PanelWidget::setAutoWidth(bool autoWidth)
}
}
bool PanelWidget::getAutoHeight() const
{
return this->autoHeight;
}
void PanelWidget::setAutoHeight(bool autoHeight)
{
if (this->autoHeight != autoHeight) {
@@ -117,6 +107,11 @@ void PanelWidget::setAutoHeight(bool autoHeight)
}
}
int PanelWidget::getColumnCount() const
{
return this->columnCount;
}
void PanelWidget::setColumnCount(int columnCount)
{
if (this->columnCount != columnCount) {
@@ -124,6 +119,11 @@ void PanelWidget::setColumnCount(int columnCount)
}
}
QList<QWidget *> PanelWidget::getWidgets() const
{
return this->widgets;
}
void PanelWidget::setWidgets(QList<QWidget *> widgets)
{
this->widgets = widgets;

View File

@@ -26,6 +26,7 @@ class PanelWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(int margin READ getMargin WRITE setMargin)
Q_PROPERTY(int space READ getSpace WRITE setSpace)
Q_PROPERTY(bool autoWidth READ getAutoWidth WRITE setAutoWidth)
@@ -39,52 +40,61 @@ protected:
void resizeEvent(QResizeEvent *);
private:
QScrollArea *scrollArea; //滚动区域
QWidget *scrollAreaContents; //滚动区域载体
QFrame *frame; //放置设备的框架,自动变宽变高
QVBoxLayout *verticalLayout; //设备面板总布局
QGridLayout *gridLayout; //设备表格布局
QSpacerItem *hSpacer; //横向弹簧
QSpacerItem *vSpacer; //垂直弹簧
QScrollArea *scrollArea; //滚动区域
QWidget *scrollAreaContents;//滚动区域载体
QFrame *frame; //放置设备的框架,自动变宽变高
QVBoxLayout *verticalLayout;//设备面板总布局
QGridLayout *gridLayout; //设备表格布局
QSpacerItem *hSpacer; //横向弹簧
QSpacerItem *vSpacer; //垂直弹簧
int margin; //边距
int space; //设备之间的间隔
bool autoWidth; //宽度自动拉伸
bool autoHeight; //高度自动拉伸
int margin; //边距
int space; //设备之间的间隔
bool autoWidth; //宽度自动拉伸
bool autoHeight; //高度自动拉伸
int columnCount; //面板列数
QList<QWidget *> widgets; //设备面板对象集合
int columnCount; //面板列数
QList<QWidget *> widgets; //设备面板对象集合
public:
int getMargin() const;
int getSpace() const;
bool getAutoWidth() const;
bool getAutoHeight() const;
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
int getColumnCount() const;
QList<QWidget *> getWidgets() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置边距+间距
//设置边距
void setMargin(int left, int top, int right, int bottom);
//获取和设置边距
int getMargin() const;
void setMargin(int margin);
//获取和设置间距
int getSpace() const;
void setSpace(int space);
//设置自动填充宽度+自动填充高度
//获取和设置自动填充宽度
bool getAutoWidth() const;
void setAutoWidth(bool autoWidth);
//获取和设置自自动填充高度
bool getAutoHeight() const;
void setAutoHeight(bool autoHeight);
//设置列数+窗体集合
//获取和设置列数
int getColumnCount() const;
void setColumnCount(int columnCount);
//获取和设置窗体集合
QList<QWidget *> getWidgets() const;
void setWidgets(QList<QWidget *> widgets);
//载入窗体集合+指定位置插入新窗体+移除指定的窗体+清空窗体
//载入窗体集合
void loadWidgets();
//指定位置插入新窗体
void insertWidget(int index, QWidget *widget);
//移除指定的窗体
void removeWidget(QWidget *widget);
//清空窗体
void clearWidgets();
};