📄 qheader.3qt
字号:
.TH QHeader 3qt "3 September 2000" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2000 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQHeader \- Table header.SH SYNOPSIS.br.PP\fC#include <qheader.h>\fR.PPInherits QWidget..PPInherited by QTableHeader..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQHeader\fR ( QWidget * " "parent" "=0, const char * " "name" "=0 ) ".br.ti -1c.BI "\fBQHeader\fR ( int, QWidget * " "parent" "=0, const char * " "name" "=0 ) ".br.ti -1c.BI "\fB~QHeader\fR () ".br.ti -1c.BI "int \fBaddLabel\fR ( const QString &, int " "size" " = -1 ) ".br.ti -1c.BI "int \fBaddLabel\fR ( const QIconSet &, const QString &, int " "size" " = -1 ) ".br.ti -1c.BI "void \fBremoveLabel\fR ( int section ) ".br.ti -1c.BI "virtual void \fBsetLabel\fR ( int, const QString &, int " "size" " = -1 ) ".br.ti -1c.BI "virtual void \fBsetLabel\fR ( int, const QIconSet &, const QString &, int " "size" " = -1 ) ".br.ti -1c.BI "QString \fBlabel\fR ( int section ) const".br.ti -1c.BI "QIconSet* \fBiconSet\fR ( int section ) const".br.ti -1c.BI "virtual void \fBsetOrientation\fR ( Orientation ) ".br.ti -1c.BI "Orientation \fBorientation\fR () const".br.ti -1c.BI "virtual void \fBsetTracking\fR ( bool enable ) ".br.ti -1c.BI "bool \fBtracking\fR () const".br.ti -1c.BI "virtual void \fBsetClickEnabled\fR ( bool, int " "section" " = -1 ) ".br.ti -1c.BI "virtual void \fBsetResizeEnabled\fR ( bool, int " "section" " = -1 ) ".br.ti -1c.BI "virtual void \fBsetMovingEnabled\fR ( bool ) ".br.ti -1c.BI "bool \fBisClickEnabled\fR ( int " "section" " = -1 ) const".br.ti -1c.BI "bool \fBisResizeEnabled\fR ( int " "section" " = -1 ) const".br.ti -1c.BI "bool \fBisMovingEnabled\fR () const".br.ti -1c.BI "void \fBresizeSection\fR ( int " "section" ", int s ) ".br.ti -1c.BI "int \fBsectionSize\fR ( int section ) const".br.ti -1c.BI "int \fBsectionPos\fR ( int section ) const".br.ti -1c.BI "int \fBsectionAt\fR ( int pos ) const".br.ti -1c.BI "int \fBcount\fR () const".br.ti -1c.BI "virtual void setCellSize ( int, int ) \fI(obsolete)\fR".br.ti -1c.BI "int cellSize ( int ) const \fI(obsolete)\fR".br.ti -1c.BI "int cellPos ( int ) const \fI(obsolete)\fR".br.ti -1c.BI "int cellAt ( int ) const \fI(obsolete)\fR".br.ti -1c.BI "int \fBoffset\fR () const".br.ti -1c.BI "int \fBmapToSection\fR ( int index ) const".br.ti -1c.BI "int \fBmapToIndex\fR ( int section ) const".br.ti -1c.BI "int mapToLogical ( int ) const \fI(obsolete)\fR".br.ti -1c.BI "int mapToActual ( int ) const \fI(obsolete)\fR".br.ti -1c.BI "void \fBmoveSection\fR ( int " "section" ", int toIndex ) ".br.ti -1c.BI "virtual void moveCell ( int, int ) \fI(obsolete)\fR".br.ti -1c.BI "void \fBsetSortIndicator\fR ( int " "section" ", bool " "increasing" " = TRUE ) ".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "virtual void \fBsetUpdatesEnabled\fR ( bool enable ) ".br.ti -1c.BI "virtual void \fBsetOffset\fR ( int pos ) ".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBclicked\fR ( int section ) ".br.ti -1c.BI "void \fBpressed\fR ( int section ) ".br.ti -1c.BI "void \fBreleased\fR ( int section ) ".br.ti -1c.BI "void \fBsizeChange\fR ( int " "section" ", int " "oldSize" ", int newSize ) ".br.ti -1c.BI "void \fBindexChange\fR ( int " "section" ", int " "fromIndex" ", int toIndex ) ".br.ti -1c.BI "void sectionClicked ( int ) \fI(obsolete)\fR".br.ti -1c.BI "void moved ( int, int ) \fI(obsolete)\fR".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "QRect \fBsRect\fR ( int index ) ".br.ti -1c.BI "void \fBpaintSection\fR ( QPainter * " "p" ", int " "index" ", QRect fr ) ".br.ti -1c.BI "void \fBpaintSectionLabel\fR ( QPainter * " "p" ", int " "index" ", const QRect & fr ) ".br.in -1c.SS "Properties"<table border=1 cellpadding=3 cellspacing=0> <tr><th>Type<th>Name<th>READ<th>WRITE<th>Options <tr><td>Orientation<td>orientation<td>orientation<td>setOrientation<td> <tr><td>bool<td>tracking<td>tracking<td>setTracking<td> <tr><td>int<td>count<td>count<td> <td> <tr><td>int<td>offset<td>offset<td>setOffset<td> <tr><td>bool<td>moving<td>isMovingEnabled<td>setMovingEnabled<td> </table>.SH DESCRIPTIONThe QHeader class provides a table header..PPThis class provides a table header as known from Spreadsheet-like widgets. QHeader can be used vertically or horizontally (see setOrientation())..PPWith addLabel() you can add sections, and with removeLabel() you can remove them. If you enabled clicking for one or all sections (see setClickEnabled()), the user can reorder the sections and click on them which may be used for sorting (see also setSortIndicator()). This feature is turned on by default..PPSo, if the user reorders the sections by clicking and moving them with the mouse the index of a section may change. This means, the section you inserted at the first position might be displayed at a different index then. To get the index at which e.g the first section is displayed, use mapToIndex() with 0 as argument for our example..PPIf you want e.g. to know which section is displayed at e.g. index 3 use mapToSection() with 3 as argument..PPSo, you can always work with the section numbers as you inserted them without caring about the index at which they are displayed at the moment. Also the API of QHeader works with the section numbers..PP<img src=qheader-m.png> <img src=qheader-w.png>.PPSee also QListView and QTableView..SH MEMBER FUNCTION DOCUMENTATION.SH "QHeader::QHeader ( QWidget * parent=0, const char * name=0 )"Constructs a horizontal header..PPThe \fIparent\fR and \fIname\fR arguments are sent to the QWidget constructor..SH "QHeader::QHeader ( int n, QWidget * parent=0, const char * name=0 )"Constructs a horizontal header with \fIn\fR sections..PPThe \fIparent\fR and \fIname\fR arguments are sent to the QWidget constructor..SH "QHeader::~QHeader ()"Destructs the header..SH "int QHeader::addLabel ( const QIconSet & iconset, const QString & s, int size = -1 )"Adds a new section, with icon set \fIiconset\fR and label text \fIs.\fR Returns the index. If \fIsize\fR is non-negative, the section width is set to \fIsize,\fR otherwise a size currently sufficient for the label is used..SH "int QHeader::addLabel ( const QString & s, int size = -1 )"Adds a new section, with label text \fIs.\fR Returns the index. If \fIsize\fR is non-negative, the section width is set to \fIsize,\fR otherwise a size currently sufficient for the label text is used..SH "int QHeader::cellAt ( int pos ) const"\fBThis function is obsolete.\fR It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code..PPUse sectionAt() instead!
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -