한국어
Qt
 

이번엔 아이템들을 배치 시키는 컴포넌트를 소개한다.

 

Row

Row는 가로형태로 아이템을 배치시킨다.

import QtQuick 2.11
import QtQuick.Window 2.11

Window {
    id: idWindow
    visible: true
    width: 700
    height: 300
    flags: Qt.FramelessWindowHint

    Row{
        anchors.centerIn: parent
        spacing: 20

        Image{
            source: "houses-1622066_640.jpg"
        }

        Image{
            source: "houses-1622066_640.jpg"
        }
    }
}

 

Row를 이용해 Image를 가로형태로 배치시켰다.

row.png

 

Repeater를 사용하면 같은 아이템들을 일일이 나열할 필요없이 간단하게 아이템을 반복하여 배치시킬 수 있다.

Rectangle{
    anchors.fill: parent
    color: "#F0F0F0"

    Row{
        anchors.centerIn: parent
        spacing: 20

        Repeater{
            model: 2
            Image{
                source: "houses-1622066_640.jpg"
            }
        }
    }
}

 

Column

Column은 아이템들을 새로로 배치 시킨다.

import QtQuick 2.11
import QtQuick.Window 2.11

Window {
    id: idWindow
    visible: true
    width: 400
    height: 600
    flags: Qt.FramelessWindowHint


    Rectangle{
        anchors.fill: parent
        color: "#F0F0F0"

        Column{
            anchors.centerIn: parent
            spacing: 20

            Image{
                source: "houses-1622066_640.jpg"
            }

            Image{
                source: "kingfisher-2046453__180.jpg"
            }
            Rectangle{
                color: "green"
                width: 110
                height: 50
            }
        }
    }
}

 

Image와 Rectangle을 새로로 배치

Column.png

 

번호 제목 글쓴이 날짜 조회 수
공지 Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서 운영자 2019.01.05 85949
139 QPA 플러그인과 HTML5 Backend file makersweb 2017.12.27 808
138 QML에서 Websocket 서버와 통신 file makersweb 2021.09.18 830
137 Qt로 작성된 iOS 앱에서 시리얼 통신 file makersweb 2022.04.30 851
136 Qt 6의 C++ 프로퍼티 바인딩 예제 makersweb 2021.11.01 856
135 Qt 응용프로그램에서 Lottie Animation사용 file makersweb 2021.05.30 881
134 Qt로 작성된 안드로이드 APP에 Splash Screen을 추가 file makersweb 2020.03.10 884
133 QML 에서 QR코드 생성 file makersweb 2021.08.20 892
132 QProcess 예제 (프로그램 재시작) file makersweb 2023.01.25 902
131 QML 바인딩 끊김 진단 makersweb 2020.11.08 910
130 Qt 5 코드를 Qt 6로 포팅하기 위해 도움이 되는 Clazy Framework file makersweb 2021.03.01 921
129 Qt 5.15 및 Qt 6의 출시 일정 makersweb 2020.04.09 932
128 Qt MQTT 에 대해서 file makersweb 2020.06.02 960
127 Qt기반의 서버와 클라이언트간 SOAP(Simple Object Access Protocol) file makersweb 2020.05.11 972
126 [Qt] Google Play의 향후 요구 사항을 준수하는 방법 [2] j2doll 2019.07.29 975
125 Qt 6에서 QList 변경사항 makersweb 2020.10.08 976
124 Qt 6.0의 개발 호스트 및 대상 플랫폼 makersweb 2020.09.16 977
123 Qt로 XML 파싱 : Qt 6에서 업데이트된 (Parsing XML with Qt: Updates for Qt 6) [1] j2doll 2020.01.16 979
122 Qt 하이브리드 애플리케이션(Hybrid App) 개발 file makersweb 2023.02.08 989
121 QMake 프로젝트를 CMake 프로젝트로 변환 with qmake2cmake makersweb 2022.09.17 1005
120 QScopedPointer 소개 및 사용법 makersweb 2019.11.29 1028