한국어
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 86420
79 QThread 소개 및 예제 makersweb 2019.12.25 19672
78 ApplicationWindow 와 메뉴바(MenuBar)구성 file makersweb 2020.01.04 1509
77 Qt 멀티 스레드 프로그래밍 시 유의해야 할 몇 가지 makersweb 2020.01.13 4916
76 Qt로 XML 파싱 : Qt 6에서 업데이트된 (Parsing XML with Qt: Updates for Qt 6) [1] j2doll 2020.01.16 981
75 2020년에 변경되는 Qt 오퍼 (Qt offering changes 2020) [2] j2doll 2020.01.31 723
74 QOpenGLWidget 을 투명하게 적용 file makersweb 2020.02.05 1052
73 라즈베리파이4에 대한 Qt 5.14.1 크로스컴파일 [1] file makersweb 2020.02.12 4468
72 QLabel의 텍스트 색과 배경색을 변경 makersweb 2020.02.25 6718
71 Qt로 작성된 안드로이드 APP에 Splash Screen을 추가 file makersweb 2020.03.10 887
70 컨테이너 클래스 - QVector makersweb 2020.03.17 2885
69 콘솔에서 사용자 입력받기 file makersweb 2020.03.22 51868
68 Qt 5.15 및 Qt 6의 출시 일정 makersweb 2020.04.09 934
67 재진입(Reentrancy) 및 스레드 안전성(Thread-Safety) makersweb 2020.04.19 1232
66 Qt기반의 서버와 클라이언트간 SOAP(Simple Object Access Protocol) file makersweb 2020.05.11 978
65 ShaderEffect QML Type을 이용한 버튼 클릭 효과 file makersweb 2020.05.22 1102
64 Embedded Linux 에서 Qt 및 Graphics Stack file 운영자 2020.05.27 621
63 Qt MQTT 에 대해서 file makersweb 2020.06.02 962
62 최초의 Qt 6.0 스냅샷 제공 (First Qt 6.0 Snapshot Available) j2doll 2020.06.21 596
61 Qt로 데이터를 직렬화(serialization)하는 방법 makersweb 2020.08.04 2102
60 UI 폼(Form)작성 시 탭 순서(Tab Order) 설정 file makersweb 2020.08.24 2847