이 페이지에서

QRangeModelAdapter::DataReference Struct

struct QRangeModelAdapter::DataReference

DataReference는 데이터 스킴( QRangeModel) 내의 항목을 감싸는 참조 래퍼입니다. 더 보기...

이 구조체는 기술 미리보기 단계에 있으며 변경될 수 있습니다.

이 구조체는 Qt 6.11에서 도입되었습니다.

공개 유형

공개 함수

DataReference(const QModelIndex &index)
DataReference(const QRangeModelAdapter<Range, Protocol, Model>::DataReference &other)
DataReference(QRangeModelAdapter<Range, Protocol, Model>::DataReference &&other)
~DataReference()
QRangeModelAdapter<Range, Protocol, Model>::DataReference::const_value_type get() const
bool isValid() const
operator QRangeModelAdapter<Range, Protocol, Model>::DataReference::const_value_type() const
QRangeModelAdapter<Range, Protocol, Model>::DataReference::pointer operator->() const
QRangeModelAdapter<Range, Protocol, Model>::DataReference &operator=(QRangeModelAdapter<Range, Protocol, Model>::DataReference &&other)
QRangeModelAdapter<Range, Protocol, Model>::DataReference &operator=(QRangeModelAdapter<Range, Protocol, Model>::DataReference::value_type &&value)
QRangeModelAdapter<Range, Protocol, Model>::DataReference &operator=(const QRangeModelAdapter<Range, Protocol, Model>::DataReference &other)
QRangeModelAdapter<Range, Protocol, Model>::DataReference &operator=(const QRangeModelAdapter<Range, Protocol, Model>::DataReference::value_type &value)

상세 설명

at()의 non-const 오버로드, 인덱스 operator[] 를 사용하거나, non-const iterator 의 참조를 해제하여 모델의 항목에 접근하면, 모델의 항목을 감싸는 DataReference 래퍼가 반환됩니다.

해당 참조 래퍼에 값을 할당하면 QAbstractItemModel API를 사용하여 모델의 데이터가 변경됩니다.

adapter[0] = newValue;

값 자체의 const 버전은 get() 또는 operator->()를 사용하여 액세스할 수 있습니다.

QRangeModelAdapter adapter(QList<Gadget>{ ~~~ });
auto value = adapter[0]->value();
// adapter[0]->setValue(); // not allowed - would not emit dataChanged()

std::reference_wrapper 와 달리, 한 DataReference를 다른 DataReference에 할당해도 참조가 재바인딩되지는 않으며, 복사 의미론을 사용하여 값이 설정됩니다.

adapter[0] = adapter[1]; // items at row 0 and row 1 now have the same value

RowReference 및 ConstRowReference도 참조하십시오 .

멤버 유형 문서

[alias] DataReference::const_value_type

기본 범위에 저장된 항목의 const 유형에 대한 별칭입니다. 모델 내의 서로 다른 열이 서로 다른 유형을 갖는 경우, 이는 const QVariant 의 별칭이 됩니다.

[alias] DataReference::pointer

operator->()가 반환하는 포인터 유형의 별칭입니다.

[alias] DataReference::value_type

기본 범위에 저장된 항목의 유형에 대한 별칭입니다. 모델 내의 서로 다른 열이 서로 다른 유형을 갖는 경우, 이는 QVariant 의 별칭입니다.

멤버 함수 설명서

[explicit noexcept] DataReference::DataReference(const QModelIndex &index)

index 에 있는 항목에 대한 DataReference 래퍼를 생성합니다.

[default] DataReference::DataReference(const QRangeModelAdapter<Range, Protocol, Model>::DataReference &other)

other 의 복사본을 생성합니다.

[default] DataReference::DataReference(QRangeModelAdapter<Range, Protocol, Model>::DataReference &&other)

other 에서 이동하여 DataReference를 생성합니다.

[default] DataReference::~DataReference()

DataReference 의 인스턴스를 삭제합니다.

QRangeModelAdapter<Range, Protocol, Model>::DataReference::const_value_type DataReference::get() const

DataReference::operator QRangeModelAdapter<Range, Protocol, Model>::DataReference::const_value_type() const

이 ` DataReference `이 가리키는 항목 값을 const 값으로 반환합니다.

bool DataReference::isValid() const

이 ` DataReference `가 유효한 모델 인덱스를 가리키는 경우 true를 반환합니다.

QRangeModelAdapter<Range, Protocol, Model>::DataReference::pointer DataReference::operator->() const

이 ` DataReference`가 가리키는 값에 대한 포인터를 반환합니다.

QRangeModelAdapter<Range, Protocol, Model>::DataReference &DataReference::operator=(QRangeModelAdapter<Range, Protocol, Model>::DataReference &&other)

값 참조를 other 만큼 이동시켜 이 래퍼가 참조하는 값으로 옮깁니다.

QRangeModelAdapter<Range, Protocol, Model>::DataReference &DataReference::operator=(QRangeModelAdapter<Range, Protocol, Model>::DataReference::value_type &&value)

value 를 기본 모델 항목에 할당합니다.

QRangeModelAdapter<Range, Protocol, Model>::DataReference &DataReference::operator=(const QRangeModelAdapter<Range, Protocol, Model>::DataReference &other)

other 가 가리키는 항목 값을 이 래퍼가 참조하는 값에 할당합니다.

QRangeModelAdapter<Range, Protocol, Model>::DataReference &DataReference::operator=(const QRangeModelAdapter<Range, Protocol, Model>::DataReference::value_type &value)

value 를 기본 모델 항목에 할당합니다.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.