한국어
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 86174
59 main함수 명령줄 옵션 해석 makersweb 2020.09.01 2247
58 Qt 6.0의 개발 호스트 및 대상 플랫폼 makersweb 2020.09.16 977
57 Qt 6에서 QList 변경사항 makersweb 2020.10.08 989
56 QRandomGenerator 클래스를 사용하여 난수(random values) 생성 makersweb 2020.10.17 1582
55 Qt 6의 비동기 API makersweb 2020.10.19 1213
54 QML과 코루틴(Coroutines) makersweb 2020.11.03 581
53 QML 바인딩 끊김 진단 makersweb 2020.11.08 915
52 Qt Quick Controls 2에 네이티브 데스크탑 스타일 추가 file makersweb 2020.11.23 489
51 Qt5Compat 라이브러리를 사용하여 Qt5에서 Qt6로 포팅 [2] makersweb 2020.12.05 685
50 그래픽 소프트웨어에서 디자인 내보내기 (Exporting Designs from Graphics Software) j2doll 2020.12.25 416
49 QThread 및 QMutex 예제 makersweb 2021.01.12 1358
48 Loader를 사용하여 동적으로 QML 로드 makersweb 2021.01.19 1835
47 Qt 를 사용하거나 기반으로 하는 응용프로그램 file makersweb 2021.01.30 3850
46 Qt MQTT의 pus/sub 튜토리얼 file makersweb 2021.02.06 1665
45 C++로 작성한 클래스를 QML에서 생성 file makersweb 2021.02.10 5307
44 Qt 5 코드를 Qt 6로 포팅하기 위해 도움이 되는 Clazy Framework file makersweb 2021.03.01 925
43 QML과 JavaScript 의 숫자 관련 내장된 함수 makersweb 2021.03.28 1411
42 Qt 6 에서 프로퍼티 바인딩 makersweb 2021.04.03 776
41 응용프로그램 자동실행 설정 (on Windows) makersweb 2021.05.08 567
40 싱글 샷(Single-Shot) 시그널/슬롯 연결 makersweb 2021.05.12 757