62 lines
829 B
C++
Executable File
62 lines
829 B
C++
Executable File
|
|
|
|
|
|
#pragma once
|
|
#include <QGridLayout>
|
|
#include <QVector>
|
|
|
|
#include "lts_widgets_export.h"
|
|
#include "lts_base.h"
|
|
|
|
class QWidget;
|
|
|
|
namespace LtsWidgets
|
|
{
|
|
|
|
|
|
class LTSWIDGETS_EXPORT LtsGridLayout : public QGridLayout
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
|
|
|
|
explicit LtsGridLayout(LtsWidgets::ButtonSize buttonSize, QWidget *parent = nullptr, int maxColumn = 1);
|
|
|
|
|
|
|
|
void add_widget(QWidget *widget);
|
|
|
|
|
|
|
|
void setAutoSize(bool enable);
|
|
|
|
|
|
|
|
void setMaxColumn(int max);
|
|
|
|
|
|
private:
|
|
void addWidgetInternal(QWidget *widget);
|
|
|
|
public Q_SLOTS:
|
|
void onParentResize(QResizeEvent *e);
|
|
|
|
|
|
private Q_SLOTS:
|
|
void onWidgetDestroyed();
|
|
private:
|
|
|
|
LtsWidgets::ButtonSize m_buttonSize;
|
|
int m_defaultMaxColumn;
|
|
int m_maxColumn;
|
|
int m_colSize;
|
|
QVector<QWidget *> m_widgetList;
|
|
QRect m_oldGeo;
|
|
QSize m_oldSize;
|
|
bool m_autoSize;
|
|
|
|
|
|
};
|
|
|
|
}
|