Skip to content

Example Compress

Stephen Quan edited this page Jan 18, 2023 · 2 revisions
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import qmlonline
Page {
    id: page
    ScrollView {
        id: scrollView
        anchors.fill: parent
        ScrollBar.vertical.policy: ScrollBar.AlwaysOn
        ScrollBar.vertical.width: 20
        ColumnLayout {
            width: scrollView.width - 20
            spacing: 20
            GroupBox {
                Layout.fillWidth: true
                title: "Compress"
                ColumnLayout {
                    width: parent.width
                    spacing: 20
                    GroupBox {
                        Layout.fillWidth: true
                        title: "Input"
                        TextEdit {
                            id: inp
                            width: parent.width
                            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
                            text: "The quick brown fox jumped over the lazy dog!"
                        }
                    }
                    GroupBox {
                        Layout.fillWidth: true
                        title: "Output"
                        TextEdit {
                            width: parent.width
                            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
                            text: System.stringCompress(inp.text)
                        }
                    }
                }
            }
            GroupBox {
                Layout.fillWidth: true
                title: "Uncompress"
                ColumnLayout {
                    width: parent.width
                    spacing: 20
                    GroupBox {
                        Layout.fillWidth: true
                        title: "Input"
                        TextEdit {
                            id: inp2
                            width: parent.width
                            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
                            text: "AAAALXicC8lIVSgszUzOVkgqyi/PU0jLr1DIKs0tSE1RyC9LLVIoAcrnJFZVKqTkpysCAHvkEFE="
                        }
                    }
                    GroupBox {
                        Layout.fillWidth: true
                        title: "Output"
                        TextEdit {
                            width: parent.width
                            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
                            text: System.stringUncompress(inp2.text)
                        }
                    }
                    Item {
                        Layout.preferredHeight: page.height / 2
                    }
                }
            }
        }
    }
}

You can Try it Online!

Clone this wiki locally