This commit is contained in:
朱子楚\zhuzi 2024-04-11 15:27:15 +08:00
parent 3f6ef13cd0
commit 531f659e59
4 changed files with 21 additions and 22 deletions

View File

@ -10,13 +10,10 @@ FluContentPage{
title: qsTr("OpenGL")
FluFrame{
anchors.fill: parent
OpenGLItem{
width: 320
height: 480
anchors.fill: parent
SequentialAnimation on t {
NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
@ -24,9 +21,6 @@ FluContentPage{
running: true
}
}
}
}

View File

@ -47,7 +47,7 @@ QOpenGLFramebufferObject *FBORenderer::createFramebufferObject(const QSize &size
}
void FBORenderer::render() {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
program.bind();

View File

@ -12,11 +12,11 @@ Q_OBJECT
public:
explicit OpenGLItem(QQuickItem *parent = nullptr);
QQuickFramebufferObject::Renderer *createRenderer() const override;
[[nodiscard]] QQuickFramebufferObject::Renderer *createRenderer() const override;
void timerEvent(QTimerEvent *) override;
qreal t() const { return m_t; }
[[nodiscard]] qreal t() const { return m_t; }
void setT(qreal t);

View File

@ -19,10 +19,14 @@ Q_OBJECT
public:
explicit FluTreeNode(QObject *parent = nullptr);
Q_INVOKABLE int depth() const { return _depth; };
Q_INVOKABLE bool isExpanded() const { return _isExpanded; };
Q_INVOKABLE QVariantMap data() const { return _data; };
Q_INVOKABLE bool hasChildren() const { return !_children.isEmpty(); };
[[nodiscard]] Q_INVOKABLE int depth() const { return _depth; };
[[nodiscard]] Q_INVOKABLE bool isExpanded() const { return _isExpanded; };
[[nodiscard]] Q_INVOKABLE QVariantMap data() const { return _data; };
[[nodiscard]] Q_INVOKABLE bool hasChildren() const { return !_children.isEmpty(); };
Q_INVOKABLE bool hasNextNodeByIndex(int index) {
FluTreeNode *p = this;
for (int i = 0; i <= _depth - index - 1; i++) {
@ -34,7 +38,7 @@ public:
return true;
}
Q_INVOKABLE bool checked() const {
[[nodiscard]] Q_INVOKABLE bool checked() const {
if (!hasChildren()) {
return _checked;
}
@ -46,6 +50,7 @@ public:
}
return true;
};
Q_INVOKABLE bool hideLineFooter() {
if (_parent) {
auto childIndex = _parent->_children.indexOf(this);
@ -60,7 +65,7 @@ public:
return false;
};
bool isShown() const {
[[nodiscard]] bool isShown() const {
auto p = _parent;
while (p) {
if (!p->_isExpanded) {
@ -96,17 +101,17 @@ public:
explicit FluTreeModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = {}) const override;
[[nodiscard]] int rowCount(const QModelIndex &parent = {}) const override;
int columnCount(const QModelIndex &parent = {}) const override;
[[nodiscard]] int columnCount(const QModelIndex &parent = {}) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
[[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
QModelIndex parent(const QModelIndex &child) const override;
[[nodiscard]] QModelIndex parent(const QModelIndex &child) const override;
QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
[[nodiscard]] QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
Q_INVOKABLE void removeRows(int row, int count);