기본 입력
FileDropZone 파일 드롭 영역
로컬 파일 드롭을 수락하고 찾아보기를 클릭하면 애플리케이션에 파일 선택기를 열도록 요청합니다.
예제
속성 미리 보기를 불러오지 못했습니다. 속성 미리 보기를 다시 선택해 재시도하세요.

사용법
작업 공간에 추가
filesDropped는 드롭된 로컬 URL을 제공합니다. browseRequested를 연결해 파일 선택기를 열고, 애플리케이션에서 파일 형식과 크기를 확인합니다.
#include <FluentQt/BasicInput.h>
using namespace fluent::basicinput;
auto* panel = new QWidget(this);
auto* layout = new QVBoxLayout(panel);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(24);
auto* drop = new FileDropZone(panel);
drop->setObjectName("fileDropZone");
drop->setDescription("Add documents, images or a ZIP archive.");
drop->setHintText("PDF, PNG, JPG, ZIP · Up to 20 MB per file");
layout->addWidget(drop);
auto* heading = new Label("Files", panel);
heading->setFluentTypography(Typography::FontRole::BodyStrong);
layout->addWidget(heading);
auto* model = new QStandardItemModel(panel);
auto addFile = [model](const QString& name, const QString& detail,
FileListView::Status state, qreal progress) {
auto* item = new QStandardItem(name);
item->setData(detail, FileListView::MetadataRole);
item->setData(state, FileListView::StatusRole);
item->setData(progress, FileListView::ProgressRole);
model->appendRow(item);
};
addFile("brand-guidelines.pdf", "2.4 MB · Ready to use", FileListView::Ready, 1.0);
addFile("product-shot.png", "3.6 / 5.8 MB · Uploading", FileListView::Uploading, 0.62);
addFile("archive.zip", "28 MB · Exceeds the 20 MB limit", FileListView::Rejected, 0.0);
auto* files = new FileListView(panel);
files->setObjectName("selectedFiles");
files->setAccessibleName("Selected files");
files->setBackgroundVisible(false);
files->setBorderVisible(false);
files->setProperty("fluentPreserveParentSurface", true);
files->viewport()->setProperty("fluentPreserveParentSurface", true);
files->setMinimumHeight(260);
files->setModel(model);
layout->addWidget(files);
QObject::connect(files, &FileListView::removeRequested, panel,
[model](const QModelIndex& index) { model->removeRow(index.row()); });
auto acceptFile = [drop, addFile](const QString& name, qint64 bytes) {
const QString suffix = QFileInfo(name).suffix().toLower();
const bool typeAllowed = QStringList{"pdf", "png", "jpg", "jpeg", "zip"}.contains(suffix);
const bool sizeAllowed = bytes <= 20 * 1024 * 1024;
if (!typeAllowed || !sizeAllowed) {
const QString reason = !typeAllowed ? "This file type is not supported."
: "Choose a file under 20 MB.";
drop->setErrorMessage(name + " · " + reason);
addFile(name, reason, FileListView::Rejected, 0.0);
return;
}
drop->clearError();
addFile(name, QString::number(bytes / (1024.0 * 1024.0), 'f', 1) + " MB · Ready to use",
FileListView::Ready, 1.0);
};
QObject::connect(drop, &FileDropZone::filesDropped, panel,
[acceptFile](const QList<QUrl>& urls) {
for (const QUrl& url : urls) {
const QFileInfo file(url.toLocalFile());
if (file.isFile())
acceptFile(file.fileName(), file.size());
}
});
QObject::connect(drop, &FileDropZone::browseRequested, panel, [panel, acceptFile]() {
platform::chooseFiles(panel, "Documents (*.pdf *.png *.jpg *.jpeg *.zip)", acceptFile);
});import fluentqt
from PySide6.QtCore import QFileInfo, Qt
from PySide6.QtGui import QStandardItem, QStandardItemModel
from PySide6.QtWidgets import QFileDialog, QVBoxLayout, QWidget
panel = QWidget()
layout = QVBoxLayout(panel)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(24)
model = QStandardItemModel(panel)
roles = fluentqt.FileListView.DataRole
states = fluentqt.FileListView.Status
def add_file(name, detail, state, progress):
item = QStandardItem(name)
item.setData(detail, roles.MetadataRole)
item.setData(state, roles.StatusRole)
item.setData(progress, roles.ProgressRole)
model.appendRow(item)
add_file("brand-guidelines.pdf", "2.4 MB · Ready to use", states.Ready, 1.0)
add_file("product-shot.png", "3.6 / 5.8 MB · Uploading", states.Uploading, 0.62)
add_file("archive.zip", "28 MB · Exceeds the 20 MB limit", states.Rejected, 0.0)
drop = fluentqt.FileDropZone(panel)
drop.setObjectName("fileDropZone")
drop.setDescription("Add documents, images or a ZIP archive.")
drop.setHintText("PDF, PNG, JPG, ZIP · Up to 20 MB per file")
layout.addWidget(drop)
heading = fluentqt.Label("Files", panel)
heading.setFluentTypography(fluentqt.FontRole.BodyStrong)
layout.addWidget(heading)
files = fluentqt.FileListView(panel)
files.setObjectName("selectedFiles")
files.setAccessibleName("Selected files")
files.setBackgroundVisible(False)
files.setBorderVisible(False)
files.setProperty("fluentPreserveParentSurface", True)
files.viewport().setProperty("fluentPreserveParentSurface", True)
files.setMinimumHeight(260)
files.setModel(model)
layout.addWidget(files)
files.removeRequested.connect(lambda index: model.removeRow(index.row()))
def accept_file(path):
file = QFileInfo(path)
if not file.isFile():
return
type_allowed = file.suffix().lower() in ("pdf", "png", "jpg", "jpeg", "zip")
size_allowed = file.size() <= 20 * 1024 * 1024
if not type_allowed or not size_allowed:
reason = "Choose a file under 20 MB."
if not type_allowed:
reason = "This file type is not supported."
drop.setErrorMessage(file.fileName() + " · " + reason)
add_file(file.fileName(), reason, states.Rejected, 0.0)
return
drop.clearError()
detail = f"{file.size() / (1024 * 1024):.1f} MB · Ready to use"
add_file(file.fileName(), detail, states.Ready, 1.0)
def dropped(urls):
for url in urls:
accept_file(url.toLocalFile())
def browse():
dialog = QFileDialog(panel, "Choose files")
dialog.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
dialog.setFileMode(QFileDialog.FileMode.ExistingFiles)
dialog.setNameFilter("Documents (*.pdf *.png *.jpg *.jpeg *.zip)")
dialog.filesSelected.connect(
lambda paths: [accept_file(path) for path in paths]
)
dialog.open()
panel._file_dialog = dialog
drop.filesDropped.connect(dropped)
drop.browseRequested.connect(browse)API
선언 보기일치하는 API 멤버가 없습니다.
fluent::basicinput::FileDropZone
상속 대상 QWidget · FluentElement · QMLPlus
앱에서 제공하는 파일 선택기를 여는 버튼이 있는 로컬 파일 드롭 영역입니다. 로컬 파일만 허용하며 (원격 URL이 포함된 드래그는 무시), 파일 대화상자와 I/O는 앱에서 처리합니다.
생성자
메서드
QString hintText() const선택적 형식 또는 크기 제한 힌트 텍스트.
void setHintText(const QString& text)선택적 형식 또는 크기 제한 힌트 텍스트.
QString errorMessage() const지워질 때까지 설명 텍스트를 임시로 대체하는 유효성 검사 오류 텍스트입니다. 이후 드롭 동작으로는 자동으로 지워지지 않습니다.
void setErrorMessage(const QString& message)지워질 때까지 설명 텍스트를 임시로 대체하는 유효성 검사 오류 텍스트입니다. 이후 드롭 동작으로는 자동으로 지워지지 않습니다.
속성
QString title- 읽기
title()쓰기setTitle()알림 신호titleChanged() QString description- 읽기
description()쓰기setDescription()알림 신호descriptionChanged() QString hintText선택적 형식 또는 크기 제한 힌트 텍스트.
읽기hintText()쓰기setHintText()알림 신호hintTextChanged()QString browseText- 읽기
browseText()쓰기setBrowseText()알림 신호browseTextChanged() QString errorMessage지워질 때까지 설명 텍스트를 임시로 대체하는 유효성 검사 오류 텍스트입니다. 이후 드롭 동작으로는 자동으로 지워지지 않습니다.
읽기errorMessage()쓰기setErrorMessage()알림 신호errorMessageChanged()bool dragActive- 읽기
isDragActive()알림 신호dragActiveChanged()
시그널
void hintTextChanged(const QString& text)선택적 형식 또는 크기 제한 힌트 텍스트.
void errorMessageChanged(const QString& message)지워질 때까지 설명 텍스트를 임시로 대체하는 유효성 검사 오류 텍스트입니다. 이후 드롭 동작으로는 자동으로 지워지지 않습니다.
void browseRequested()애플리케이션에서 제공하는 파일 선택기를 요청합니다.
void filesDropped(const QList<QUrl>& urls)드롭된 로컬 파일 URL을 원래 순서대로 담아 발생합니다.
보호된 멤버
메서드
fluent::FluentElement에서 상속됨
열거형
enum Theme디자인 토큰을 해석할 때 사용되는 전역 시각적 테마.
Light = 0Dark = 1HighContrast = 2
메서드
static void setTheme(Theme theme)전역 테마를 업데이트하고 활성 FluentElement 인스턴스에 알립니다.
static void setThemeDeferred(Theme theme)현재 상호 작용을 차단하지 않고 보이는 항목 우선의 일괄 테마 새로 고침을 예약합니다.
static Theme currentTheme()현재 활성화된 전역 테마를 반환합니다.
static bool themeUsesDarkAppearance(Theme theme)테마가 어두운 배경의 크롬 및 머티리얼 토큰을 사용하는지 여부를 반환합니다.
static void refreshTheme()디자인 토큰 변경 후 다시 그리도록 현재 테마를 재브로드캐스트합니다.
static int themeGeneration()유효성 검사를 위해 테마가 변경될 때마다 증가하는 단조 카운터.
Theme effectiveTheme() const상속된 QWidget 재정의를 준수하여 이 요소에서 사용하는 테마를 확인합니다.
bool effectiveThemeUsesDarkAppearance() const이 요소의 유효 테마가 어두운 배경의 크롬을 사용하는지 여부를 반환합니다.
bool setThemeOverrides(const QJsonObject& overrides)이 요소의 희소 색상, 반경 및 글꼴 토큰 재정의를 교체합니다.
QJsonObject themeOverrides() const이 요소에 지정된 재정의 설정을 반환합니다.
void clearThemeOverrides()모든 토큰 필드를 전역 테마 기본값으로 복원합니다.
const Colors& themeColorsRef() const빈번한 그리기 경로를 위한 활성 색상 세트의 무복사 접근.
Material::AcrylicToken themeAcrylic() const재질, 고도 (elevation) 및 적응형 레이아웃 토큰.
QColor themeBackdrop(bool active) const지정된 활성화 상태에 대한 창 chrome 배경색.
virtual void onThemeUpdated()전역 테마가 변경된 후 호출됩니다.
타입 및 별칭
struct Colors컴포넌트에 반환되는 디자인 토큰 스냅샷.
fluent::QMLPlus에서 상속됨
메서드
AnchorLayout::Anchors* anchors()QWidget 호스트의 변경 가능한 앵커를 반환합니다.
void setState(const QString& name)이름으로 등록된 상태를 적용하거나, @p name 값이 비어 있으면 기본 상태를 복원합니다. 알 수 없는 이름은 무시되며, 상태를 벗어날 때 기존 바인딩이 다시 시작됩니다.
void addState(const QMLState& state)명명된 상태 정의를 등록하거나 교체합니다. 활성 상태를 교체하면 즉시 적용됩니다.
void evaluateStates()등록 순서대로 상태 조건을 재평가하여 첫 번째로 일치하는 상태를 활성화하며, 일치하는 항목이 없으면 기본 상태를 활성화합니다. 종속성 속성이 알림을 보낼 때도 자동으로 실행되며, extend를 사용하는 파생 상태는 순환하거나 누락되지 않는 한 상위 상태의 변경 사항을 상속합니다.
QMLPlusRuntime* runtime()이 호스트가 소유하고 지연 생성하는 상태 관찰자를 반환합니다.
void setAnchors(const AnchorLayout::Anchors& anchors)모든 호스트 앵커를 교체하고 상위 레이아웃을 무효화합니다.
void resetAnchors()모든 호스트 앵커를 지우고 부모 레이아웃을 무효화합니다.
void bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)PropertyBinder::bind()를 통해 @p source의 @p sourceProp을 이 QWidget 호스트의 @p targetProp에 바인딩합니다.
BindingHandle bindManaged(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction direction = PropertyBinder::OneWay, BindingOptions options = {})이 QWidget 호스트에 관리되는 직접 바인딩을 설치합니다.
BindingHandle bindComputed(const char* targetProp, const QVector<BindingDependency>& dependencies, std::function<QVariant()> evaluate, BindingOptions options = {})이 QWidget 호스트에 명시적 종속성 C++ 표현식을 설치합니다.
void addTransition(const StateTransition& transition)우선순위 순서대로 상태 전환을 등록합니다.
void setBehavior(const char* propertyName, const PropertyAnimation& animation)writeProperty() 또는 바인딩을 통해 @p propertyName에 쓸 때 사용되는 기본 애니메이션을 설정합니다. 명시적 StateTransition 규칙이 우선하며, 직접 C++ setter 호출에는 애니메이션이 적용되지 않습니다.
void clearBehavior(const char* propertyName)이후 관리되는 쓰기 작업의 기본 애니메이션을 제거합니다.
bool writeProperty(const char* propertyName, const QVariant& value)바인딩을 제거하지 않고 Behavior를 통해 호스트 속성을 씁니다.
Qt 기본 클래스 문서: QWidget