QHeaderView Class
QHeaderView 클래스는 항목 보기를 위한 머리글 행 또는 머리글 열을 제공합니다. 더 보기...
Header: | #include <QHeaderView> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
상속합니다: | QAbstractItemView |
공용 유형
enum | ResizeMode { Interactive, Fixed, Stretch, ResizeToContents, Custom } |
속성
|
|
공용 함수
QHeaderView(Qt::Orientation orientation, QWidget *parent = nullptr) | |
virtual | ~QHeaderView() |
bool | cascadingSectionResizes() const |
int | count() const |
Qt::Alignment | defaultAlignment() const |
int | defaultSectionSize() const |
int | hiddenSectionCount() const |
void | hideSection(int logicalIndex) |
bool | highlightSections() const |
bool | isFirstSectionMovable() const |
bool | isSectionHidden(int logicalIndex) const |
bool | isSortIndicatorClearable() const |
bool | isSortIndicatorShown() const |
int | length() const |
int | logicalIndex(int visualIndex) const |
int | logicalIndexAt(const QPoint &pos) const |
int | logicalIndexAt(int position) const |
int | logicalIndexAt(int x, int y) const |
int | maximumSectionSize() const |
int | minimumSectionSize() const |
void | moveSection(int from, int to) |
int | offset() const |
Qt::Orientation | orientation() const |
void | resetDefaultSectionSize() |
int | resizeContentsPrecision() const |
void | resizeSection(int logicalIndex, int size) |
void | resizeSections(QHeaderView::ResizeMode mode) |
bool | restoreState(const QByteArray &state) |
QByteArray | saveState() const |
int | sectionPosition(int logicalIndex) const |
QHeaderView::ResizeMode | sectionResizeMode(int logicalIndex) const |
int | sectionSize(int logicalIndex) const |
int | sectionSizeHint(int logicalIndex) const |
int | sectionViewportPosition(int logicalIndex) const |
bool | sectionsClickable() const |
bool | sectionsHidden() const |
bool | sectionsMovable() const |
bool | sectionsMoved() const |
void | setCascadingSectionResizes(bool enable) |
void | setDefaultAlignment(Qt::Alignment alignment) |
void | setDefaultSectionSize(int size) |
void | setFirstSectionMovable(bool movable) |
void | setHighlightSections(bool highlight) |
void | setMaximumSectionSize(int size) |
void | setMinimumSectionSize(int size) |
void | setResizeContentsPrecision(int precision) |
void | setSectionHidden(int logicalIndex, bool hide) |
void | setSectionResizeMode(QHeaderView::ResizeMode mode) |
void | setSectionResizeMode(int logicalIndex, QHeaderView::ResizeMode mode) |
void | setSectionsClickable(bool clickable) |
void | setSectionsMovable(bool movable) |
void | setSortIndicator(int logicalIndex, Qt::SortOrder order) |
void | setSortIndicatorClearable(bool clearable) |
void | setSortIndicatorShown(bool show) |
void | setStretchLastSection(bool stretch) |
void | showSection(int logicalIndex) |
Qt::SortOrder | sortIndicatorOrder() const |
int | sortIndicatorSection() const |
bool | stretchLastSection() const |
int | stretchSectionCount() const |
void | swapSections(int first, int second) |
int | visualIndex(int logicalIndex) const |
int | visualIndexAt(int position) const |
재구현된 공용 함수
virtual void | reset() override |
virtual void | setModel(QAbstractItemModel *model) override |
virtual void | setVisible(bool v) override |
virtual QSize | sizeHint() const override |
공용 슬롯
void | headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast) |
void | setOffset(int offset) |
void | setOffsetToLastSection() |
void | setOffsetToSectionPosition(int visualSectionNumber) |
신호
void | geometriesChanged() |
void | sectionClicked(int logicalIndex) |
void | sectionCountChanged(int oldCount, int newCount) |
void | sectionDoubleClicked(int logicalIndex) |
void | sectionEntered(int logicalIndex) |
void | sectionHandleDoubleClicked(int logicalIndex) |
void | sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex) |
void | sectionPressed(int logicalIndex) |
void | sectionResized(int logicalIndex, int oldSize, int newSize) |
void | sortIndicatorChanged(int logicalIndex, Qt::SortOrder order) |
void | sortIndicatorClearableChanged(bool clearable) |
보호된 함수
virtual void | initStyleOption(QStyleOptionHeader *option) const |
(since 6.0) virtual void | initStyleOptionForIndex(QStyleOptionHeader *option, int logicalIndex) const |
virtual void | paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const |
virtual QSize | sectionSizeFromContents(int logicalIndex) const |
재구현된 보호 함수
virtual void | currentChanged(const QModelIndex ¤t, const QModelIndex &old) override |
virtual bool | event(QEvent *e) override |
virtual int | horizontalOffset() const override |
virtual void | mouseDoubleClickEvent(QMouseEvent *e) override |
virtual void | mouseMoveEvent(QMouseEvent *e) override |
virtual void | mousePressEvent(QMouseEvent *e) override |
virtual void | mouseReleaseEvent(QMouseEvent *e) override |
virtual void | paintEvent(QPaintEvent *e) override |
virtual void | setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags) override |
virtual int | verticalOffset() const override |
virtual bool | viewportEvent(QEvent *e) override |
보호된 슬롯
void | resizeSections() |
void | sectionsAboutToBeRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast) |
void | sectionsInserted(const QModelIndex &parent, int logicalFirst, int logicalLast) |
상세 설명
QHeaderView는 QTableView 및 QTreeView 클래스와 같은 항목 보기에 사용되는 헤더를 표시합니다. 이 클래스는 이전에 같은 용도로 사용되었던 Qt3의 QHeader
클래스를 대신하지만, 항목 뷰 클래스와의 일관성을 위해 Qt의 모델/뷰 아키텍처를 사용합니다.
QHeaderView 클래스는 모델/뷰 클래스 중 하나이며 Qt의 모델/뷰 프레임워크의 일부입니다.
헤더는 QAbstractItemModel::headerData() 함수를 사용하여 모델에서 각 섹션에 대한 데이터를 가져옵니다. QAbstractItemModel::setHeaderData ()를 사용하여 데이터를 설정할 수 있습니다.
각 헤더에는 orientation() 및 count() 함수에 의해 지정된 여러 섹션이 있습니다. 섹션은 방향에 따라 행 또는 열과 같은 헤더의 일부를 나타냅니다.
섹션은 moveSection() 및 resizeSection()를 사용하여 이동하고 크기를 조정할 수 있으며 hideSection() 및 showSection()를 사용하여 숨기거나 표시할 수도 있습니다.
헤더의 각 섹션은 섹션()으로 지정된 섹션 ID로 설명되며, 헤더의 특정 visualIndex()에서 찾을 수 있습니다. 섹션에는 setSortIndicator()로 정렬 표시기를 설정할 수 있으며, 이는 연결된 항목 보기의 항목이 섹션에서 지정한 순서대로 정렬될지 여부를 나타냅니다.
가로 헤더의 경우 섹션은 모델에서 열에 해당하며 세로 헤더의 경우 섹션은 모델에서 행에 해당합니다.
헤더 섹션 이동
헤더는 제자리에 고정하거나 setSectionsMovable()를 사용하여 움직일 수 있습니다. setSectionsClickable ()를 사용하여 클릭 가능하게 만들 수 있으며 setSectionResizeMode()에 따라 크기 조정 동작이 있습니다.
참고: 헤더를 두 번 클릭하여 섹션의 크기를 조정하면 표시되는 행에만 적용됩니다.
헤더는 사용자가 섹션을 이동하면 sectionMoved(), 섹션 크기를 조정하면 sectionResized(), 마우스 클릭에 반응하여 sectionClicked() 및 sectionHandleDoubleClicked()를 출력합니다. 헤더는 sectionCountChanged()도 전송합니다.
logicalIndex() 및 logicalIndexAt() 함수를 사용하여 섹션을 식별하거나 visualIndex() 및 visualIndexAt() 함수를 사용하여 인덱스 위치로 섹션을 식별할 수 있습니다. 섹션을 이동하면 시각적 인덱스는 변경되지만 논리적 인덱스는 변경되지 않습니다.
모양
QTableWidget 와 QTableView 는 기본 헤더를 만듭니다. 헤더를 표시하려면 setVisible()를 사용하면 됩니다.
모든 ItemDataRole가 QHeaderView에 영향을 미치는 것은 아닙니다. 다른 역할을 그려야 하는 경우 QHeaderView를 서브 클래싱하고 paintEvent()를 다시 구현할 수 있습니다. QHeaderView는 스타일과 충돌하지 않는 한 다음 항목 데이터 역할을 존중합니다(데스크톱 테마를 따르는 스타일에서 발생할 수 있음):
TextAlignmentRole, DisplayRole, FontRole, DecorationRole, ForegroundRole, 및 BackgroundRole.
참고: 각 헤더는 각 섹션의 데이터를 자체적으로 렌더링하며 델리게이트에 의존하지 않습니다. 따라서 헤더의 setItemDelegate() 함수를 호출해도 아무런 효과가 없습니다.
모델/보기 프로그래밍, QListView, QTableView, QTreeView 를참조하세요 .
멤버 유형 문서
enum QHeaderView::ResizeMode
크기 조정 모드는 헤더 섹션의 동작을 지정합니다. 전체 헤더 보기 또는 setSectionResizeMode()를 사용하여 개별 섹션에서 설정할 수 있습니다.
상수 | 값 | 설명 |
---|---|---|
QHeaderView::Interactive | 0 | 사용자가 섹션의 크기를 조정할 수 있습니다. resizeSection ()를 사용하여 프로그래밍 방식으로 섹션의 크기를 조정할 수도 있습니다. 섹션 크기는 기본값이 defaultSectionSize 입니다( cascadingSectionResizes 참조). |
QHeaderView::Fixed | 2 | 사용자는 섹션의 크기를 조정할 수 없습니다. 섹션은 resizeSection()를 사용하여 프로그래밍 방식으로만 크기를 조정할 수 있습니다. 섹션 크기는 기본값이 defaultSectionSize 입니다. |
QHeaderView::Stretch | 1 | QHeaderView 는 사용 가능한 공간에 맞게 섹션의 크기를 자동으로 조정합니다. 사용자나 프로그래밍 방식으로 크기를 변경할 수 없습니다. |
QHeaderView::ResizeToContents | 3 | QHeaderView 는 전체 열 또는 행의 내용을 기준으로 섹션의 크기를 최적의 크기로 자동 조정합니다. 사용자나 프로그래밍 방식으로 크기를 변경할 수 없습니다. (이 값은 4.2에 도입되었습니다.) |
다음 값은 더 이상 사용되지 않습니다:
상수 | 값 | 설명 |
---|---|---|
QHeaderView::Custom | Fixed | 대신 Fixed를 사용합니다. |
setSectionResizeMode(), stretchLastSection, minimumSectionSize 를참조하세요 .
속성 문서
cascadingSectionResizes : bool
이 속성은 사용자가 크기를 조정 중인 섹션이 최소 크기에 도달하면 대화형 크기 조정이 다음 섹션으로 계단식으로 적용될지 여부를 지정합니다.
이 속성은 크기 조정 모드가 Interactive 인 섹션에만 영향을 줍니다.
기본값은 false입니다.
함수 액세스:
bool | cascadingSectionResizes() const |
void | setCascadingSectionResizes(bool enable) |
setSectionResizeMode()도 참조하세요 .
defaultAlignment : Qt::Alignment
이 속성은 각 헤더 섹션에서 텍스트의 기본 맞춤을 유지합니다.
액세스 함수:
Qt::Alignment | defaultAlignment() const |
void | setDefaultAlignment(Qt::Alignment alignment) |
defaultSectionSize : int
이 속성은 크기를 조정하기 전 헤더 섹션의 기본 크기를 유지합니다.
이 속성은 크기 조정 모드가 Interactive 또는 Fixed 인 섹션에만 영향을 줍니다.
기본적으로 이 속성의 값은 스타일에 따라 달라집니다. 따라서 스타일이 변경되면 이 속성이 업데이트됩니다. setDefaultSectionSize()를 호출하면 업데이트가 중지되고, resetDefaultSectionSize()를 호출하면 기본 동작이 복원됩니다.
함수에 액세스합니다:
int | defaultSectionSize() const |
void | setDefaultSectionSize(int size) |
void | resetDefaultSectionSize() |
setSectionResizeMode() 및 minimumSectionSize 을참조하세요 .
firstSectionMovable : bool
이 속성은 사용자가 첫 번째 열을 이동할 수 있는지 여부를 보유합니다.
이 속성은 사용자가 첫 번째 열을 이동할 수 있는지 여부를 제어합니다. QTreeView 에서 첫 번째 열은 트리 구조를 유지하므로 setSectionsMovable(참) 이후에도 기본적으로 이동할 수 없습니다.
예를 들어 트리 구조가 없는 플랫 리스트의 경우 이 메서드를 호출하여 다시 움직일 수 있게 만들 수 있습니다. 이러한 시나리오에서는 QTreeView::setRootIsDecorated(false)도 호출하는 것이 좋습니다.
treeView->setRootIsDecorated(false); treeView->header()->setFirstSectionMovable(true);
setSectionsMovable(참)도 함께 호출하지 않는 한 참으로 설정해도 아무런 효과가 없습니다.
함수 액세스:
bool | isFirstSectionMovable() const |
void | setFirstSectionMovable(bool movable) |
setSectionsMovable()도 참조하세요 .
highlightSections : bool
이 속성은 선택한 항목이 포함된 섹션을 강조 표시할지 여부를 저장합니다.
기본적으로 이 속성은 false
입니다.
액세스 함수:
bool | highlightSections() const |
void | setHighlightSections(bool highlight) |
maximumSectionSize : int
이 속성은 헤더 섹션의 최대 크기를 보유합니다.
최대 섹션 크기는 허용되는 가장 큰 섹션 크기입니다. 이 속성의 기본값은 1048575이며, 이는 섹션에 허용되는 최대 크기이기도 합니다. 최대를 -1로 설정하면 값이 가장 큰 섹션 크기로 재설정됩니다.
스트레치를 제외하고 이 속성은 다음과 같은 모든 기능에 적용됩니다. resize modes
액세스 함수에 적용됩니다:
int | maximumSectionSize() const |
void | setMaximumSectionSize(int size) |
setSectionResizeMode() 및 defaultSectionSize 을참조하세요 .
minimumSectionSize : int
이 속성은 헤더 섹션의 최소 크기를 보유합니다.
최소 섹션 크기는 허용되는 가장 작은 섹션 크기입니다. 최소 섹션 크기가 -1로 설정된 경우 QHeaderView 은 font metrics 크기를 사용합니다.
이 속성은 모든 resize modes 에 적용됩니다.
액세스 함수에서 적용됩니다:
int | minimumSectionSize() const |
void | setMinimumSectionSize(int size) |
setSectionResizeMode() 및 defaultSectionSize 을참조하세요 .
sectionsClickable : bool
헤더를 클릭할 수 있는 경우 true
, 그렇지 않은 경우 false
을 보유합니다. 클릭 가능한 머리글을 설정하여 사용자가 머리글과 관련된 뷰에서 데이터의 표현을 변경할 수 있도록 할 수 있습니다.
액세스 함수:
bool | sectionsClickable() const |
void | setSectionsClickable(bool clickable) |
sectionPressed() 및 setSortIndicatorShown()도 참조하십시오 .
sectionsMovable : bool
sectionsMovable 이 참이면 사용자가 헤더 섹션을 이동할 수 있지만, 그렇지 않으면 제자리에 고정됩니다.
QTreeView 와 함께 사용하는 경우 첫 번째 열은 기본적으로 트리 구조를 포함하므로 이동할 수 없습니다. setFirstSectionMovable (참)을 사용하여 이동할 수 있도록 설정할 수 있습니다.
함수 액세스:
bool | sectionsMovable() const |
void | setSectionsMovable(bool movable) |
sectionMoved() 및 setFirstSectionMovable()도 참조하세요 .
showSortIndicator : bool
이 속성은 정렬 표시기 표시 여부를 보유합니다.
기본적으로 이 속성은 false
입니다.
함수에 액세스합니다:
bool | isSortIndicatorShown() const |
void | setSortIndicatorShown(bool show) |
setSectionsClickable()도 참조하세요 .
[since 6.1]
sortIndicatorClearable : bool
이 속성은 섹션을 여러 번 클릭하여 정렬 표시기를 지울 수 있는지 여부를 보유합니다.
이 속성은 사용자가 섹션을 여러 번 클릭하여 특정 섹션의 정렬 표시기를 제거할 수 있는지 여부를 제어합니다. 일반적으로 섹션을 클릭하면 해당 섹션의 정렬 순서만 변경됩니다. 이 속성을 true로 설정하면 오름차순과 내림차순으로 번갈아 가며 정렬 표시기가 지워지며, 일반적으로 모델의 원래 정렬이 복원됩니다.
sectionsClickable()도 참( QTableView 과 같은 특정 뷰의 기본값이거나 QTreeView::setSortingEnabled 을 호출하여 뷰를 정렬 가능하게 만들 때 자동으로 설정됨)이 아닌 경우 이 속성을 참으로 설정해도 아무런 영향을 미치지 않습니다.
이 프로퍼티는 Qt 6.1에 도입되었습니다.
액세스 함수:
bool | isSortIndicatorClearable() const |
void | setSortIndicatorClearable(bool clearable) |
알림 신호:
void | sortIndicatorClearableChanged(bool clearable) |
stretchLastSection : bool
이 속성은 헤더에서 마지막으로 표시되는 섹션이 사용 가능한 모든 공간을 차지할지 여부를 나타냅니다.
기본값은 false입니다.
참고: QTreeView 에서 제공하는 가로 머리글은 이 속성을 true로 설정하여 구성되므로 뷰가 머리글에 할당된 공간을 낭비하지 않습니다. 이 값을 true로 설정하면 이 속성이 머리글의 마지막 섹션에 설정된 크기 조정 모드를 재정의합니다.
함수 액세스:
bool | stretchLastSection() const |
void | setStretchLastSection(bool stretch) |
setSectionResizeMode()도 참조하세요 .
멤버 함수 문서
[explicit]
QHeaderView::QHeaderView(Qt::Orientation orientation, QWidget *parent = nullptr)
주어진 orientation 및 parent 으로 새 일반 헤더를 생성합니다.
[virtual noexcept]
QHeaderView::~QHeaderView()
헤더를 파괴합니다.
int QHeaderView::count() const
헤더에 있는 섹션의 수를 반환합니다.
sectionCountChanged() 및 length()도 참조하세요 .
[override virtual protected]
void QHeaderView::currentChanged(const QModelIndex ¤t, const QModelIndex &old)
재구현합니다: QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous).
[override virtual protected]
bool QHeaderView::event(QEvent *e)
다시 구현합니다: QAbstractItemView::event(QEvent * 이벤트).
[signal]
void QHeaderView::geometriesChanged()
이 신호는 헤더의 지오메트리가 변경되었을 때 발생합니다.
[slot]
void QHeaderView::headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast)
지정된 orientation 으로 변경된 헤더 섹션을 logicalFirst 에서 logicalLast 로 업데이트합니다.
int QHeaderView::hiddenSectionCount() const
헤더에서 숨겨진 섹션의 수를 반환합니다.
setSectionHidden() 및 isSectionHidden()도 참조하세요 .
void QHeaderView::hideSection(int logicalIndex)
logicalIndex 에 지정된 섹션을 숨깁니다.
showSection(), isSectionHidden(), hiddenSectionCount() 및 setSectionHidden()도 참조하세요 .
[override virtual protected]
int QHeaderView::horizontalOffset() const
재구현합니다: QAbstractItemView::horizontalOffset() const.
헤더의 수평 오프셋을 반환합니다. 세로 헤더의 경우 0입니다.
offset()도 참조하세요 .
[virtual protected]
void QHeaderView::initStyleOption(QStyleOptionHeader *option) const
QHeaderView 의 값으로 option 을 초기화합니다. 이 메서드는 하위 클래스에 QStyleOptionHeader 이 필요하지만 모든 정보를 직접 채우고 싶지 않을 때 유용합니다.
QStyleOption::initFrom() 및 initStyleOptionForIndex()도 참조하세요 .
[virtual protected, since 6.0]
void QHeaderView::initStyleOptionForIndex(QStyleOptionHeader *option, int logicalIndex) const
지정된 logicalIndex 에서 option 스타일을 초기화합니다. 이 함수는 initStyleOption 이 호출된 후 paintSection 의 기본 구현에 의해 호출됩니다.
이 함수는 Qt 6.0에 도입되었습니다.
paintSection() 및 initStyleOption()도 참조하십시오 .
bool QHeaderView::isSectionHidden(int logicalIndex) const
logicalIndex 에 지정된 섹션이 사용자에게 명시적으로 숨겨져 있으면 true
을 반환하고, 그렇지 않으면 false
을 반환합니다.
hideSection(), showSection(), setSectionHidden() 및 hiddenSectionCount()도 참조하세요 .
int QHeaderView::length() const
헤더의 방향에 따른 길이를 반환합니다.
sizeHint(), setSectionResizeMode() 및 offset()도 참조하세요 .
int QHeaderView::logicalIndex(int visualIndex) const
지정된 visualIndex 위치에 있는 섹션의 논리 인덱스를 반환하거나 visualIndex < 0 또는 visualIndex >= QHeaderView::count()인 경우 -1을 반환합니다.
visualIndex 은 숨겨진 섹션의 영향을 받지 않습니다.
visualIndex() 및 sectionPosition()도 참조하세요 .
int QHeaderView::logicalIndexAt(const QPoint &pos) const
pos 에 지정된 위치에 있는 섹션의 논리 인덱스를 반환합니다. 헤더가 가로인 경우 x 좌표가 사용되며, 그렇지 않으면 y 좌표가 논리 인덱스를 찾는 데 사용됩니다.
sectionPosition()도 참조하세요 .
int QHeaderView::logicalIndexAt(int position) const
뷰포트에서 지정된 position 을 포함하는 섹션을 반환합니다.
visualIndexAt() 및 isSectionHidden()도 참조하세요 .
int QHeaderView::logicalIndexAt(int x, int y) const
주어진 좌표에서 섹션의 논리적 색인을 반환합니다. 헤더가 가로인 경우 x 이 사용되며, 그렇지 않으면 y 이 논리 인덱스를 찾는 데 사용됩니다.
[override virtual protected]
void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e)
다시 구현합니다: QAbstractItemView::mouseDoubleClickEvent(QMouseEvent * 이벤트).
[override virtual protected]
void QHeaderView::mouseMoveEvent(QMouseEvent *e)
다시 구현합니다: QAbstractItemView::mouseMoveEvent(QMouseEvent * 이벤트).
[override virtual protected]
void QHeaderView::mousePressEvent(QMouseEvent *e)
다시 구현합니다: QAbstractItemView::mousePressEvent(QMouseEvent * 이벤트).
[override virtual protected]
void QHeaderView::mouseReleaseEvent(QMouseEvent *e)
다시 구현합니다: QAbstractItemView::mouseReleaseEvent(QMouseEvent * 이벤트).
void QHeaderView::moveSection(int from, int to)
시각적 색인 from 에서 섹션을 이동하여 시각적 색인 to 을 차지합니다.
sectionsMoved()도 참조하세요 .
int QHeaderView::offset() const
헤더의 오프셋을 반환합니다. 헤더의 가장 왼쪽(세로 헤더의 경우 가장 위쪽)에 표시되는 픽셀입니다.
setOffset()도 참조하세요 .
Qt::Orientation QHeaderView::orientation() const
헤더의 방향을 반환합니다.
Qt::Orientation 를참조하세요 .
[override virtual protected]
void QHeaderView::paintEvent(QPaintEvent *e)
다시 구현합니다: QAbstractScrollArea::paintEvent(QPaintEvent * 이벤트).
[virtual protected]
void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const
주어진 painter 및 rect 을 사용하여 지정된 logicalIndex 으로 지정된 섹션을 페인트합니다.
일반적으로 이 함수를 호출할 필요는 없습니다.
[override virtual]
void QHeaderView::reset()
다시 구현합니다: QAbstractItemView::reset().
int QHeaderView::resizeContentsPrecision() const
ResizeToContents 에서 얼마나 정확한 QHeaderView 을 계산할 수 있는지 반환합니다.
setResizeContentsPrecision() 및 setSectionResizeMode()도 참조하세요 .
void QHeaderView::resizeSection(int logicalIndex, int size)
logicalIndex 에 지정된 섹션의 크기를 픽셀 단위로 측정한 size 로 조정합니다. 크기 매개변수는 0보다 크거나 같은 값이어야 합니다. 그러나 0과 같은 크기는 권장되지 않습니다. 이 경우 hideSection 을 대신 사용해야 합니다.
sectionResized(), sectionSize() 및 hideSection()도 참조하세요 .
[protected slot]
void QHeaderView::resizeSections()
크기 힌트에 따라 섹션의 크기를 조정합니다. 일반적으로 이 함수를 호출할 필요는 없습니다.
void QHeaderView::resizeSections(QHeaderView::ResizeMode mode)
현재 크기 조정 모드를 무시하고 주어진 mode 에 따라 섹션의 크기를 조정합니다.
sectionResized()도 참조하세요 .
bool QHeaderView::restoreState(const QByteArray &state)
이 헤더 보기의 state 상태를 복원합니다. 이 함수는 상태가 복원된 경우 true
을 반환하고, 그렇지 않으면 false를 반환합니다.
saveState()도 참조하세요 .
QByteArray QHeaderView::saveState() const
이 헤더 뷰의 현재 상태를 저장합니다.
저장된 상태를 복원하려면 restoreState()에 반환값을 전달합니다.
restoreState()도 참조하세요 .
[signal]
void QHeaderView::sectionClicked(int logicalIndex)
이 신호는 섹션을 클릭할 때 발생합니다. 섹션의 논리적 인덱스는 logicalIndex 로 지정됩니다.
sectionPressed 신호도 전송된다는 점에 유의하세요.
setSectionsClickable() 및 sectionPressed()도 참조하세요 .
[signal]
void QHeaderView::sectionCountChanged(int oldCount, int newCount)
이 신호는 섹션 수가 변경될 때, 즉 섹션이 추가되거나 삭제될 때 발생합니다. 원래 개수는 oldCount 으로, 새 개수는 newCount 으로 지정됩니다.
count(), length() 및 headerDataChanged()도 참조하세요 .
[signal]
void QHeaderView::sectionDoubleClicked(int logicalIndex)
이 신호는 섹션을 더블클릭할 때 발생합니다. 섹션의 논리적 인덱스는 logicalIndex 로 지정됩니다.
setSectionsClickable()도 참조하세요 .
[signal]
void QHeaderView::sectionEntered(int logicalIndex)
이 신호는 커서가 섹션 위로 이동하고 마우스 왼쪽 버튼을 누를 때 발생합니다. 섹션의 논리적 인덱스는 logicalIndex 로 지정됩니다.
setSectionsClickable() 및 sectionPressed()도 참조하세요 .
[signal]
void QHeaderView::sectionHandleDoubleClicked(int logicalIndex)
이 신호는 섹션을 더블클릭할 때 발생합니다. 섹션의 논리적 인덱스는 logicalIndex 로 지정됩니다.
setSectionsClickable()도 참조하세요 .
[signal]
void QHeaderView::sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex)
이 신호는 섹션이 이동될 때 발생합니다. 섹션의 논리적 인덱스는 logicalIndex, 이전 인덱스는 oldVisualIndex, 새 인덱스 위치는 newVisualIndex 로 지정됩니다.
moveSection()도 참조하세요 .
int QHeaderView::sectionPosition(int logicalIndex) const
지정된 logicalIndex 의 섹션 위치를 반환하거나 섹션이 숨겨진 경우 -1을 반환합니다. 위치는 처음 보이는 항목의 왼쪽 상단 모서리에서 logicalIndex 이 있는 항목의 왼쪽 상단 모서리까지 픽셀 단위로 측정됩니다. 가로 헤더의 경우 x축을 따라, 세로 헤더의 경우 y축을 따라 측정합니다.
sectionViewportPosition()도 참조하세요 .
[signal]
void QHeaderView::sectionPressed(int logicalIndex)
이 신호는 섹션을 눌렀을 때 방출됩니다. 섹션의 논리적 인덱스는 logicalIndex 로 지정됩니다.
setSectionsClickable()도 참조하세요 .
QHeaderView::ResizeMode QHeaderView::sectionResizeMode(int logicalIndex) const
주어진 logicalIndex 에 지정된 섹션에 적용되는 크기 조정 모드를 반환합니다.
setSectionResizeMode()도 참조하세요 .
[signal]
void QHeaderView::sectionResized(int logicalIndex, int oldSize, int newSize)
이 신호는 섹션의 크기가 조정될 때 발생합니다. 섹션의 논리적 번호는 logicalIndex, 이전 크기는 oldSize, 새 크기는 newSize 로 지정됩니다.
resizeSection()도 참조하세요 .
int QHeaderView::sectionSize(int logicalIndex) const
주어진 logicalIndex 의 너비(또는 세로 헤더의 경우 높이)를 반환합니다.
length(), setSectionResizeMode() 및 defaultSectionSize()도 참조하세요 .
[virtual protected]
QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const
주어진 logicalIndex 에 지정된 섹션의 콘텐츠 크기를 반환합니다.
defaultSectionSize()도 참조하세요 .
int QHeaderView::sectionSizeHint(int logicalIndex) const
logicalIndex 에 지정된 섹션에 적합한 크기 힌트를 반환합니다.
sizeHint(), defaultSectionSize(), minimumSectionSize() 및 maximumSectionSize()도 참조하세요 .
int QHeaderView::sectionViewportPosition(int logicalIndex) const
주어진 logicalIndex 의 섹션 뷰포트 위치를 반환합니다.
섹션이 숨겨져 있으면 반환값은 정의되지 않습니다.
sectionPosition() 및 isSectionHidden()도 참조하세요 .
[protected slot]
void QHeaderView::sectionsAboutToBeRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast)
이 슬롯은 parent 에서 섹션이 제거될 때 호출됩니다. logicalFirst 과 logicalLast 는 섹션이 제거된 위치를 나타냅니다.
섹션이 하나만 제거된 경우 logicalFirst 및 logicalLast 은 동일합니다.
bool QHeaderView::sectionsClickable() const
섹션 클릭 가능을 반환합니다.
참고: 속성 섹션 클릭 가능에 대한 게터 함수.
setSectionsClickable()도 참조하세요 .
bool QHeaderView::sectionsHidden() const
헤더의 섹션이 숨겨져 있으면 true
을 반환하고, 그렇지 않으면 false를 반환합니다;
setSectionHidden()도 참조하세요 .
[protected slot]
void QHeaderView::sectionsInserted(const QModelIndex &parent, int logicalFirst, int logicalLast)
이 슬롯은 섹션이 parent 에 삽입될 때 호출됩니다. logicalFirst 과 logicalLast 인덱스는 새 섹션이 삽입된 위치를 나타냅니다.
섹션이 하나만 삽입된 경우 logicalFirst 및 logicalLast 은 동일합니다.
bool QHeaderView::sectionsMovable() const
섹션Movable을 반환합니다.
참고: 섹션Movable 프로퍼티에 대한 게터 함수입니다.
setSectionsMovable()도 참조하세요 .
bool QHeaderView::sectionsMoved() const
헤더의 섹션이 이동된 경우 true
을 반환하고, 그렇지 않으면 false를 반환합니다;
moveSection()도 참조하세요 .
[override virtual]
void QHeaderView::setModel(QAbstractItemModel *model)
재구현합니다: QAbstractItemView::setModel(QAbstractItemModel *model).
[slot]
void QHeaderView::setOffset(int offset)
헤더의 오프셋을 offset 로 설정합니다.
[slot]
void QHeaderView::setOffsetToLastSection()
마지막 섹션이 보이도록 오프셋을 설정합니다.
setOffset(), sectionPosition() 및 setOffsetToSectionPosition()도 참조하세요 .
[slot]
void QHeaderView::setOffsetToSectionPosition(int visualSectionNumber)
주어진 visualSectionNumber 에서 섹션의 시작 부분으로 오프셋을 설정합니다. visualSectionNumber 은 숨겨진 섹션을 고려하지 않을 때 실제로 표시되는 섹션입니다. visualIndex ()와 항상 같지는 않습니다.
setOffset() 및 sectionPosition()도 참조하세요 .
void QHeaderView::setResizeContentsPrecision(int precision)
ResizeToContents 을 사용할 때 QHeaderView 이 크기를 얼마나 정확하게 계산할지 설정합니다. 값이 낮으면 정확도는 떨어지지만 자동 크기 조정 속도가 빨라지고, 값이 높으면 정확도는 높아지지만 속도가 느려질 수 있습니다.
precision 숫자는 기본 크기를 계산할 때 고려해야 하는 섹션 수를 지정합니다.
기본값은 1000으로, 자동 크기 조정 기능이 있는 가로 열의 경우 자동 크기 조정 시 최대 1000행까지 계산합니다.
특수 값 0은 보이는 영역만 보겠다는 의미입니다. 특수 값 -1은 모든 요소를 살펴본다는 의미입니다.
이 값은 QTableView::sizeHintForColumn(), QTableView::sizeHintForRow() 및 QTreeView::sizeHintForColumn()에서 사용됩니다. 이러한 함수를 다시 구현하면 이 함수가 효과가 없을 수 있습니다.
resizeContentsPrecision(), setSectionResizeMode(), resizeSections(), QTableView::sizeHintForColumn(), QTableView::sizeHintForRow() 및 QTreeView::sizeHintForColumn()도 참조하세요 .
void QHeaderView::setSectionHidden(int logicalIndex, bool hide)
hide 이 참이면 logicalIndex 으로 지정된 섹션이 숨겨지고, 그렇지 않으면 섹션이 표시됩니다.
isSectionHidden() 및 hiddenSectionCount()도 참조하세요 .
void QHeaderView::setSectionResizeMode(QHeaderView::ResizeMode mode)
주어진 mode 에 설명된 헤더 크기 조정 방법에 대한 제약 조건을 설정합니다.
sectionResizeMode(), length() 및 sectionResized()도 참조하세요 .
void QHeaderView::setSectionResizeMode(int logicalIndex, QHeaderView::ResizeMode mode)
헤더에 logicalIndex 에 지정된 섹션의 크기를 지정된 mode 에 설명된 크기로 조정할 수 있는 방법에 대한 제약 조건을 설정합니다. 이 함수가 호출될 때 논리적 인덱스가 존재해야 합니다.
참고: stretchLastSection 속성이 true로 설정된 경우 마지막 섹션에 대해서는 이 설정이 무시됩니다. 이는 QTreeView 에서 제공하는 가로 헤더의 기본값입니다.
setStretchLastSection() 및 resizeContentsPrecision()도 참조하세요 .
void QHeaderView::setSectionsClickable(bool clickable)
sectionsClickable 을 clickable 으로 설정합니다.
참고: 속성에 대한 세터 함수 sectionsClickable.
sectionsClickable()도 참조하세요 .
void QHeaderView::setSectionsMovable(bool movable)
sectionsMovable 을 movable 으로 설정합니다.
참고: 속성에 대한 세터 함수 sectionsMovable.
sectionsMovable()도 참조하세요 .
[override virtual protected]
void QHeaderView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags)
재구현합니다: QAbstractItemView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags 플래그).
지정된 flags 에 따라 지정된 rect 의 항목을 선택합니다.
베이스 클래스 구현은 아무것도 하지 않습니다.
void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order)
주어진 logicalIndex 에 지정된 섹션의 정렬 표시기를 order 에 지정된 방향으로 설정하고 정렬 표시기를 표시하던 다른 섹션에서 정렬 표시기를 제거합니다.
logicalIndex 이 값은 -1일 수 있으며, 이 경우 정렬 표시기가 표시되지 않고 모델이 정렬되지 않은 자연스러운 순서로 돌아갑니다. 모든 모델이 이 기능을 지원하는 것은 아니며 이 경우 충돌이 발생할 수도 있습니다.
sortIndicatorSection() 및 sortIndicatorOrder()도 참조하세요 .
[override virtual]
void QHeaderView::setVisible(bool v)
속성에 대한 액세스 함수를 다시 구현합니다: QWidget::visible.
void QHeaderView::showSection(int logicalIndex)
logicalIndex 에 지정된 섹션을 표시합니다.
hideSection(), isSectionHidden(), hiddenSectionCount() 및 setSectionHidden()도 참조하세요 .
[override virtual]
QSize QHeaderView::sizeHint() const
재구현합니다: QAbstractScrollArea::sizeHint() const.
이 헤더에 적합한 크기 힌트를 반환합니다.
sectionSizeHint()도 참조하세요 .
[signal]
void QHeaderView::sortIndicatorChanged(int logicalIndex, Qt::SortOrder order)
이 신호는 정렬 표시기가 포함된 섹션 또는 표시된 순서가 변경될 때 발생합니다. 섹션의 논리적 인덱스는 logicalIndex 으로 지정하고 정렬 순서는 order 으로 지정합니다.
setSortIndicator()도 참조하세요 .
Qt::SortOrder QHeaderView::sortIndicatorOrder() const
정렬 표시기의 순서를 반환합니다. 섹션에 정렬 표시기가 없는 경우 이 함수의 반환 값은 정의되지 않습니다.
setSortIndicator() 및 sortIndicatorSection()도 참조하세요 .
int QHeaderView::sortIndicatorSection() const
정렬 표시기가 있는 섹션의 논리적 인덱스를 반환합니다. 기본적으로 이 인덱스는 섹션 0입니다.
setSortIndicator(), sortIndicatorOrder() 및 setSortIndicatorShown()도 참조하세요 .
int QHeaderView::stretchSectionCount() const
모드 스트레치 크기 조정으로 설정된 섹션의 수를 반환합니다. 뷰에서 뷰의 지오메트리가 변경될 때 머리글 뷰에서 섹션의 크기를 조정해야 하는지 확인하는 데 사용할 수 있습니다.
stretchLastSection 를참조하십시오 .
void QHeaderView::swapSections(int first, int second)
시각적 색인 first 의 섹션을 시각적 색인 second 의 섹션으로 바꿉니다.
moveSection()도 참조하세요 .
[override virtual protected]
int QHeaderView::verticalOffset() const
재구현합니다: QAbstractItemView::verticalOffset() const.
헤더의 수직 오프셋을 반환합니다. 가로 헤더의 경우 이 값은 0입니다.
offset()도 참조하세요 .
[override virtual protected]
bool QHeaderView::viewportEvent(QEvent *e)
다시 구현합니다: QAbstractItemView::viewportEvent(QEvent * 이벤트).
int QHeaderView::visualIndex(int logicalIndex) const
지정된 logicalIndex 으로 지정된 섹션의 시각적 인덱스 위치를 반환하거나 그렇지 않으면 -1을 반환합니다.
숨겨진 섹션에는 여전히 유효한 시각적 인덱스가 있습니다.
logicalIndex()도 참조하세요 .
int QHeaderView::visualIndexAt(int position) const
뷰포트에서 지정된 position 을 포함하는 섹션의 시각적 인덱스를 반환합니다.
logicalIndexAt()도 참조하세요 .
© 2025 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.