[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qheader.h:1 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>qheader.h Include File</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qheader.h</h1>
|
---|
| 33 |
|
---|
| 34 | <p>This is the verbatim text of the qheader.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
| 35 | <hr>
|
---|
| 36 | <pre>
|
---|
| 37 | /****************************************************************************
|
---|
| 38 | ** $Id: qheader-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
| 39 | **
|
---|
| 40 | ** Definition of QHeader widget class (table header)
|
---|
| 41 | **
|
---|
| 42 | ** Created : 961105
|
---|
| 43 | **
|
---|
| 44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
| 45 | **
|
---|
| 46 | ** This file is part of the widgets module of the Qt GUI Toolkit.
|
---|
| 47 | **
|
---|
| 48 | ** This file may be distributed under the terms of the Q Public License
|
---|
| 49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
| 50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
| 51 | **
|
---|
| 52 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 55 | ** packaging of this file.
|
---|
| 56 | **
|
---|
| 57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
| 58 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
| 59 | ** Agreement provided with the Software.
|
---|
| 60 | **
|
---|
| 61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 63 | **
|
---|
| 64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 65 | ** information about Qt Commercial License Agreements.
|
---|
| 66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
| 67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 68 | **
|
---|
| 69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 70 | ** not clear to you.
|
---|
| 71 | **
|
---|
| 72 | **********************************************************************/
|
---|
| 73 |
|
---|
| 74 | #ifndef QHEADER_H
|
---|
| 75 | #define QHEADER_H
|
---|
| 76 |
|
---|
| 77 | #ifndef QT_H
|
---|
| 78 | #include "qwidget.h"
|
---|
| 79 | #include "qstring.h"
|
---|
| 80 | #include "qiconset.h" // conversion QPixmap->QIconset
|
---|
| 81 | #endif // QT_H
|
---|
| 82 |
|
---|
| 83 | #ifndef QT_NO_HEADER
|
---|
| 84 |
|
---|
| 85 | class QShowEvent;
|
---|
| 86 | class QHeaderData;
|
---|
| 87 | class QTable;
|
---|
| 88 |
|
---|
| 89 | class Q_EXPORT QHeader : public QWidget
|
---|
| 90 | {
|
---|
| 91 | friend class QTable;
|
---|
| 92 | friend class QTableHeader;
|
---|
| 93 | friend class QListView;
|
---|
| 94 |
|
---|
| 95 | Q_OBJECT
|
---|
| 96 | Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
|
---|
| 97 | Q_PROPERTY( bool tracking READ tracking WRITE setTracking )
|
---|
| 98 | Q_PROPERTY( int count READ count )
|
---|
| 99 | Q_PROPERTY( int offset READ offset WRITE setOffset )
|
---|
| 100 | Q_PROPERTY( bool moving READ isMovingEnabled WRITE setMovingEnabled )
|
---|
| 101 | Q_PROPERTY( bool stretching READ isStretchEnabled WRITE setStretchEnabled )
|
---|
| 102 |
|
---|
| 103 | public:
|
---|
| 104 | QHeader( QWidget* parent=0, const char* name=0 );
|
---|
| 105 | QHeader( int, QWidget* parent=0, const char* name=0 );
|
---|
| 106 | ~QHeader();
|
---|
| 107 |
|
---|
| 108 | int addLabel( const QString &, int size = -1 );
|
---|
| 109 | int addLabel( const QIconSet&, const QString &, int size = -1 );
|
---|
| 110 | void removeLabel( int section );
|
---|
| 111 | virtual void setLabel( int, const QString &, int size = -1 );
|
---|
| 112 | virtual void setLabel( int, const QIconSet&, const QString &, int size = -1 );
|
---|
| 113 | QString label( int section ) const;
|
---|
| 114 | QIconSet* iconSet( int section ) const;
|
---|
| 115 |
|
---|
| 116 | virtual void setOrientation( Orientation );
|
---|
| 117 | Orientation orientation() const;
|
---|
| 118 | virtual void setTracking( bool enable );
|
---|
| 119 | bool tracking() const;
|
---|
| 120 |
|
---|
| 121 | virtual void setClickEnabled( bool, int section = -1 );
|
---|
| 122 | virtual void setResizeEnabled( bool, int section = -1 );
|
---|
| 123 | virtual void setMovingEnabled( bool );
|
---|
| 124 | virtual void setStretchEnabled( bool b, int section );
|
---|
| 125 | void setStretchEnabled( bool b ) { setStretchEnabled( b, -1 ); }
|
---|
| 126 | bool isClickEnabled( int section = -1 ) const;
|
---|
| 127 | bool isResizeEnabled( int section = -1 ) const;
|
---|
| 128 | bool isMovingEnabled() const;
|
---|
| 129 | bool isStretchEnabled() const;
|
---|
| 130 | bool isStretchEnabled( int section ) const;
|
---|
| 131 |
|
---|
| 132 | void resizeSection( int section, int s );
|
---|
| 133 | int sectionSize( int section ) const;
|
---|
| 134 | int sectionPos( int section ) const;
|
---|
| 135 | int sectionAt( int pos ) const;
|
---|
| 136 | int count() const;
|
---|
| 137 | int headerWidth() const;
|
---|
| 138 | QRect sectionRect( int section ) const;
|
---|
| 139 |
|
---|
| 140 | virtual void setCellSize( int , int ); // obsolete, do not use
|
---|
| 141 | int cellSize( int i ) const { return sectionSize( mapToSection(i) ); } // obsolete, do not use
|
---|
| 142 | int cellPos( int ) const; // obsolete, do not use
|
---|
| 143 | int cellAt( int pos ) const { return mapToIndex( sectionAt(pos + offset()) ); } // obsolete, do not use
|
---|
| 144 |
|
---|
| 145 | int offset() const;
|
---|
| 146 |
|
---|
| 147 | QSize sizeHint() const;
|
---|
| 148 |
|
---|
| 149 | int mapToSection( int index ) const;
|
---|
| 150 | int mapToIndex( int section ) const;
|
---|
| 151 | int mapToLogical( int ) const; // obsolete, do not use
|
---|
| 152 | int mapToActual( int ) const; // obsolete, do not use
|
---|
| 153 |
|
---|
| 154 | void moveSection( int section, int toIndex );
|
---|
| 155 | virtual void moveCell( int, int); // obsolete, do not use
|
---|
| 156 |
|
---|
| 157 | void setSortIndicator( int section, bool ascending = TRUE ); // obsolete, do not use
|
---|
| 158 | inline void setSortIndicator( int section, SortOrder order )
|
---|
| 159 | { setSortIndicator( section, (order == Ascending) ); }
|
---|
| 160 | int sortIndicatorSection() const;
|
---|
| 161 | SortOrder sortIndicatorOrder() const;
|
---|
| 162 |
|
---|
| 163 | void adjustHeaderSize() { adjustHeaderSize( -1 ); }
|
---|
| 164 |
|
---|
| 165 | public slots:
|
---|
| 166 | void setUpdatesEnabled( bool enable );
|
---|
| 167 | virtual void setOffset( int pos );
|
---|
| 168 |
|
---|
| 169 | signals:
|
---|
| 170 | void clicked( int section );
|
---|
| 171 | void pressed( int section );
|
---|
| 172 | void released( int section );
|
---|
| 173 | void sizeChange( int section, int oldSize, int newSize );
|
---|
| 174 | void indexChange( int section, int fromIndex, int toIndex );
|
---|
| 175 | void sectionClicked( int ); // obsolete, do not use
|
---|
| 176 | void moved( int, int ); // obsolete, do not use
|
---|
| 177 | void sectionHandleDoubleClicked( int section );
|
---|
| 178 |
|
---|
| 179 | protected:
|
---|
| 180 | void paintEvent( QPaintEvent * );
|
---|
| 181 | void showEvent( QShowEvent *e );
|
---|
| 182 | void resizeEvent( QResizeEvent *e );
|
---|
| 183 | QRect sRect( int index );
|
---|
| 184 |
|
---|
| 185 | virtual void paintSection( QPainter *p, int index, const QRect& fr);
|
---|
| 186 | virtual void paintSectionLabel( QPainter* p, int index, const QRect& fr );
|
---|
| 187 |
|
---|
| 188 | void fontChange( const QFont & );
|
---|
| 189 |
|
---|
| 190 | void mousePressEvent( QMouseEvent * );
|
---|
| 191 | void mouseReleaseEvent( QMouseEvent * );
|
---|
| 192 | void mouseMoveEvent( QMouseEvent * );
|
---|
| 193 | void mouseDoubleClickEvent( QMouseEvent * );
|
---|
| 194 |
|
---|
| 195 | void keyPressEvent( QKeyEvent * );
|
---|
| 196 | void keyReleaseEvent( QKeyEvent * );
|
---|
| 197 |
|
---|
| 198 | private:
|
---|
| 199 | void handleColumnMove( int fromIdx, int toIdx );
|
---|
| 200 | void adjustHeaderSize( int diff );
|
---|
| 201 | void init( int );
|
---|
| 202 |
|
---|
| 203 | void paintRect( int p, int s );
|
---|
| 204 | void markLine( int idx );
|
---|
| 205 | void unMarkLine( int idx );
|
---|
| 206 | int pPos( int i ) const;
|
---|
| 207 | int pSize( int i ) const;
|
---|
| 208 | int findLine( int );
|
---|
| 209 | int handleAt( int p );
|
---|
| 210 | bool reverse() const;
|
---|
| 211 | void calculatePositions( bool onlyVisible = FALSE, int start = 0 );
|
---|
| 212 | void handleColumnResize(int, int, bool, bool = TRUE );
|
---|
| 213 | QSize sectionSizeHint( int section, const QFontMetrics& fm ) const;
|
---|
| 214 | void setSectionSizeAndHeight( int section, int size );
|
---|
| 215 |
|
---|
| 216 | void resizeArrays( int size );
|
---|
| 217 | void setIsATableHeader( bool b );
|
---|
| 218 | int offs;
|
---|
| 219 | int handleIdx;
|
---|
| 220 | int oldHIdxSize;
|
---|
| 221 | int moveToIdx;
|
---|
| 222 | enum State { Idle, Sliding, Pressed, Moving, Blocked };
|
---|
| 223 | State state;
|
---|
| 224 | QCOORD clickPos;
|
---|
| 225 | bool trackingIsOn;
|
---|
| 226 | int oldHandleIdx;
|
---|
| 227 | int cachedPos; // not used
|
---|
| 228 | Orientation orient;
|
---|
| 229 |
|
---|
| 230 | QHeaderData *d;
|
---|
| 231 |
|
---|
| 232 | private: // Disabled copy constructor and operator=
|
---|
| 233 | #if defined(Q_DISABLE_COPY)
|
---|
| 234 | QHeader( const QHeader & );
|
---|
| 235 | QHeader &operator=( const QHeader & );
|
---|
| 236 | #endif
|
---|
| 237 | };
|
---|
| 238 |
|
---|
| 239 |
|
---|
| 240 | inline QHeader::Orientation QHeader::orientation() const
|
---|
| 241 | {
|
---|
| 242 | return orient;
|
---|
| 243 | }
|
---|
| 244 |
|
---|
| 245 | inline void QHeader::setTracking( bool enable ) { trackingIsOn = enable; }
|
---|
| 246 | inline bool QHeader::tracking() const { return trackingIsOn; }
|
---|
| 247 |
|
---|
| 248 | extern Q_EXPORT bool qt_qheader_label_return_null_strings; // needed for professional edition
|
---|
| 249 |
|
---|
| 250 | #endif // QT_NO_HEADER
|
---|
| 251 |
|
---|
| 252 | #endif // QHEADER_H
|
---|
| 253 | </pre>
|
---|
| 254 | <!-- eof -->
|
---|
| 255 | <p><address><hr><div align=center>
|
---|
| 256 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 257 | <td>Copyright © 2007
|
---|
| 258 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 259 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 260 | </table></div></address></body>
|
---|
| 261 | </html>
|
---|