-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cxx-qt-gen: add support for choosing a custom parent class
This then allows you to create a QQuickItem such as a QQuickPaintedItem. Closes #474
- Loading branch information
1 parent
575ecf5
commit d500124
Showing
16 changed files
with
194 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
import QtQuick 2.12 | ||
import QtQuick.Controls 2.12 | ||
import QtQuick.Layouts 1.12 | ||
|
||
import com.kdab.cxx_qt.demo 1.0 | ||
|
||
Page { | ||
header: ToolBar { | ||
RowLayout { | ||
anchors.fill: parent | ||
|
||
ToolButton { | ||
text: qsTr("Red") | ||
|
||
onClicked: customPainter.color = "red" | ||
} | ||
|
||
ToolButton { | ||
text: qsTr("Green") | ||
|
||
onClicked: customPainter.color = "green" | ||
} | ||
|
||
ToolButton { | ||
text: qsTr("Blue") | ||
|
||
onClicked: customPainter.color = "blue" | ||
} | ||
|
||
Item { | ||
Layout.fillWidth: true | ||
} | ||
} | ||
} | ||
|
||
|
||
ColumnLayout { | ||
anchors.left: parent.left | ||
anchors.right: parent.right | ||
anchors.verticalCenter: parent.verticalCenter | ||
|
||
CustomParentClass { | ||
id: customPainter | ||
color: "red" | ||
Layout.alignment: Qt.AlignHCenter | ||
height: 200 | ||
width: 200 | ||
|
||
// TODO: once we can connect to signals on the Rust side, this could be done there | ||
onColorChanged: update() | ||
} | ||
|
||
Label { | ||
Layout.fillWidth: true | ||
horizontalAlignment: Text.AlignHCenter | ||
text: qsTr("In this demo the Rectangle is rendered in Rust by implementing a QQuickPaintedItem.") | ||
wrapMode: Text.Wrap | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.