QML
← 전체 컴포넌트

Global Header

앱 이름과 로고, 내비게이션, 검색과 공통 동작을 모아 놓는 상단 헤더입니다.

import Syidax.Core.GlobalHeader

지원 QML 타입

타입정의 / 역할
브랜드·탐색 탭·동작 버튼을 배치하는 앱 상단 헤더입니다.

예제로 보기

미리보기는 Qt 실행 화면의 이미지입니다. 아래 버튼으로 결과를 전환하세요.

01 기본 구성

기본 구성의 설정과 실행 결과를 비교합니다.

Qt 실행 화면 · 이미지
기본 구성 · 기본
기본 실행 화면
QML 코드
import QtQuick
import Syidax.Core

Item {
    component EventLog: Rectangle {
        id: logBox
        property var lines: []
        implicitWidth: 440
        implicitHeight: Math.max(56, logText.implicitHeight + 24)
        radius: 4; color: Theme.semantic.backgroundBold
        function log(value) { lines = lines.slice(-3).concat([String(value)]) }
        Text {
            id: logText; x: 12; y: 12; width: parent.width - 24
            text: logBox.lines.length ? logBox.lines.join("\n") : "컨트롤을 조작하면 이벤트 결과가 표시됩니다."
            wrapMode: Text.Wrap; color: Theme.semantic.textDefault
            font.family: Theme.monoFontFamily; font.pixelSize: 12
        }
    }

    implicitWidth: Math.max(360, childrenRect.width)
    implicitHeight: childrenRect.height

    property QtObject settings: QtObject {
        id: storyArgs
        property string title: "콘솔"
        property bool search: true
        property bool information: true
        property bool notification: true
    }

    

    Column {
        spacing: 12
        SyGlobalHeader {
            width: 760
            title: storyArgs.title
            search: storyArgs.search
            information: storyArgs.information
            notification: storyArgs.notification
            onSelected: (detail) => output.log(detail.tabkey)
            tabs: [
                SyTab { tabkey: "home"; text: "홈" },
                SyTab { tabkey: "data"; text: "데이터" },
                SyTab { tabkey: "reports"; text: "보고서" }
            ]
        }
        EventLog { id: output }
    }

}

02 logo · tabs · actions

세 list 속성이 아이템을 받습니다.

Qt 실행 화면 · 이미지
logo · tabs · actions · 기본
기본 실행 화면
QML 코드
import QtQuick
import Syidax.Core

Item {
    implicitWidth: Math.max(360, childrenRect.width)
    implicitHeight: childrenRect.height
    // Focused Gallery routes: keep only the selected API and its prerequisites.
    id: featureStory

    property QtObject settings: QtObject {
        id: storyArgs
        property int width: 560
    }

    

    SyGlobalHeader { id: featureTarget0;
        width: storyArgs.width
        title: "콘솔"
        logo: Rectangle { width: 28; height: 28; radius: 6; color: Theme.semantic.backgroundBrandBold; Text { anchors.centerIn: parent; text: "SY"; font.family: Theme.fontFamily; font.pixelSize: 12; font.weight: Font.Bold; color: "white" } }
        tabs: [
            SyTab { tabkey: "home"; text: "홈" },
            SyTab { tabkey: "data"; text: "데이터" },
            SyTab { tabkey: "reports"; text: "보고서" },
            SyTab { tabkey: "settings"; text: "설정" },
            SyTab { tabkey: "admin"; text: "관리" }
        ]
        actions: SyButton { text: "로그인"; size: "small" }
    }
}

03 selected · actionClick · changed

SyGlobalHeader에는 시그널이 셋 있습니다:

Qt 실행 화면 · 이미지
selected · actionClick · changed · 기본
기본 실행 화면
QML 코드
import QtQuick
import Syidax.Core

Item {
    component EventLog: Rectangle {
        id: logBox
        property var lines: []
        implicitWidth: 440
        implicitHeight: Math.max(56, logText.implicitHeight + 24)
        radius: 4; color: Theme.semantic.backgroundBold
        function log(value) { lines = lines.slice(-3).concat([String(value)]) }
        Text {
            id: logText; x: 12; y: 12; width: parent.width - 24
            text: logBox.lines.length ? logBox.lines.join("\n") : "컨트롤을 조작하면 이벤트 결과가 표시됩니다."
            wrapMode: Text.Wrap; color: Theme.semantic.textDefault
            font.family: Theme.monoFontFamily; font.pixelSize: 12
        }
    }

    implicitWidth: Math.max(360, childrenRect.width)
    implicitHeight: childrenRect.height
    // Focused Gallery routes: keep only the selected API and its prerequisites.
    id: featureStory

    

    Column {
        spacing: 12
        SyGlobalHeader {
            width: 760
            title: "콘솔"
            search: true; information: true; notification: true
            onSelected: (detail) => { if (true) { output.log(("selected: %1").arg(detail.tabkey)) } }
            onActionClick: (detail) => { if (true) { output.log(("actionClick: %1").arg(detail.type)) } }
            onChanged: (detail) => { if (true) { output.log(("changed: %1").arg(detail.value)) } }
            tabs: [
                SyTab { tabkey: "home"; text: "홈" },
                SyTab { tabkey: "data"; text: "데이터" }
            ]
        }
        EventLog { id: output }
    }
}

04 setActiveTab · updateOverflowTabs

setActiveTab(index)는 그 인덱스의 탭을 활성 탭으로 만들고 selected({ tabkey, index })를 발생시킵니다.

Qt 실행 화면 · 이미지
setActiveTab · updateOverflowTabs · 기본
QML 코드
import QtQuick
import Syidax.Core

Item {
    implicitWidth: Math.max(360, childrenRect.width)
    implicitHeight: childrenRect.height
    // Focused Gallery routes: keep only the selected API and its prerequisites.
    id: featureStory

    Column {
        spacing: 24
        SyGlobalHeader { id: bar; width: 760; title: "콘솔"; tabs: [ SyTab { tabkey: "home"; text: "홈" }, SyTab { tabkey: "data"; text: "데이터" }, SyTab { tabkey: "reports"; text: "보고서" } ] }
        Row {
            spacing: 8
            SyButton { id: exampleControl1;  visible: true; text: "bar.setActiveTab(1)"; variant: "secondary"; size: "small"; onClicked: bar.setActiveTab(1) }
            SyButton { id: exampleControl2;  visible: true; text: "bar.updateOverflowTabs()"; variant: "secondary"; size: "small"; onClicked: bar.updateOverflowTabs() }
        }
        Text {
            text: "bar.active === " + bar.active + "   bar.overflowTabs.length === " + bar.overflowTabs.length
            font.family: Theme.monoFontFamily
            font.pixelSize: 12
            color: Theme.semantic.textSubtle
        }
    }
}

05 검색 헤더

search 설정을 적용한 검색 헤더 예제입니다.

Qt 실행 화면 · 이미지
검색 헤더 · 실행 결과
기본 실행 화면
QML 코드
import QtQuick
import Syidax.Core

Item {
    component EventLog: Rectangle {
        id: logBox
        property var lines: []
        implicitWidth: 440
        implicitHeight: Math.max(56, logText.implicitHeight + 24)
        radius: 4; color: Theme.semantic.backgroundBold
        function log(value) { lines = lines.slice(-3).concat([String(value)]) }
        Text {
            id: logText; x: 12; y: 12; width: parent.width - 24
            text: logBox.lines.length ? logBox.lines.join("\n") : "컨트롤을 조작하면 이벤트 결과가 표시됩니다."
            wrapMode: Text.Wrap; color: Theme.semantic.textDefault
            font.family: Theme.monoFontFamily; font.pixelSize: 12
        }
    }

    implicitWidth: Math.max(360, childrenRect.width)
    implicitHeight: childrenRect.height

    property QtObject settings: QtObject {
        id: storyArgs
        property string title: "콘솔"
        property bool search: true
        property bool information: true
        property bool notification: true
    }

    

    Column {
        spacing: 12
        SyGlobalHeader {
            width: 760
            title: storyArgs.title
            search: storyArgs.search
            information: storyArgs.information
            notification: storyArgs.notification
            onSelected: (detail) => output.log(detail.tabkey)
            tabs: [
                SyTab { tabkey: "home"; text: "홈" },
                SyTab { tabkey: "data"; text: "데이터" },
                SyTab { tabkey: "reports"; text: "보고서" }
            ]
        }
        EventLog { id: output }
    }

}

06 정보·알림 헤더

information · notification 설정을 적용한 정보·알림 헤더 예제입니다.

Qt 실행 화면 · 이미지
정보·알림 헤더 · 실행 결과
기본 실행 화면
QML 코드
import QtQuick
import Syidax.Core

Item {
    component EventLog: Rectangle {
        id: logBox
        property var lines: []
        implicitWidth: 440
        implicitHeight: Math.max(56, logText.implicitHeight + 24)
        radius: 4; color: Theme.semantic.backgroundBold
        function log(value) { lines = lines.slice(-3).concat([String(value)]) }
        Text {
            id: logText; x: 12; y: 12; width: parent.width - 24
            text: logBox.lines.length ? logBox.lines.join("\n") : "컨트롤을 조작하면 이벤트 결과가 표시됩니다."
            wrapMode: Text.Wrap; color: Theme.semantic.textDefault
            font.family: Theme.monoFontFamily; font.pixelSize: 12
        }
    }

    implicitWidth: Math.max(360, childrenRect.width)
    implicitHeight: childrenRect.height

    property QtObject settings: QtObject {
        id: storyArgs
        property string title: "콘솔"
        property bool search: true
        property bool information: true
        property bool notification: true
    }

    

    Column {
        spacing: 12
        SyGlobalHeader {
            width: 760
            title: storyArgs.title
            search: storyArgs.search
            information: storyArgs.information
            notification: storyArgs.notification
            onSelected: (detail) => output.log(detail.tabkey)
            tabs: [
                SyTab { tabkey: "home"; text: "홈" },
                SyTab { tabkey: "data"; text: "데이터" },
                SyTab { tabkey: "reports"; text: "보고서" }
            ]
        }
        EventLog { id: output }
    }

}

API 35

항목을 가리키거나 선택하면 QML 예제와 복사 버튼이 나타납니다.

속성

속성타입기본값설명
string""로고 뒤의 앱 이름(16 px 중간 굵기); 비어 있으면 숨김
list—제목 앞의 아이템
list—SyTab 헤더(하나, 또는 대괄호 목록)
list—검색 필드와 버튼 뒤, 오른쪽 끝의 아이템
boolfalse200 px 검색 필드; changed({ value }) 보고
boolfalse도움말 버튼; actionClick({ type: "information" }) 보고
boolfalse종 버튼; actionClick({ type: "notification" }) 보고
int0활성 탭의 인덱스; 설정하면 조용히 전환, 읽어서 알 수 있음
boolfalse모든 탭, 검색 필드, 정보 / 알림 버튼, actions 아이템 멈춤
var[]수집된 헤더, 순서대로(헤더가 유지)
var[]지금 ··· 메뉴로 접힌 헤더들

추가 속성

이름타입 / 기본값설명
헤더 너비(논리 픽셀)입니다. 줄여서 탭의 넘침 메뉴 이동을 확인합니다.

메서드

메서드설명
index의 탭을 활성화하고 selected 발생; 모르는 인덱스나 비활성 탭이면 무시
헤더를 다시 배치하고 overflowTabs 갱신; 폭과 탭이 바뀔 때는 헤더가 스스로 호출

시그널

시그널인자시점
detail: { tabkey, index }클릭, Space / Enter, 방향키, ··· 메뉴, setActiveTab()으로 탭이 활성화됨. 바인딩으로 active를 설정할 때와 비활성 탭에서는 아님
detail: { type }도움말("information") 또는 종("notification") 버튼이 클릭됨
detail: { value }검색 필드의 글자가 바뀜(편집마다)

동작

항목동작 / 조건
제목 앞의 아이템
로고 뒤의 앱 이름(16 px 중간 굵기); 비어 있으면 숨김
200 px 검색 필드; changed({ value }) 보고
도움말 버튼; actionClick({ type: "information" }) 보고
종 버튼; actionClick({ type: "notification" }) 보고
검색 필드와 버튼 뒤, 오른쪽 끝의 아이템
SyTab 헤더(하나, 또는 대괄호 목록)
활성 탭의 인덱스; 설정하면 조용히 전환, 읽어서 알 수 있음
index의 탭을 활성화하고 selected 발생; 모르는 인덱스나 비활성 탭이면 무시
클릭, Space / Enter, 방향키, ··· 메뉴, setActiveTab()으로 탭이 활성화됨. 바인딩으로 active를 설정할 때와 비활성 탭에서는 아님
모든 탭, 검색 필드, 정보 / 알림 버튼, actions 아이템 멈춤
지금 ··· 메뉴로 접힌 헤더들
헤더를 다시 배치하고 overflowTabs 갱신; 폭과 탭이 바뀔 때는 헤더가 스스로 호출
closable 헤더의 ×는 헤더를 바에서 제거합니다(탭 자신의 closed 시그널이 발생; 헤더 자체에는 닫힘 시그널이 없음).
검색 필드의 글자가 바뀜(편집마다)
도움말("information") 또는 종("notification") 버튼이 클릭됨
Tab이 사용 가능한 헤더, 검색 필드, 버튼, 작업을 차례로 지납니다. 포커스된 헤더에서 Left / Up과 Right / Down은 이전 / 다음 사용 가능한 탭으로(순환, 활성화), Space / Enter는 선택.

키보드

항목동작 / 조건
SyTab 헤더(하나, 또는 대괄호 목록)