QML
← 전체 컴포넌트

Popconfirm

삭제처럼 확인이 필요한 작업 바로 옆에 질문과 확인·취소 버튼을 표시합니다.

import Syidax.Core.Popconfirm

지원 QML 타입

타입정의 / 역할
확인·취소 동작을 제공하는 트리거 기준 확인 팝업입니다.

예제로 보기

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

01 기본 구성

SyPopconfirm은 행동하기 전에 묻는 팝오버입니다: 확인이 필요한 아이템 — 삭제 버튼, 게시 버튼 — 안에 선언하고 그 안에 질문을 선언하면, 아이템 클릭이 내용 아래에 Cancel과 OK가 있는 팝컨펌을 엽니다.

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 position: "top"
        property string trigger: "click"
        property bool arrow: true
        property string confirmText: "OK"
        property string cancelText: "Cancel"
        property bool sticky: false
        property string animation: "none"
    }

    

    Item {
        width: 320
        height: 140
        Column {
            anchors.centerIn: parent
            spacing: 12
            SyButton {
                text: "삭제"
                SyPopconfirm { id: exampleControl1; 
                    position: storyArgs.position
                    trigger: storyArgs.trigger
                    arrow: storyArgs.arrow
                    confirmText: storyArgs.confirmText
                    cancelText: storyArgs.cancelText
                    sticky: storyArgs.sticky
                    animation: storyArgs.animation
                    onSelected: (choice) => output.log(choice)
                    Text { text: "이 행을 삭제할까요?"; font.family: Theme.fontFamily; font.pixelSize: 13; color: Theme.popconfirm.textEnabled }
                }
            }
            EventLog { id: output; width: 280 }
        }
    }

}

02 position · arrow

position · arrow의 설정과 실행 결과를 비교합니다.

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

pragma ComponentBehavior: Bound

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

    id: story
    readonly property var positions: ["top", "bottom"]

    Item {
        width: 420
        height: 300
        Row {
            anchors.centerIn: parent
            spacing: 120
            Repeater {
                model: story.positions
                delegate: SyButton {
                    id: cell
                    required property string modelData
                    text: cell.modelData
                    width: 100
                    SyPopconfirm { id: featureTarget0;
                        position: cell.modelData; arrow: true; trigger: "none"
                        Component.onCompleted: { Qt.callLater(setOpen);  }
                        Text { text: "이 행을 삭제할까요?"; font.family: Theme.fontFamily; font.pixelSize: 13; color: Theme.popconfirm.textEnabled }
                    }
                }
            }
        }
    }
}

03 confirmText · cancelText

confirmText와 cancelText는 두 버튼의 라벨입니다 — 기본 "OK"와 "Cancel"; 결정의 동사로 바꾸십시오("예, 게시" / "아직", "삭제" / "유지").

Qt 실행 화면 · 이미지
confirmText · cancelText · 열린 화면
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

    SyButton {
        text: "게시"
        SyPopconfirm { id: featureTarget0;
            confirmText: "지금 게시"; cancelText: "아직"; arrow: true
            Column {
                spacing: 4
                Text { text: "페이지를 게시할까요?"; font.weight: Font.Medium; font.family: Theme.fontFamily; font.pixelSize: 14; color: Theme.popconfirm.textEnabled }
                Text { text: "링크가 있는 모두가 보게 됩니다."; color: Theme.semantic.textSubtle; font.family: Theme.fontFamily; font.pixelSize: 12 }
            }
        }
    }
}

04 selected · visibleChanged

selected(choice)는 두 버튼 중 하나를 누를 때 — 또는 okClick() / cancelClick()을 부를 때 — choice에 문자열 "ok" 또는 "cancel"을 담아 발생하며, 직후 팝컨펌이 닫힙니다.

Qt 실행 화면 · 이미지
selected · visibleChanged · 열린 화면
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
        SyButton {
            text: "삭제"
            SyPopconfirm {
                id: confirm
                arrow: true
                onSelected: (choice) => { if (true) { output.log(("selected: %1").arg(choice)) } }
                onVisibleChanged: { if (true) { output.log(("visible: %1").arg(confirm.visible)) } }
                Text { text: "이 행을 삭제할까요?"; font.family: Theme.fontFamily; font.pixelSize: 13; color: Theme.popconfirm.textEnabled }
            }
        }
        EventLog { id: output }
    }
}

05 setOpen · setClose · okClick · cancelClick

setOpen()은 팝컨펌을 열고 setClose()는 닫습니다 — trigger와 상관없이 코드에서.

Qt 실행 화면 · 이미지
setOpen · setClose · okClick · cancelClick · 열린 화면
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: 24
        Item {
            width: 560; height: 220
            SyButton {
                x: 24; y: 24
 text: "삭제"; SyPopconfirm { id: confirm; trigger: "none"; arrow: true; onSelected: (choice) => output.log(choice); Text { text: "이 행을 삭제할까요?"; font.family: Theme.fontFamily; font.pixelSize: 13; color: Theme.popconfirm.textEnabled } } }
        }
        Flow {
            objectName: "exampleCommands"

            width: 560
            spacing: 8
            SyButton { id: exampleControl1;  visible: true; text: "confirm.setOpen()"; variant: "secondary"; size: "small"; onClicked: confirm.setOpen() }
            SyButton { id: exampleControl2;  visible: true; text: "confirm.setClose()"; variant: "secondary"; size: "small"; onClicked: confirm.setClose() }
            SyButton { id: exampleControl3;  visible: true; text: "confirm.okClick()"; variant: "secondary"; size: "small"; onClicked: confirm.okClick() }
            SyButton { id: exampleControl4;  visible: true; text: "confirm.cancelClick()"; variant: "secondary"; size: "small"; onClicked: confirm.cancelClick() }
        }
        EventLog { id: output }
    }
}

06 화살표 없는 확인창

arrow 설정을 적용한 화살표 없는 확인창 예제입니다.

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 position: "top"
        property string trigger: "click"
        property bool arrow: false
        property string confirmText: "OK"
        property string cancelText: "Cancel"
        property bool sticky: false
        property string animation: "none"
    }

    

    Item {
        width: 320
        height: 140
        Column {
            anchors.centerIn: parent
            spacing: 12
            SyButton {
                text: "삭제"
                SyPopconfirm { id: exampleControl1; 
                    position: storyArgs.position
                    trigger: storyArgs.trigger
                    arrow: storyArgs.arrow
                    confirmText: storyArgs.confirmText
                    cancelText: storyArgs.cancelText
                    sticky: storyArgs.sticky
                    animation: storyArgs.animation
                    onSelected: (choice) => output.log(choice)
                    Text { text: "이 행을 삭제할까요?"; font.family: Theme.fontFamily; font.pixelSize: 13; color: Theme.popconfirm.textEnabled }
                }
            }
            EventLog { id: output; width: 280 }
        }
    }

}

API 62

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

속성

속성타입기본값설명
list (기본 속성)—질문: 안에 선언한 아이템, 버튼 위에 보입니다.
string"OK"primary 버튼의 라벨(selected("ok") 발생).
string"Cancel"보조 버튼의 라벨(selected("cancel") 발생).
string"top""top" · "topLeft" · "topRight" · "bottom" · "bottomLeft" · "bottomRight" · "left" · "leftTop" · "leftBottom" · "right" · "rightTop" · "rightBottom".
string"click""click"(앵커 탭이 토글) · "none"(코드만).
boolfalse앵커를 향한 포인터를 보입니다.
boolfalseEscape / 바깥 누름 닫힘 없음. 버튼과 setClose()는 여전히 닫습니다.
int0열기 / 닫기까지의 밀리초.
int0열기 / 닫기까지의 밀리초.
string"none""none" · "fade"; 속도 "x-fast" · "fast" · "medium" · "slow" · "x-slow".
string"fast""none" · "fade"; 속도 "x-fast" · "fast" · "medium" · "slow" · "x-slow".
Item선언된 아이템따라다닐 아이템(세 단계 안에서 hovered를 가진 가장 가까운 조상으로 결정).
bool (읽기 전용)—팝컨펌이 보임.
string (읽기 전용)—뒤집기 뒤의 쪽, -start / -end 포함.
color팝컨펌 토큰면의 모양.
color옅은 테두리면의 모양.
real2면의 모양.
booltrue면의 모양.
real12내용과 가장자리 사이의 공간.
real10 / 4베이스 팝업 기하.
booltrue베이스 팝업 기하.
boolfalse베이스 팝업 기하.
읽기 전용—계산된 속도, 현재 쪽, 앵커가 열기를 받는지, 오버레이 좌표의 앵커 사각형.
읽기 전용—계산된 속도, 현재 쪽, 앵커가 열기를 받는지, 오버레이 좌표의 앵커 사각형.
읽기 전용—계산된 속도, 현재 쪽, 앵커가 열기를 받는지, 오버레이 좌표의 앵커 사각형.
읽기 전용—계산된 속도, 현재 쪽, 앵커가 열기를 받는지, 오버레이 좌표의 앵커 사각형.

메서드

메서드설명
selected("ok")를 발생시키고 닫습니다 — OK 버튼이 하는 일 그대로. 닫힌 동안에도 동작합니다.
selected("cancel")를 발생시키고 닫습니다 — Cancel 버튼이 하는 일 그대로.
대기 중인 지연을 취소하고 트리거와 상관없이 엽니다 — 앵커가 disabled / readonly / 비활성이면 제외.
대기 중인 지연을 취소하고 selected 없이 닫습니다. sticky여도 닫습니다.
베이스 팝업의 즉시 열기 / 닫기와 트리거식 토글.
베이스 팝업의 즉시 열기 / 닫기와 트리거식 토글.
베이스 팝업의 즉시 열기 / 닫기와 트리거식 토글.
배치를 다시 계산합니다. 앵커·크기·창 변화에 자동입니다.

시그널

시그널인자발생 시점
choice: string — "ok" 또는 "cancel"버튼을 눌렀거나 okClick() / cancelClick()을 불렀을 때. 직후 팝업이 닫힙니다. Escape, 바깥 누름, setClose(), 앵커 토글에는 발생하지 않습니다.
—(visible / isOpen을 읽으십시오)어떤 경로로든 팝업이 열리거나 닫힘.
—팝업이 표시되기 직전에 발생합니다.
—팝업의 열기 전환이 끝나면 발생합니다.
—팝업이 숨겨지기 직전에 발생합니다.
—팝업의 닫기 전환이 끝나면 발생합니다.

동작

항목동작 / 조건
팝컨펌이 선언된 아이템. 컨트롤의 내용 안에서는 최대 세 단계 부모를 올라가 불리언 hovered를 가진 가장 가까운 아이템을 찾으므로 컨트롤 자체가 앵커입니다. 앵커의 자식이 되고 창 오버레이에 그려지며 앵커를 따라다닙니다.
"click"(앵커 탭이 토글) · "none"(코드만).
대기 중인 지연을 취소하고 트리거와 상관없이 엽니다 — 앵커가 disabled / readonly / 비활성이면 제외.
대기 중인 지연을 취소하고 selected 없이 닫습니다. sticky여도 닫습니다.
disabled나 readonly인 앵커는 열지 않으며, opendelay는 클릭에 적용되며, 어떤 경로로든 — Escape, 바깥 누름, close() — 닫히면 대기 중인 지연 열기가 취소됩니다.
disabled나 readonly인 앵커는 열지 않으며, opendelay는 클릭에 적용되며, 어떤 경로로든 — Escape, 바깥 누름, close() — 닫히면 대기 중인 지연 열기가 취소됩니다.
버튼을 눌렀거나 okClick() / cancelClick()을 불렀을 때. 직후 팝업이 닫힙니다. Escape, 바깥 누름, setClose(), 앵커 토글에는 발생하지 않습니다.
selected("ok")를 발생시키고 닫습니다 — OK 버튼이 하는 일 그대로. 닫힌 동안에도 동작합니다.
selected("cancel")를 발생시키고 닫습니다 — Cancel 버튼이 하는 일 그대로.
어떤 경로로든 팝업이 열리거나 닫힘.
visibleChanged / closed()로 알아채십시오.
Escape / 바깥 누름 닫힘 없음. 버튼과 setClose()는 여전히 닫습니다.
내용(기본 속성; 아이템에 크기나 Column을 주십시오) 위에, 그 아래 오른쪽 정렬된 small 버튼 두 개의 행: cancelText(기본 스타일) 다음 confirmText(primary), 4 px 간격, 내용 아래 8 px. 내용은 최소한 버튼만큼 넓습니다. 12 px 여백, 2 px 모서리, 옅은 1 px 테두리, 부드러운 그림자. 면은 글자색을 정하지 않으므로 Theme.popconfirm.textEnabled를 쓰십시오.
"top" · "topLeft" · "topRight" · "bottom" · "bottomLeft" · "bottomRight" · "left" · "leftTop" · "leftBottom" · "right" · "rightTop" · "rightBottom".
뒤집기 뒤의 쪽, -start / -end 포함.
앵커를 향한 포인터를 보입니다.
애니메이션 — animation: "fade"("none"이 아닌 모든 이름)는 animationMs(x-fast 100 · fast 150 · medium 250 · slow 350 · x-slow 500)에 걸쳐 페이드합니다.
애니메이션 — animation: "fade"("none"이 아닌 모든 이름)는 animationMs(x-fast 100 · fast 150 · medium 250 · slow 350 · x-slow 500)에 걸쳐 페이드합니다.
팝컨펌이 보임.
상태 — isOpen은 팝업의 visible입니다.

키보드

항목동작 / 조건
더 큰 결정에는 SyModal, 결정 없는 정보에는 SyPopover, 안내에는 SyTooltip; 흔한 앵커이자 안의 두 버튼으로 SyButton.
closable(기본 true)은 외부 클릭/Escape 종료를 제어하며 sticky와 독립입니다. OK/Cancel 및 setClose()는 명시적 종료이므로 closable=false에서도 동작합니다.