1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta name="robots" content="noindex,noarchive">
<title>Qt Toolkit - QHeader Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 15%; text-indent: -15%; }
a:link { text-decoration: none; }
--></style>
</head><body bgcolor="#ffffff">
<a href=index.html><img width=122 height=65 src=qtlogo.jpg alt="Qt logo" align=left border=0></a>
<center><img src=dochead.gif width=472 height=27></center>
<br clear=all>
<h1 align=center>QHeader Class Reference</h1><br clear="all">
<p>
The QHeader class provides a table header.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qheader-h.html">qheader.h</a>></code>
<p>
Inherits <a href="qtableview.html">QTableView</a>.
<p><a href="qheader-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><span class="fn"><a href="qheader.html#a0"><strong>QHeader</strong></a>(QWidget*parent=0, constchar*name=0)</span>
<li><span class="fn"><a href="qheader.html#a1"><strong>QHeader</strong></a>(int, QWidget*parent=0, constchar*name=0)</span>
<li><span class="fn"><a href="qheader.html#a2"><strong>~QHeader</strong></a>()</span>
<li><span class="fn">int<a href="qheader.html#a3"><strong>addLabel</strong></a>(constchar*, intsize=-1)</span>
<li><span class="fn">void<a href="qheader.html#a4"><strong>setLabel</strong></a>(int, constchar*, intsize=-1)</span>
<li><span class="fn">constchar*<a href="qheader.html#a5"><strong>label</strong></a>(int)</span>
<li><span class="fn">void<a href="qheader.html#a6"><strong>setOrientation</strong></a>(Orientation)</span>
<li><span class="fn">Orientation<a href="qheader.html#a7"><strong>orientation</strong></a>()const</span>
<li><span class="fn">void<a href="qheader.html#a8"><strong>setTracking</strong></a>(boolenable)</span>
<li><span class="fn">bool<a href="qheader.html#a9"><strong>tracking</strong></a>()const</span>
<li><span class="fn">void<a href="qheader.html#b0"><strong>setClickEnabled</strong></a>(bool, intlogIdx=-1)</span>
<li><span class="fn">void<a href="qheader.html#b1"><strong>setResizeEnabled</strong></a>(bool, intlogIdx=-1)</span>
<li><span class="fn">void<a href="qheader.html#b2"><strong>setMovingEnabled</strong></a>(bool)</span>
<li><span class="fn">void<a href="qheader.html#b3"><strong>setCellSize</strong></a>(inti, ints)</span>
<li><span class="fn">int<a href="qheader.html#b4"><strong>cellSize</strong></a>(inti)const</span>
<li><span class="fn">int<a href="qheader.html#b5"><strong>cellPos</strong></a>(inti)const</span>
<li><span class="fn">int<a href="qheader.html#b6"><strong>cellAt</strong></a>(inti)const</span>
<li><span class="fn">int<a href="qheader.html#b7"><strong>count</strong></a>()const</span>
<li><span class="fn">int<a href="qheader.html#b8"><strong>offset</strong></a>()const</span>
<li><span class="fn">virtualQSize<a href="qheader.html#b9"><strong>sizeHint</strong></a>()const</span>
<li><span class="fn">int<a href="qheader.html#c0"><strong>mapToLogical</strong></a>(int)const</span>
<li><span class="fn">int<a href="qheader.html#c1"><strong>mapToActual</strong></a>(int)const</span>
</ul>
<h2>Public Slots</h2>
<ul>
<li><span class="fn">void<a href="qheader.html#c2"><strong>setOffset</strong></a>(int)</span>
</ul>
<h2>Signals</h2>
<ul>
<li><span class="fn">void<a href="qheader.html#c3"><strong>sectionClicked</strong></a>(int)</span>
<li><span class="fn">void<a href="qheader.html#c4"><strong>sizeChange</strong></a>(intsection, intoldSize, intnewSize)</span>
<li><span class="fn">void<a href="qheader.html#c5"><strong>moved</strong></a>(intfrom, intto)</span>
</ul>
<h2>Protected Members</h2>
<ul>
<li><span class="fn">virtualvoid<a href="qheader.html#c6"><strong>resizeEvent</strong></a>(QResizeEvent*)</span>
<li><span class="fn">QRect<a href="qheader.html#c7"><strong>sRect</strong></a>(inti)</span>
<li><span class="fn">virtualvoid<a href="qheader.html#c8"><strong>paintCell</strong></a>(QPainter*, int, int)</span>
<li><span class="fn">virtualvoid<a href="qheader.html#c9"><strong>setupPainter</strong></a>(QPainter*)</span>
<li><span class="fn">virtualint<a href="qheader.html#d0"><strong>cellHeight</strong></a>(int)</span>
<li><span class="fn">virtualint<a href="qheader.html#d1"><strong>cellWidth</strong></a>(int)</span>
<li><span class="fn">virtualvoid<a href="qwidget.html#n4"><strong>mousePressEvent</strong></a>(QMouseEvent*)</span>
<li><span class="fn">virtualvoid<a href="qwidget.html#n5"><strong>mouseReleaseEvent</strong></a>(QMouseEvent*)</span>
<li><span class="fn">virtualvoid<a href="qwidget.html#n7"><strong>mouseMoveEvent</strong></a>(QMouseEvent*)</span>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QHeader class provides a table header.
<p>
This is a table heading of the type used in a list view. It gives
the user the opportunity to resize and move the columns (or rows for
vertical headings).
<p>This class can be used without a table view, if you need to control
table-like structures.
<p><img src=qheader-m.gif> <img src=qheader-w.gif>
<p>See also: <a href="qlistview.html">QListView</a>, <a href="qtableview.html">QTableView</a> and <a href="http://www.microsoft.com/win32dev/uiguide/uigui181.htm">Microsoft Style Guide</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="a0"></a>QHeader::QHeader(<a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0)</h3>
<p>Constructs a horizontal header.
<p>The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
<h3 class="fn"><a name="a1"></a>QHeader::QHeader(intn, <a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0)</h3>
<p>Constructs a horizontal header with <em>n</em> sections.
<p>The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
<h3 class="fn"><a name="a2"></a>QHeader::~QHeader()</h3>
<p>Destroys the header.
<h3 class="fn">int<a name="a3"></a>QHeader::addLabel(constchar*s, intsize=-1)</h3>
<p>Adds a new section, with label text <em>s.</em> Returns the index.
If <em>size</em> is non-negative, the section width is set to <em>size,</em>
otherwise a size currently sufficient for the label text is used.
<h3 class="fn">int<a name="b6"></a>QHeader::cellAt(intc)const</h3>
<p>Returns the actual index of the section at position <em>c,</em> or -1 if outside.
<h3 class="fn">int<a name="d0"></a>QHeader::cellHeight(introw) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qtableview.html#c3">QTableView.</a>
<h3 class="fn">int<a name="b5"></a>QHeader::cellPos(inti)const</h3>
<p>Returns the position in pixels of section <em>i</em> of the header. <em>i</em> is the
actual index.
<h3 class="fn">int<a name="b4"></a>QHeader::cellSize(inti)const</h3>
<p>Returns the size in pixels of section <em>i</em> of the header. <em>i</em> is the
actual index.
<h3 class="fn">int<a name="d1"></a>QHeader::cellWidth(intcol) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qtableview.html#c2">QTableView.</a>
<h3 class="fn">int<a name="b7"></a>QHeader::count()const</h3>
<p>Returns the number of sections in the header.
<h3 class="fn">constchar*<a name="a5"></a>QHeader::label(inti)</h3>
<p>Returns the text set on logical section <em>i.</em>
<h3 class="fn">int<a name="c1"></a>QHeader::mapToActual(intl)const</h3>
<p>Translates from logical index <em>l</em> to actual index. Returns -1 if
<em>l</em> is outside the legal range.
<h3 class="fn">int<a name="c0"></a>QHeader::mapToLogical(inta)const</h3>
<p>Translates from actual index <em>a</em> to logical index. Returns -1 if
<em>a</em> is outside the legal range.
<h3 class="fn">void<a name="c5"></a>QHeader::moved(intfrom, intto) <code>[signal]</code></h3>
<p>This signal is emitted when the user has moved column <em>from</em> to
position <em>to.</em>
<h3 class="fn">int<a name="b8"></a>QHeader::offset()const</h3>
<p>int QHeader::offset() const
Returns the leftmost (or uppermost for vertical headers) visible pixel.
<h3 class="fn">QHeader::Orientation<a name="a7"></a>QHeader::orientation()const</h3>
<p>Returns <code>Horizontal</code> if the header is horizontal, <code>Vertical</code> if
the header is vertical.
<h3 class="fn">void<a name="c8"></a>QHeader::paintCell(<a href="qpainter.html">QPainter</a>*p, introw, intcol) <code>[virtualprotected]</code></h3>
<p>paints a section of the header.
<p>Reimplemented from <a href="qtableview.html#f1">QTableView.</a>
<h3 class="fn">void<a name="c6"></a>QHeader::resizeEvent(<a href="qresizeevent.html">QResizeEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Handles resize events.
<p>Reimplemented from <a href="qwidget.html#o6">QWidget.</a>
<h3 class="fn"><a href="qrect.html">QRect</a><a name="c7"></a>QHeader::sRect(inti) <code>[protected]</code></h3>
<p>Returns the rectangle covered by actual section <em>i.</em>
<h3 class="fn">void<a name="c3"></a>QHeader::sectionClicked(intlogical) <code>[signal]</code></h3>
<p>This signal is emitted when a part of the header is clicked. In a
list view, this signal would typically be connected to a slot which sorts
the specified column.
<h3 class="fn">void<a name="b3"></a>QHeader::setCellSize(inti, ints)</h3>
<p>Sets the size of logical cell <em>i</em> to <em>s</em> pixels.<p><strong>Warning:</strong> does not repaint or send out signals at present.
<h3 class="fn">void<a name="b0"></a>QHeader::setClickEnabled(boolenable, inti=-1)</h3>
<p>Enable clicking in column <em>i</em> if <em>enable</em> is TRUE, disable otherwise.
If <em>i</em> is negative, clicking is enabled/disabled for all columns.
<p>If enabled, the <a href="qheader.html#c3">sectionClicked</a>() signal is emitted when the user clicks.
<p>See also: <a href="qheader.html#b2">setMovingEnabled</a>() and <a href="qheader.html#b1">setResizeEnabled</a>().
<h3 class="fn">void<a name="a4"></a>QHeader::setLabel(inti, constchar*s, intsize=-1)</h3>
<p>Sets the text on logical section <em>i</em> to <em>s.</em> If the section does not exist,
nothing happens.
If <em>size</em> is non-negative, the section width is set to <em>size.</em>
<h3 class="fn">void<a name="b2"></a>QHeader::setMovingEnabled(boolenable)</h3>
<p>Enable the user to exchange columns if <em>enable</em> is TRUE,
disable otherwise.
<p>See also: <a href="qheader.html#b0">setClickEnabled</a>() and <a href="qheader.html#b1">setResizeEnabled</a>().
<h3 class="fn">void<a name="c2"></a>QHeader::setOffset(intx) <code>[slot]</code></h3>
<p>Scrolls the header such that <em>x</em> becomes the leftmost (or uppermost
for vertical headers) visible pixel.
<h3 class="fn">void<a name="a6"></a>QHeader::setOrientation(Orientationorientation)</h3>
<p>Sets the header orientation. The <em>orientation</em> must be
QHeader::Vertical or QHeader::Horizontal.
<p>When adding labels without the size parameter, setOrientation
should be called first, otherwise labels will be sized incorrectly.
<p>See also: <a href="qheader.html#a7">orientation</a>().
<h3 class="fn">void<a name="b1"></a>QHeader::setResizeEnabled(boolenable, inti=-1)</h3>
<p>Enable user resizing of column <em>i</em> if <em>enable</em> is TRUE, disable otherwise.
If <em>i</em> is negative, resizing is enabled/disabled for all columns.
<p>See also: <a href="qheader.html#b2">setMovingEnabled</a>() and <a href="qheader.html#b0">setClickEnabled</a>().
<h3 class="fn">void<a name="a8"></a>QHeader::setTracking(boolenable)</h3>
<p>Sets tracking if <em>enable</em> is TRUE, otherwise turns off tracking.
If tracking is on, the <a href="qheader.html#c4">sizeChange</a>() signal is emitted continuously
while the mouse is moved, otherwise it is only emitted when the
mouse button is released.
<p>See also: <a href="qheader.html#a9">tracking</a>().
<h3 class="fn">void<a name="c9"></a>QHeader::setupPainter(<a href="qpainter.html">QPainter</a>*p) <code>[virtualprotected]</code></h3>
<p>sets up the painter.
<p>Reimplemented from <a href="qtableview.html#f2">QTableView.</a>
<h3 class="fn">void<a name="c4"></a>QHeader::sizeChange(intsection, intoldSize, intnewSize) <code>[signal]</code></h3>
<p>This signal is emitted when the user has changed the size of some
of the parts of the header. This signal is typically connected to a slot
that repaints the table. <em>section</em> is the logical section resized.
<h3 class="fn"><a href="qsize.html">QSize</a><a name="b9"></a>QHeader::sizeHint()const <code>[virtual]</code></h3>
<p>Returns the recommended size of the QHeader.
<p>Reimplemented from <a href="qwidget.html#l7">QWidget.</a>
<h3 class="fn">bool<a name="a9"></a>QHeader::tracking()const</h3>
<p>Returns TRUE if tracking is on, FALSE otherwise.
<p>See also: <a href="qheader.html#a8">setTracking</a>().
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.troll.no">www.troll.no</a>):<br>
<form method=post action="http://www.troll.no/search.cgi">
<input type=hidden name="version" value="1.44"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-99
<a href="troll.html">Troll Tech</a>, all rights reserved.
<p>
It was generated from the following files:
<ul>
<li>qheader.h: 1998/08/21
<li>qheader.cpp: 1998/10/30
</ul>
<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 1999 Troll Tech<td><a href="trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 1.45</div>
</table></div></address></body></html>
|