| 1 | /****************************************************************************
|
|---|
| 2 | ** $Id: qstyle.cpp 2 2005-11-16 15:49:26Z dmik $
|
|---|
| 3 | **
|
|---|
| 4 | ** Implementation of QStyle class
|
|---|
| 5 | **
|
|---|
| 6 | ** Created : 981231
|
|---|
| 7 | **
|
|---|
| 8 | ** Copyright (C) 1998-2002 Trolltech AS. All rights reserved.
|
|---|
| 9 | **
|
|---|
| 10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
|---|
| 11 | **
|
|---|
| 12 | ** This file may be distributed under the terms of the Q Public License
|
|---|
| 13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
|---|
| 14 | ** LICENSE.QPL included in the packaging of this file.
|
|---|
| 15 | **
|
|---|
| 16 | ** This file may be distributed and/or modified under the terms of the
|
|---|
| 17 | ** GNU General Public License version 2 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 19 | ** packaging of this file.
|
|---|
| 20 | **
|
|---|
| 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|---|
| 22 | ** licenses may use this file in accordance with the Qt Commercial License
|
|---|
| 23 | ** Agreement provided with the Software.
|
|---|
| 24 | **
|
|---|
| 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 27 | **
|
|---|
| 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|---|
| 29 | ** information about Qt Commercial License Agreements.
|
|---|
| 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|---|
| 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|---|
| 32 | **
|
|---|
| 33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
|---|
| 34 | ** not clear to you.
|
|---|
| 35 | **
|
|---|
| 36 | **********************************************************************/
|
|---|
| 37 |
|
|---|
| 38 | #include "qstyle.h"
|
|---|
| 39 | #ifndef QT_NO_STYLE
|
|---|
| 40 | #include "qapplication.h"
|
|---|
| 41 | #include "qpainter.h"
|
|---|
| 42 | #include "qbitmap.h"
|
|---|
| 43 | #include "qpixmapcache.h"
|
|---|
| 44 |
|
|---|
| 45 | #include <limits.h>
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 | class QStylePrivate
|
|---|
| 49 | {
|
|---|
| 50 | public:
|
|---|
| 51 | QStylePrivate()
|
|---|
| 52 | {
|
|---|
| 53 | }
|
|---|
| 54 | };
|
|---|
| 55 |
|
|---|
| 56 | /*!
|
|---|
| 57 | \class QStyleOption qstyle.h
|
|---|
| 58 | \brief The QStyleOption class specifies optional parameters for QStyle functions.
|
|---|
| 59 | \ingroup appearance
|
|---|
| 60 |
|
|---|
| 61 | Some QStyle functions take an optional argument specifying extra
|
|---|
| 62 | information that is required for a paritical primitive or control.
|
|---|
| 63 | So that the QStyle class can be extended, QStyleOption is used to
|
|---|
| 64 | provide a variable-argument for these options.
|
|---|
| 65 |
|
|---|
| 66 | The QStyleOption class has constructors for each type of optional
|
|---|
| 67 | argument, and this set of constructors may be extended in future
|
|---|
| 68 | Qt releases. There are also corresponding access functions that
|
|---|
| 69 | return the optional arguments: these too may be extended.
|
|---|
| 70 |
|
|---|
| 71 | For each constructor, you should refer to the documentation of the
|
|---|
| 72 | QStyle functions to see the meaning of the arguments.
|
|---|
| 73 |
|
|---|
| 74 | When calling QStyle functions from your own widgets, you must only
|
|---|
| 75 | pass the default QStyleOption or the argument that QStyle is
|
|---|
| 76 | documented to accept. For example, if the function expects
|
|---|
| 77 | QStyleOption(QMenuItem *, int), passing QStyleOption(QMenuItem *)
|
|---|
| 78 | leaves the optional integer argument uninitialized.
|
|---|
| 79 |
|
|---|
| 80 | When subclassing QStyle, you must similarly only expect the
|
|---|
| 81 | default or documented arguments. The other arguments will have
|
|---|
| 82 | uninitialized values.
|
|---|
| 83 |
|
|---|
| 84 | If you make your own QStyle subclasses and your own widgets, you
|
|---|
| 85 | can make a subclass of QStyleOption to pass additional arguments
|
|---|
| 86 | to your QStyle subclass. You will need to cast the "const
|
|---|
| 87 | QStyleOption&" argument to your subclass, so be sure your style
|
|---|
| 88 | has been called from your widget.
|
|---|
| 89 | */
|
|---|
| 90 |
|
|---|
| 91 | /*!
|
|---|
| 92 | \enum QStyleOption::StyleOptionDefault
|
|---|
| 93 |
|
|---|
| 94 | This enum value can be passed as the optional argument to any
|
|---|
| 95 | QStyle function.
|
|---|
| 96 |
|
|---|
| 97 | \value Default
|
|---|
| 98 | */
|
|---|
| 99 |
|
|---|
| 100 | /*!
|
|---|
| 101 | \fn QStyleOption::QStyleOption(StyleOptionDefault)
|
|---|
| 102 |
|
|---|
| 103 | The default option. This can always be passed as the optional
|
|---|
| 104 | argument to QStyle functions.
|
|---|
| 105 | */
|
|---|
| 106 |
|
|---|
| 107 | /*!
|
|---|
| 108 | \fn QStyleOption::QStyleOption(int)
|
|---|
| 109 |
|
|---|
| 110 | Pass one integer, \a in1. For example, headerSection.
|
|---|
| 111 | */
|
|---|
| 112 |
|
|---|
| 113 | /*!
|
|---|
| 114 | \fn QStyleOption::QStyleOption(int, int)
|
|---|
| 115 |
|
|---|
| 116 | Pass two integers, \a in1 and \a in2. For example, linewidth and
|
|---|
| 117 | midlinewidth.
|
|---|
| 118 | */
|
|---|
| 119 |
|
|---|
| 120 | /*!
|
|---|
| 121 | \fn QStyleOption::QStyleOption(int, int, int, int)
|
|---|
| 122 |
|
|---|
| 123 | Pass four integers, \a in1, \a in2, \a in3 and \a in4.
|
|---|
| 124 | */
|
|---|
| 125 |
|
|---|
| 126 | /*!
|
|---|
| 127 | \fn QStyleOption::QStyleOption(QMenuItem*)
|
|---|
| 128 |
|
|---|
| 129 | Pass a menu item, \a m.
|
|---|
| 130 | */
|
|---|
| 131 |
|
|---|
| 132 | /*!
|
|---|
| 133 | \fn QStyleOption::QStyleOption(QMenuItem*, int)
|
|---|
| 134 |
|
|---|
| 135 | Pass a menu item and an integer, \a m and \a in1.
|
|---|
| 136 | */
|
|---|
| 137 |
|
|---|
| 138 | /*!
|
|---|
| 139 | \fn QStyleOption::QStyleOption(QMenuItem*, int, int)
|
|---|
| 140 |
|
|---|
| 141 | Pass a menu item and two integers, \a m, \a in1 and \a in2.
|
|---|
| 142 | */
|
|---|
| 143 |
|
|---|
| 144 | /*!
|
|---|
| 145 | \fn QStyleOption::QStyleOption(const QColor&)
|
|---|
| 146 |
|
|---|
| 147 | Pass a color, \a c.
|
|---|
| 148 | */
|
|---|
| 149 |
|
|---|
| 150 | /*!
|
|---|
| 151 | \fn QStyleOption::QStyleOption(QTab*)
|
|---|
| 152 |
|
|---|
| 153 | Pass a QTab, \a t.
|
|---|
| 154 | */
|
|---|
| 155 |
|
|---|
| 156 | /*!
|
|---|
| 157 | \fn QStyleOption::QStyleOption(QListViewItem*)
|
|---|
| 158 |
|
|---|
| 159 | Pass a QListViewItem, \a i.
|
|---|
| 160 | */
|
|---|
| 161 |
|
|---|
| 162 | /*!
|
|---|
| 163 | \fn QStyleOption::QStyleOption(Qt::ArrowType)
|
|---|
| 164 |
|
|---|
| 165 | Pass an Qt::ArrowType, \a a.
|
|---|
| 166 | */
|
|---|
| 167 |
|
|---|
| 168 | /*!
|
|---|
| 169 | \fn QStyleOption::QStyleOption(QCheckListItem* i)
|
|---|
| 170 |
|
|---|
| 171 | Pass a QCheckListItem, \a i.
|
|---|
| 172 | */
|
|---|
| 173 |
|
|---|
| 174 | /*!
|
|---|
| 175 | \fn QStyleOption::QStyleOption( const QRect &r )
|
|---|
| 176 |
|
|---|
| 177 | Pass a QRect, \a r.
|
|---|
| 178 | */
|
|---|
| 179 |
|
|---|
| 180 | /*!
|
|---|
| 181 | \fn QStyleOption::QStyleOption( QWidget *w )
|
|---|
| 182 |
|
|---|
| 183 | Pass a QWidget, \a w.
|
|---|
| 184 | */
|
|---|
| 185 |
|
|---|
| 186 | /*!
|
|---|
| 187 | \fn bool QStyleOption::isDefault() const
|
|---|
| 188 |
|
|---|
| 189 | Returns TRUE if the option was constructed with the default
|
|---|
| 190 | constructor; otherwise returns FALSE.
|
|---|
| 191 | */
|
|---|
| 192 |
|
|---|
| 193 | /*!
|
|---|
| 194 | \fn int QStyleOption::day() const
|
|---|
| 195 |
|
|---|
| 196 | Returns the index of the day in the month if the appropriate
|
|---|
| 197 | constructor was called; otherwise the return value is undefined.
|
|---|
| 198 | */
|
|---|
| 199 |
|
|---|
| 200 | /*!
|
|---|
| 201 | \fn int QStyleOption::lineWidth() const
|
|---|
| 202 |
|
|---|
| 203 | Returns the line width if the appropriate constructor was called;
|
|---|
| 204 | otherwise the return value is undefined.
|
|---|
| 205 | */
|
|---|
| 206 |
|
|---|
| 207 | /*!
|
|---|
| 208 | \fn int QStyleOption::midLineWidth() const
|
|---|
| 209 |
|
|---|
| 210 | Returns the mid-line width if the appropriate constructor was
|
|---|
| 211 | called; otherwise the return value is undefined.
|
|---|
| 212 | */
|
|---|
| 213 |
|
|---|
| 214 | /*!
|
|---|
| 215 | \fn int QStyleOption::frameShape() const
|
|---|
| 216 |
|
|---|
| 217 | Returns a QFrame::Shape value if the appropriate constructor was
|
|---|
| 218 | called; otherwise the return value is undefined.
|
|---|
| 219 | */
|
|---|
| 220 |
|
|---|
| 221 | /*!
|
|---|
| 222 | \fn int QStyleOption::frameShadow() const
|
|---|
| 223 |
|
|---|
| 224 | Returns a QFrame::Shadow value if the appropriate constructor was
|
|---|
| 225 | called; otherwise the return value is undefined.
|
|---|
| 226 | */
|
|---|
| 227 |
|
|---|
| 228 | /*!
|
|---|
| 229 | \fn QMenuItem* QStyleOption::menuItem() const
|
|---|
| 230 |
|
|---|
| 231 | Returns a menu item if the appropriate constructor was called;
|
|---|
| 232 | otherwise the return value is undefined.
|
|---|
| 233 | */
|
|---|
| 234 |
|
|---|
| 235 | /*!
|
|---|
| 236 | \fn int QStyleOption::maxIconWidth() const
|
|---|
| 237 |
|
|---|
| 238 | Returns the maximum width of the menu item check area if the
|
|---|
| 239 | appropriate constructor was called; otherwise the return value is
|
|---|
| 240 | undefined.
|
|---|
| 241 | */
|
|---|
| 242 |
|
|---|
| 243 | /*!
|
|---|
| 244 | \fn int QStyleOption::tabWidth() const
|
|---|
| 245 |
|
|---|
| 246 | Returns the tab indent width if the appropriate constructor was
|
|---|
| 247 | called; otherwise the return value is undefined.
|
|---|
| 248 | */
|
|---|
| 249 |
|
|---|
| 250 | /*!
|
|---|
| 251 | \fn int QStyleOption::headerSection() const
|
|---|
| 252 |
|
|---|
| 253 | Returns the header section if the appropriate constructor was
|
|---|
| 254 | called; otherwise the return value is undefined.
|
|---|
| 255 | */
|
|---|
| 256 |
|
|---|
| 257 | /*!
|
|---|
| 258 | \fn const QColor& QStyleOption::color() const
|
|---|
| 259 |
|
|---|
| 260 | Returns a color if the appropriate constructor was called;
|
|---|
| 261 | otherwise the return value is undefined.
|
|---|
| 262 | */
|
|---|
| 263 |
|
|---|
| 264 | /*!
|
|---|
| 265 | \fn QTab* QStyleOption::tab() const
|
|---|
| 266 |
|
|---|
| 267 | Returns a QTabBar tab if the appropriate constructor was called;
|
|---|
| 268 | otherwise the return value is undefined.
|
|---|
| 269 | */
|
|---|
| 270 |
|
|---|
| 271 | /*!
|
|---|
| 272 | \fn QListViewItem* QStyleOption::listViewItem() const
|
|---|
| 273 |
|
|---|
| 274 | Returns a QListView item if the appropriate constructor was
|
|---|
| 275 | called; otherwise the return value is undefined.
|
|---|
| 276 | */
|
|---|
| 277 |
|
|---|
| 278 | /*!
|
|---|
| 279 | \fn Qt::ArrowType QStyleOption::arrowType() const
|
|---|
| 280 |
|
|---|
| 281 | Returns an arrow type if the appropriate constructor was called;
|
|---|
| 282 | otherwise the return value is undefined.
|
|---|
| 283 | */
|
|---|
| 284 |
|
|---|
| 285 | /*!
|
|---|
| 286 | \fn QCheckListItem* QStyleOption::checkListItem() const
|
|---|
| 287 |
|
|---|
| 288 | Returns a check list item if the appropriate constructor was
|
|---|
| 289 | called; otherwise the return value is undefined.
|
|---|
| 290 | */
|
|---|
| 291 |
|
|---|
| 292 | /*!
|
|---|
| 293 | \fn QRect QStyleOption::rect() const
|
|---|
| 294 |
|
|---|
| 295 | Returns a rectangle if the appropriate constructor was called;
|
|---|
| 296 | otherwise the return value is undefined.
|
|---|
| 297 | */
|
|---|
| 298 |
|
|---|
| 299 | /*!
|
|---|
| 300 | \fn QWidget* QStyleOption::widget() const
|
|---|
| 301 |
|
|---|
| 302 | Returns a pointer to a widget if the appropriate constructor was called;
|
|---|
| 303 | otherwise the return value is undefined.
|
|---|
| 304 | */
|
|---|
| 305 |
|
|---|
| 306 | /*!
|
|---|
| 307 | \class QStyle qstyle.h
|
|---|
| 308 | \brief The QStyle class specifies the look and feel of a GUI.
|
|---|
| 309 | \ingroup appearance
|
|---|
| 310 |
|
|---|
| 311 | A large number of GUI elements are common to many widgets. The
|
|---|
| 312 | QStyle class allows the look of these elements to be modified
|
|---|
| 313 | across all widgets that use the QStyle functions. It also
|
|---|
| 314 | provides two feel options: Motif and Windows.
|
|---|
| 315 |
|
|---|
| 316 | Although it is not possible to fully enumerate the look of
|
|---|
| 317 | graphical elements and the feel of widgets in a GUI, QStyle
|
|---|
| 318 | provides a considerable amount of control and customisability.
|
|---|
| 319 |
|
|---|
| 320 | In Qt 1.x the look and feel option for widgets was specified by a
|
|---|
| 321 | single value: the GUIStyle. Starting with Qt 2.0, this notion was
|
|---|
| 322 | expanded to allow the look to be specified by virtual drawing
|
|---|
| 323 | functions.
|
|---|
| 324 |
|
|---|
| 325 | Derived classes may reimplement some or all of the drawing
|
|---|
| 326 | functions to modify the look of all widgets that use those
|
|---|
| 327 | functions.
|
|---|
| 328 |
|
|---|
| 329 | Languages written from right to left (such as Arabic and Hebrew)
|
|---|
| 330 | usually also mirror the whole layout of widgets. If you design a
|
|---|
| 331 | style, you should take special care when drawing asymmetric
|
|---|
| 332 | elements to make sure that they also look correct in a mirrored
|
|---|
| 333 | layout. You can start your application with \c -reverse to check
|
|---|
| 334 | the mirrored layout. Also notice, that for a reversed layout, the
|
|---|
| 335 | light usually comes from top right instead of top left.
|
|---|
| 336 |
|
|---|
| 337 | The actual reverse layout is performed automatically when
|
|---|
| 338 | possible. However, for the sake of flexibility, the translation
|
|---|
| 339 | cannot be performed everywhere. The documentation for each
|
|---|
| 340 | function in the QStyle API states whether the function
|
|---|
| 341 | expects/returns logical or screen coordinates. Using logical
|
|---|
| 342 | coordinates (in ComplexControls, for example) provides great
|
|---|
| 343 | flexibility in controlling the look of a widget. Use visualRect()
|
|---|
| 344 | when necessary to translate logical coordinates into screen
|
|---|
| 345 | coordinates for drawing.
|
|---|
| 346 |
|
|---|
| 347 | In Qt versions prior to 3.0, if you wanted a low level route into
|
|---|
| 348 | changing the appearance of a widget, you would reimplement
|
|---|
| 349 | polish(). With the new 3.0 style engine the recommended approach
|
|---|
| 350 | is to reimplement the draw functions, for example drawItem(),
|
|---|
| 351 | drawPrimitive(), drawControl(), drawControlMask(),
|
|---|
| 352 | drawComplexControl() and drawComplexControlMask(). Each of these
|
|---|
| 353 | functions is called with a range of parameters that provide
|
|---|
| 354 | information that you can use to determine how to draw them, e.g.
|
|---|
| 355 | style flags, rectangle, color group, etc.
|
|---|
| 356 |
|
|---|
| 357 | For information on changing elements of an existing style or
|
|---|
| 358 | creating your own style see the \link customstyles.html Style
|
|---|
| 359 | overview\endlink.
|
|---|
| 360 |
|
|---|
| 361 | Styles can also be created as \link plugins-howto.html
|
|---|
| 362 | plugins\endlink.
|
|---|
| 363 | */
|
|---|
| 364 |
|
|---|
| 365 | /*!
|
|---|
| 366 | \enum Qt::GUIStyle
|
|---|
| 367 |
|
|---|
| 368 | \obsolete
|
|---|
| 369 |
|
|---|
| 370 | \value WindowsStyle
|
|---|
| 371 | \value MotifStyle
|
|---|
| 372 | \value MacStyle
|
|---|
| 373 | \value Win3Style
|
|---|
| 374 | \value PMStyle
|
|---|
| 375 | */
|
|---|
| 376 |
|
|---|
| 377 | /*!
|
|---|
| 378 | \enum Qt::UIEffect
|
|---|
| 379 |
|
|---|
| 380 | \value UI_General
|
|---|
| 381 | \value UI_AnimateMenu
|
|---|
| 382 | \value UI_FadeMenu
|
|---|
| 383 | \value UI_AnimateCombo
|
|---|
| 384 | \value UI_AnimateTooltip
|
|---|
| 385 | \value UI_FadeTooltip
|
|---|
| 386 | \value UI_AnimateToolBox Reserved
|
|---|
| 387 | */
|
|---|
| 388 |
|
|---|
| 389 | /*!
|
|---|
| 390 | Constructs a QStyle.
|
|---|
| 391 | */
|
|---|
| 392 | QStyle::QStyle()
|
|---|
| 393 | {
|
|---|
| 394 | d = new QStylePrivate;
|
|---|
| 395 | }
|
|---|
| 396 |
|
|---|
| 397 | /*!
|
|---|
| 398 | Destroys the style and frees all allocated resources.
|
|---|
| 399 | */
|
|---|
| 400 | QStyle::~QStyle()
|
|---|
| 401 | {
|
|---|
| 402 | delete d;
|
|---|
| 403 | d = 0;
|
|---|
| 404 | }
|
|---|
| 405 |
|
|---|
| 406 | /*
|
|---|
| 407 | \fn GUIStyle QStyle::guiStyle() const
|
|---|
| 408 | \obsolete
|
|---|
| 409 |
|
|---|
| 410 | Returns an indicator to the additional "feel" component of a
|
|---|
| 411 | style. Current supported values are Qt::WindowsStyle and Qt::MotifStyle.
|
|---|
| 412 | */
|
|---|
| 413 |
|
|---|
| 414 |
|
|---|
| 415 |
|
|---|
| 416 | /*!
|
|---|
| 417 | Initializes the appearance of a widget.
|
|---|
| 418 |
|
|---|
| 419 | This function is called for every widget at some point after it
|
|---|
| 420 | has been fully created but just \e before it is shown the very
|
|---|
| 421 | first time.
|
|---|
| 422 |
|
|---|
| 423 | Reasonable actions in this function might be to call
|
|---|
| 424 | QWidget::setBackgroundMode() for the widget. An example of highly
|
|---|
| 425 | unreasonable use would be setting the geometry! Reimplementing
|
|---|
| 426 | this function gives you a back-door through which you can change
|
|---|
| 427 | the appearance of a widget. With Qt 3.0's style engine you will
|
|---|
| 428 | rarely need to write your own polish(); instead reimplement
|
|---|
| 429 | drawItem(), drawPrimitive(), etc.
|
|---|
| 430 |
|
|---|
| 431 | The QWidget::inherits() function may provide enough information to
|
|---|
| 432 | allow class-specific customizations. But be careful not to
|
|---|
| 433 | hard-code things too much because new QStyle subclasses are
|
|---|
| 434 | expected to work reasonably with all current and \e future
|
|---|
| 435 | widgets.
|
|---|
| 436 |
|
|---|
| 437 | \sa unPolish()
|
|---|
| 438 | */
|
|---|
| 439 | void QStyle::polish( QWidget*)
|
|---|
| 440 | {
|
|---|
| 441 | }
|
|---|
| 442 |
|
|---|
| 443 | /*!
|
|---|
| 444 | Undoes the initialization of a widget's appearance.
|
|---|
| 445 |
|
|---|
| 446 | This function is the counterpart to polish. It is called for every
|
|---|
| 447 | polished widget when the style is dynamically changed. The former
|
|---|
| 448 | style has to unpolish its settings before the new style can polish
|
|---|
| 449 | them again.
|
|---|
| 450 |
|
|---|
| 451 | \sa polish()
|
|---|
| 452 | */
|
|---|
| 453 | void QStyle::unPolish( QWidget*)
|
|---|
| 454 | {
|
|---|
| 455 | }
|
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 | /*!
|
|---|
| 459 | \overload
|
|---|
| 460 |
|
|---|
| 461 | Late initialization of the QApplication object.
|
|---|
| 462 |
|
|---|
| 463 | \sa unPolish()
|
|---|
| 464 | */
|
|---|
| 465 | void QStyle::polish( QApplication*)
|
|---|
| 466 | {
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 | /*!
|
|---|
| 470 | \overload
|
|---|
| 471 |
|
|---|
| 472 | Undoes the application polish.
|
|---|
| 473 |
|
|---|
| 474 | \sa polish()
|
|---|
| 475 | */
|
|---|
| 476 | void QStyle::unPolish( QApplication*)
|
|---|
| 477 | {
|
|---|
| 478 | }
|
|---|
| 479 |
|
|---|
| 480 | /*!
|
|---|
| 481 | \overload
|
|---|
| 482 |
|
|---|
| 483 | The style may have certain requirements for color palettes. In
|
|---|
| 484 | this function it has the chance to change the palette according to
|
|---|
| 485 | these requirements.
|
|---|
| 486 |
|
|---|
| 487 | \sa QPalette, QApplication::setPalette()
|
|---|
| 488 | */
|
|---|
| 489 | void QStyle::polish( QPalette&)
|
|---|
| 490 | {
|
|---|
| 491 | }
|
|---|
| 492 |
|
|---|
| 493 | /*!
|
|---|
| 494 | Polishes the popup menu according to the GUI style. This usually
|
|---|
| 495 | means setting the mouse tracking
|
|---|
| 496 | (\l{QPopupMenu::setMouseTracking()}) and whether the menu is
|
|---|
| 497 | checkable by default (\l{QPopupMenu::setCheckable()}).
|
|---|
| 498 | */
|
|---|
| 499 | void QStyle::polishPopupMenu( QPopupMenu *)
|
|---|
| 500 | {
|
|---|
| 501 | }
|
|---|
| 502 |
|
|---|
| 503 | /*!
|
|---|
| 504 | Returns the appropriate area (see below) within rectangle \a r in
|
|---|
| 505 | which to draw the \a text or \a pixmap using painter \a p. If \a
|
|---|
| 506 | len is -1 (the default) all the \a text is drawn; otherwise only
|
|---|
| 507 | the first \a len characters of \a text are drawn. The text is
|
|---|
| 508 | aligned in accordance with the alignment \a flags (see
|
|---|
| 509 | \l{Qt::AlignmentFlags}). The \a enabled bool indicates whether or
|
|---|
| 510 | not the item is enabled.
|
|---|
| 511 |
|
|---|
| 512 | If \a r is larger than the area needed to render the \a text the
|
|---|
| 513 | rectangle that is returned will be offset within \a r in
|
|---|
| 514 | accordance with the alignment \a flags. For example if \a flags is
|
|---|
| 515 | \c AlignCenter the returned rectangle will be centered within \a
|
|---|
| 516 | r. If \a r is smaller than the area needed the rectangle that is
|
|---|
| 517 | returned will be \e larger than \a r (the smallest rectangle large
|
|---|
| 518 | enough to render the \a text or \a pixmap).
|
|---|
| 519 |
|
|---|
| 520 | By default, if both the text and the pixmap are not null, the
|
|---|
| 521 | pixmap is drawn and the text is ignored.
|
|---|
| 522 | */
|
|---|
| 523 | QRect QStyle::itemRect( QPainter *p, const QRect &r,
|
|---|
| 524 | int flags, bool enabled, const QPixmap *pixmap,
|
|---|
| 525 | const QString& text, int len ) const
|
|---|
| 526 | {
|
|---|
| 527 | QRect result;
|
|---|
| 528 | int x = r.x();
|
|---|
| 529 | int y = r.y();
|
|---|
| 530 | int w = r.width();
|
|---|
| 531 | int h = r.height();
|
|---|
| 532 | GUIStyle gs = (GUIStyle)styleHint( SH_GUIStyle );
|
|---|
| 533 |
|
|---|
| 534 | if ( pixmap ) {
|
|---|
| 535 | if ( (flags & Qt::AlignVCenter) == Qt::AlignVCenter )
|
|---|
| 536 | y += h/2 - pixmap->height()/2;
|
|---|
| 537 | else if ( (flags & Qt::AlignBottom) == Qt::AlignBottom)
|
|---|
| 538 | y += h - pixmap->height();
|
|---|
| 539 | if ( (flags & Qt::AlignRight) == Qt::AlignRight )
|
|---|
| 540 | x += w - pixmap->width();
|
|---|
| 541 | else if ( (flags & Qt::AlignHCenter) == Qt::AlignHCenter )
|
|---|
| 542 | x += w/2 - pixmap->width()/2;
|
|---|
| 543 | else if ( (flags & Qt::AlignLeft) != Qt::AlignLeft && QApplication::reverseLayout() )
|
|---|
| 544 | x += w - pixmap->width();
|
|---|
| 545 | result = QRect(x, y, pixmap->width(), pixmap->height());
|
|---|
| 546 | } else if ( !text.isNull() && p ) {
|
|---|
| 547 | result = p->boundingRect( x, y, w, h, flags, text, len );
|
|---|
| 548 | if ( gs == Qt::WindowsStyle && !enabled ) {
|
|---|
| 549 | result.setWidth(result.width()+1);
|
|---|
| 550 | result.setHeight(result.height()+1);
|
|---|
| 551 | }
|
|---|
| 552 | } else {
|
|---|
| 553 | result = QRect(x, y, w, h);
|
|---|
| 554 | }
|
|---|
| 555 |
|
|---|
| 556 | return result;
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 |
|
|---|
| 560 | /*!
|
|---|
| 561 | Draws the \a text or \a pixmap in rectangle \a r using painter \a
|
|---|
| 562 | p and color group \a g. The pen color is specified with \a
|
|---|
| 563 | penColor. The \a enabled bool indicates whether or not the item is
|
|---|
| 564 | enabled; when reimplementing this bool should influence how the
|
|---|
| 565 | item is drawn. If \a len is -1 (the default) all the \a text is
|
|---|
| 566 | drawn; otherwise only the first \a len characters of \a text are
|
|---|
| 567 | drawn. The text is aligned and wrapped according to the alignment
|
|---|
| 568 | \a flags (see \l{Qt::AlignmentFlags}).
|
|---|
| 569 |
|
|---|
| 570 | By default, if both the text and the pixmap are not null, the
|
|---|
| 571 | pixmap is drawn and the text is ignored.
|
|---|
| 572 | */
|
|---|
| 573 | void QStyle::drawItem( QPainter *p, const QRect &r,
|
|---|
| 574 | int flags, const QColorGroup &g, bool enabled,
|
|---|
| 575 | const QPixmap *pixmap, const QString& text, int len,
|
|---|
| 576 | const QColor* penColor ) const
|
|---|
| 577 | {
|
|---|
| 578 | int x = r.x();
|
|---|
| 579 | int y = r.y();
|
|---|
| 580 | int w = r.width();
|
|---|
| 581 | int h = r.height();
|
|---|
| 582 | GUIStyle gs = (GUIStyle)styleHint( SH_GUIStyle );
|
|---|
| 583 |
|
|---|
| 584 | p->setPen( penColor?*penColor:g.foreground() );
|
|---|
| 585 | if ( pixmap ) {
|
|---|
| 586 | QPixmap pm( *pixmap );
|
|---|
| 587 | bool clip = (flags & Qt::DontClip) == 0;
|
|---|
| 588 | if ( clip ) {
|
|---|
| 589 | if ( pm.width() < w && pm.height() < h ) {
|
|---|
| 590 | clip = FALSE;
|
|---|
| 591 | } else {
|
|---|
| 592 | p->save();
|
|---|
| 593 | QRegion cr = QRect(x, y, w, h);
|
|---|
| 594 | if (p->hasClipping())
|
|---|
| 595 | cr &= p->clipRegion(QPainter::CoordPainter);
|
|---|
| 596 | p->setClipRegion(cr);
|
|---|
| 597 | }
|
|---|
| 598 | }
|
|---|
| 599 | if ( (flags & Qt::AlignVCenter) == Qt::AlignVCenter )
|
|---|
| 600 | y += h/2 - pm.height()/2;
|
|---|
| 601 | else if ( (flags & Qt::AlignBottom) == Qt::AlignBottom)
|
|---|
| 602 | y += h - pm.height();
|
|---|
| 603 | if ( (flags & Qt::AlignRight) == Qt::AlignRight )
|
|---|
| 604 | x += w - pm.width();
|
|---|
| 605 | else if ( (flags & Qt::AlignHCenter) == Qt::AlignHCenter )
|
|---|
| 606 | x += w/2 - pm.width()/2;
|
|---|
| 607 | else if ( ((flags & Qt::AlignLeft) != Qt::AlignLeft) && QApplication::reverseLayout() ) // AlignAuto && rightToLeft
|
|---|
| 608 | x += w - pm.width();
|
|---|
| 609 |
|
|---|
| 610 | if ( !enabled ) {
|
|---|
| 611 | if ( pm.mask() ) { // pixmap with a mask
|
|---|
| 612 | if ( !pm.selfMask() ) { // mask is not pixmap itself
|
|---|
| 613 | QPixmap pmm( *pm.mask() );
|
|---|
| 614 | pmm.setMask( *((QBitmap *)&pmm) );
|
|---|
| 615 | pm = pmm;
|
|---|
| 616 | }
|
|---|
| 617 | } else if ( pm.depth() == 1 ) { // monochrome pixmap, no mask
|
|---|
| 618 | pm.setMask( *((QBitmap *)&pm) );
|
|---|
| 619 | #ifndef QT_NO_IMAGE_HEURISTIC_MASK
|
|---|
| 620 | } else { // color pixmap, no mask
|
|---|
| 621 | QString k;
|
|---|
| 622 | k.sprintf( "$qt-drawitem-%x", pm.serialNumber() );
|
|---|
| 623 | QPixmap *mask = QPixmapCache::find(k);
|
|---|
| 624 | bool del=FALSE;
|
|---|
| 625 | if ( !mask ) {
|
|---|
| 626 | mask = new QPixmap( pm.createHeuristicMask() );
|
|---|
| 627 | mask->setMask( *((QBitmap*)mask) );
|
|---|
| 628 | del = !QPixmapCache::insert( k, mask );
|
|---|
| 629 | }
|
|---|
| 630 | pm = *mask;
|
|---|
| 631 | if (del) delete mask;
|
|---|
| 632 | #endif
|
|---|
| 633 | }
|
|---|
| 634 | if ( gs == Qt::WindowsStyle ) {
|
|---|
| 635 | p->setPen( g.light() );
|
|---|
| 636 | p->drawPixmap( x+1, y+1, pm );
|
|---|
| 637 | p->setPen( g.text() );
|
|---|
| 638 | }
|
|---|
| 639 | }
|
|---|
| 640 | p->drawPixmap( x, y, pm );
|
|---|
| 641 | if ( clip )
|
|---|
| 642 | p->restore();
|
|---|
| 643 | } else if ( !text.isNull() ) {
|
|---|
| 644 | if ( gs == Qt::WindowsStyle && !enabled ) {
|
|---|
| 645 | p->setPen( g.light() );
|
|---|
| 646 | p->drawText( x+1, y+1, w, h, flags, text, len );
|
|---|
| 647 | p->setPen( g.text() );
|
|---|
| 648 | }
|
|---|
| 649 | p->drawText( x, y, w, h, flags, text, len );
|
|---|
| 650 | }
|
|---|
| 651 | }
|
|---|
| 652 |
|
|---|
| 653 | /*!
|
|---|
| 654 | \enum QStyle::PrimitiveElement
|
|---|
| 655 |
|
|---|
| 656 | This enum represents the PrimitiveElements of a style. A
|
|---|
| 657 | PrimitiveElement is a common GUI element, such as a checkbox
|
|---|
| 658 | indicator or pushbutton bevel.
|
|---|
| 659 |
|
|---|
| 660 | \value PE_ButtonCommand button used to initiate an action, for
|
|---|
| 661 | example, a QPushButton.
|
|---|
| 662 | \value PE_ButtonDefault this button is the default button, e.g.
|
|---|
| 663 | in a dialog.
|
|---|
| 664 | \value PE_ButtonBevel generic button bevel.
|
|---|
| 665 | \value PE_ButtonTool tool button, for example, a QToolButton.
|
|---|
| 666 | \value PE_ButtonDropDown drop down button, for example, a tool
|
|---|
| 667 | button that displays a popup menu, for example, QPopupMenu.
|
|---|
| 668 |
|
|---|
| 669 |
|
|---|
| 670 | \value PE_FocusRect generic focus indicator.
|
|---|
| 671 |
|
|---|
| 672 |
|
|---|
| 673 | \value PE_ArrowUp up arrow.
|
|---|
| 674 | \value PE_ArrowDown down arrow.
|
|---|
| 675 | \value PE_ArrowRight right arrow.
|
|---|
| 676 | \value PE_ArrowLeft left arrow.
|
|---|
| 677 |
|
|---|
| 678 |
|
|---|
| 679 | \value PE_SpinWidgetUp up symbol for a spin widget, for example a
|
|---|
| 680 | QSpinBox.
|
|---|
| 681 | \value PE_SpinWidgetDown down symbol for a spin widget.
|
|---|
| 682 | \value PE_SpinWidgetPlus increase symbol for a spin widget.
|
|---|
| 683 | \value PE_SpinWidgetMinus decrease symbol for a spin widget.
|
|---|
| 684 |
|
|---|
| 685 |
|
|---|
| 686 | \value PE_Indicator on/off indicator, for example, a QCheckBox.
|
|---|
| 687 | \value PE_IndicatorMask bitmap mask for an indicator.
|
|---|
| 688 | \value PE_ExclusiveIndicator exclusive on/off indicator, for
|
|---|
| 689 | example, a QRadioButton.
|
|---|
| 690 | \value PE_ExclusiveIndicatorMask bitmap mask for an exclusive indicator.
|
|---|
| 691 |
|
|---|
| 692 |
|
|---|
| 693 | \value PE_DockWindowHandle tear off handle for dock windows and
|
|---|
| 694 | toolbars, for example \l{QDockWindow}s and \l{QToolBar}s.
|
|---|
| 695 | \value PE_DockWindowSeparator item separator for dock window and
|
|---|
| 696 | toolbar contents.
|
|---|
| 697 | \value PE_DockWindowResizeHandle resize handle for dock windows.
|
|---|
| 698 |
|
|---|
| 699 | \value PE_Splitter splitter handle; see also QSplitter.
|
|---|
| 700 |
|
|---|
| 701 |
|
|---|
| 702 | \value PE_Panel generic panel frame; see also QFrame.
|
|---|
| 703 | \value PE_PanelPopup panel frame for popup windows/menus; see also
|
|---|
| 704 | QPopupMenu.
|
|---|
| 705 | \value PE_PanelMenuBar panel frame for menu bars.
|
|---|
| 706 | \value PE_PanelDockWindow panel frame for dock windows and toolbars.
|
|---|
| 707 | \value PE_PanelTabWidget panel frame for tab widgets.
|
|---|
| 708 | \value PE_PanelLineEdit panel frame for line edits.
|
|---|
| 709 | \value PE_PanelGroupBox panel frame for group boxes.
|
|---|
| 710 |
|
|---|
| 711 | \value PE_TabBarBase area below tabs in a tab widget, for example,
|
|---|
| 712 | QTab.
|
|---|
| 713 |
|
|---|
| 714 |
|
|---|
| 715 | \value PE_HeaderSection section of a list or table header; see also
|
|---|
| 716 | QHeader.
|
|---|
| 717 | \value PE_HeaderArrow arrow used to indicate sorting on a list or table
|
|---|
| 718 | header
|
|---|
| 719 | \value PE_StatusBarSection section of a status bar; see also
|
|---|
| 720 | QStatusBar.
|
|---|
| 721 |
|
|---|
| 722 |
|
|---|
| 723 | \value PE_GroupBoxFrame frame around a group box; see also
|
|---|
| 724 | QGroupBox.
|
|---|
| 725 | \value PE_WindowFrame frame around a MDI window or a docking window
|
|---|
| 726 |
|
|---|
| 727 |
|
|---|
| 728 | \value PE_Separator generic separator.
|
|---|
| 729 |
|
|---|
| 730 |
|
|---|
| 731 | \value PE_SizeGrip window resize handle; see also QSizeGrip.
|
|---|
| 732 |
|
|---|
| 733 |
|
|---|
| 734 | \value PE_CheckMark generic check mark; see also QCheckBox.
|
|---|
| 735 |
|
|---|
| 736 |
|
|---|
| 737 | \value PE_ScrollBarAddLine scrollbar line increase indicator
|
|---|
| 738 | (i.e. scroll down); see also QScrollBar.
|
|---|
| 739 | \value PE_ScrollBarSubLine scrollbar line decrease indicator (i.e. scroll up).
|
|---|
| 740 | \value PE_ScrollBarAddPage scolllbar page increase indicator (i.e. page down).
|
|---|
| 741 | \value PE_ScrollBarSubPage scrollbar page decrease indicator (i.e. page up).
|
|---|
| 742 | \value PE_ScrollBarSlider scrollbar slider
|
|---|
| 743 | \value PE_ScrollBarFirst scrollbar first line indicator (i.e. home).
|
|---|
| 744 | \value PE_ScrollBarLast scrollbar last line indicator (i.e. end).
|
|---|
| 745 |
|
|---|
| 746 |
|
|---|
| 747 | \value PE_ProgressBarChunk section of a progress bar indicator; see
|
|---|
| 748 | also QProgressBar.
|
|---|
| 749 |
|
|---|
| 750 | \value PE_CheckListController controller part of a listview item
|
|---|
| 751 | \value PE_CheckListIndicator checkbox part of a listview item
|
|---|
| 752 | \value PE_CheckListExclusiveIndicator radiobutton part of a listview item
|
|---|
| 753 | \value PE_RubberBand rubber band used in such things as iconview
|
|---|
| 754 |
|
|---|
| 755 | \value PE_CustomBase base value for custom PrimitiveElements.
|
|---|
| 756 | All values above this are reserved for custom use. Custom
|
|---|
| 757 | values must be greater than this value.
|
|---|
| 758 |
|
|---|
| 759 | \sa drawPrimitive()
|
|---|
| 760 | */
|
|---|
| 761 | /*! \enum QStyle::SFlags
|
|---|
| 762 | \internal
|
|---|
| 763 | */
|
|---|
| 764 | /*! \enum QStyle::SCFlags
|
|---|
| 765 | \internal
|
|---|
| 766 | */
|
|---|
| 767 |
|
|---|
| 768 | /*!
|
|---|
| 769 | \enum QStyle::StyleFlags
|
|---|
| 770 |
|
|---|
| 771 | This enum represents flags for drawing PrimitiveElements. Not all
|
|---|
| 772 | primitives use all of these flags. Note that these flags may mean
|
|---|
| 773 | different things to different primitives. For an explanation of
|
|---|
| 774 | the relationship between primitives and their flags, as well as
|
|---|
| 775 | the different meanings of the flags, see the \link
|
|---|
| 776 | customstyles.html Style overview\endlink.
|
|---|
| 777 |
|
|---|
| 778 | \value Style_Default
|
|---|
| 779 | \value Style_Enabled
|
|---|
| 780 | \value Style_Raised
|
|---|
| 781 | \value Style_Sunken
|
|---|
| 782 | \value Style_Off
|
|---|
| 783 | \value Style_NoChange
|
|---|
| 784 | \value Style_On
|
|---|
| 785 | \value Style_Down
|
|---|
| 786 | \value Style_Horizontal
|
|---|
| 787 | \value Style_HasFocus
|
|---|
| 788 | \value Style_Top
|
|---|
| 789 | \value Style_Bottom
|
|---|
| 790 | \value Style_FocusAtBorder
|
|---|
| 791 | \value Style_AutoRaise
|
|---|
| 792 | \value Style_MouseOver
|
|---|
| 793 | \value Style_Up
|
|---|
| 794 | \value Style_Selected
|
|---|
| 795 | \value Style_HasFocus
|
|---|
| 796 | \value Style_Active
|
|---|
| 797 | \value Style_ButtonDefault
|
|---|
| 798 |
|
|---|
| 799 | \sa drawPrimitive()
|
|---|
| 800 | */
|
|---|
| 801 |
|
|---|
| 802 | /*!
|
|---|
| 803 | \fn void QStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, const QStyleOption& opt) const
|
|---|
| 804 |
|
|---|
| 805 | Draws the style PrimitiveElement \a pe using the painter \a p in
|
|---|
| 806 | the area \a r. Colors are used from the color group \a cg.
|
|---|
| 807 |
|
|---|
| 808 | The rect \a r should be in screen coordinates.
|
|---|
| 809 |
|
|---|
| 810 | The \a flags argument is used to control how the PrimitiveElement
|
|---|
| 811 | is drawn. Multiple flags can be OR'ed together.
|
|---|
| 812 |
|
|---|
| 813 | For example, a pressed button would be drawn with the flags \c
|
|---|
| 814 | Style_Enabled and \c Style_Down.
|
|---|
| 815 |
|
|---|
| 816 | The \a opt argument can be used to control how various
|
|---|
| 817 | PrimitiveElements are drawn. Note that \a opt may be the default
|
|---|
| 818 | value even for PrimitiveElements that make use of extra options.
|
|---|
| 819 | When \a opt is non-default, it is used as follows:
|
|---|
| 820 |
|
|---|
| 821 | \table
|
|---|
| 822 | \header \i PrimitiveElement \i Options \i Notes
|
|---|
| 823 | \row \i \l PE_FocusRect
|
|---|
| 824 | \i \l QStyleOption ( const \l QColor & bg )
|
|---|
| 825 | \list
|
|---|
| 826 | \i opt.\link QStyleOption::color() color\endlink()
|
|---|
| 827 | \endlist
|
|---|
| 828 | \i \e bg is the background color on which the focus rect is being drawn.
|
|---|
| 829 | \row \i12 \l PE_Panel
|
|---|
| 830 | \i12 \l QStyleOption ( int linewidth, int midlinewidth )
|
|---|
| 831 | \list
|
|---|
| 832 | \i opt.\link QStyleOption::lineWidth() lineWidth\endlink()
|
|---|
| 833 | \i opt.\link QStyleOption::midLineWidth() midLineWidth\endlink()
|
|---|
| 834 | \endlist
|
|---|
| 835 | \i \e linewidth is the line width for drawing the panel.
|
|---|
| 836 | \row \i \e midlinewidth is the mid-line width for drawing the panel.
|
|---|
| 837 | \row \i12 \l PE_PanelPopup
|
|---|
| 838 | \i12 \l QStyleOption ( int linewidth, int midlinewidth )
|
|---|
| 839 | \list
|
|---|
| 840 | \i opt.\link QStyleOption::lineWidth() lineWidth\endlink()
|
|---|
| 841 | \i opt.\link QStyleOption::midLineWidth() midLineWidth\endlink()
|
|---|
| 842 | \endlist
|
|---|
| 843 | \i \e linewidth is the line width for drawing the panel.
|
|---|
| 844 | \row \i \e midlinewidth is the mid-line width for drawing the panel.
|
|---|
| 845 | \row \i12 \l PE_PanelMenuBar
|
|---|
| 846 | \i12 \l QStyleOption ( int linewidth, int midlinewidth )
|
|---|
| 847 | \list
|
|---|
| 848 | \i opt.\link QStyleOption::lineWidth() lineWidth\endlink()
|
|---|
| 849 | \i opt.\link QStyleOption::midLineWidth() midLineWidth\endlink()
|
|---|
| 850 | \endlist
|
|---|
| 851 | \i \e linewidth is the line width for drawing the panel.
|
|---|
| 852 | \row \i \e midlinewidth is the mid-line width for drawing the panel.
|
|---|
| 853 | \row \i12 \l PE_PanelDockWindow
|
|---|
| 854 | \i12 \l QStyleOption ( int linewidth, int midlinewidth )
|
|---|
| 855 | \list
|
|---|
| 856 | \i opt.\link QStyleOption::lineWidth() lineWidth\endlink()
|
|---|
| 857 | \i opt.\link QStyleOption::midLineWidth() midLineWidth\endlink()
|
|---|
| 858 | \endlist
|
|---|
| 859 | \i \e linewidth is the line width for drawing the panel.
|
|---|
| 860 | \row \i \e midlinewidth is the mid-line width for drawing the panel.
|
|---|
| 861 | \row \i14 \l PE_GroupBoxFrame
|
|---|
| 862 | \i14 \l QStyleOption ( int linewidth, int midlinewidth, int shape, int shadow )
|
|---|
| 863 | \list
|
|---|
| 864 | \i opt.\link QStyleOption::lineWidth() lineWidth\endlink()
|
|---|
| 865 | \i opt.\link QStyleOption::midLineWidth() midLineWidth\endlink()
|
|---|
| 866 | \i opt.\link QStyleOption::frameShape() frameShape\endlink()
|
|---|
| 867 | \i opt.\link QStyleOption::frameShadow() frameShadow\endlink()
|
|---|
| 868 | \endlist
|
|---|
| 869 | \i \e linewidth is the line width for the group box.
|
|---|
| 870 | \row \i \e midlinewidth is the mid-line width for the group box.
|
|---|
| 871 | \row \i \e shape is the \link QFrame::frameShape frame shape \endlink
|
|---|
| 872 | for the group box.
|
|---|
| 873 | \row \i \e shadow is the \link QFrame::frameShadow frame shadow \endlink
|
|---|
| 874 | for the group box.
|
|---|
| 875 | \endtable
|
|---|
| 876 |
|
|---|
| 877 |
|
|---|
| 878 | For all other \link QStyle::PrimitiveElement
|
|---|
| 879 | PrimitiveElements\endlink, \a opt is unused.
|
|---|
| 880 |
|
|---|
| 881 | \sa StyleFlags
|
|---|
| 882 | */
|
|---|
| 883 |
|
|---|
| 884 | /*!
|
|---|
| 885 | \enum QStyle::ControlElement
|
|---|
| 886 |
|
|---|
| 887 | This enum represents a ControlElement. A ControlElement is part of
|
|---|
| 888 | a widget that performs some action or displays information to the
|
|---|
| 889 | user.
|
|---|
| 890 |
|
|---|
| 891 | \value CE_PushButton the bevel and default indicator of a QPushButton.
|
|---|
| 892 | \value CE_PushButtonLabel the label (iconset with text or pixmap)
|
|---|
| 893 | of a QPushButton.
|
|---|
| 894 |
|
|---|
| 895 | \value CE_CheckBox the indicator of a QCheckBox.
|
|---|
| 896 | \value CE_CheckBoxLabel the label (text or pixmap) of a QCheckBox.
|
|---|
| 897 |
|
|---|
| 898 | \value CE_RadioButton the indicator of a QRadioButton.
|
|---|
| 899 | \value CE_RadioButtonLabel the label (text or pixmap) of a QRadioButton.
|
|---|
| 900 |
|
|---|
| 901 | \value CE_TabBarTab the tab within a QTabBar (a QTab).
|
|---|
| 902 | \value CE_TabBarLabel the label within a QTab.
|
|---|
| 903 |
|
|---|
| 904 | \value CE_ProgressBarGroove the groove where the progress
|
|---|
| 905 | indicator is drawn in a QProgressBar.
|
|---|
| 906 | \value CE_ProgressBarContents the progress indicator of a QProgressBar.
|
|---|
| 907 | \value CE_ProgressBarLabel the text label of a QProgressBar.
|
|---|
| 908 |
|
|---|
| 909 | \value CE_PopupMenuItem a menu item in a QPopupMenu.
|
|---|
| 910 | \value CE_PopupMenuScroller scrolling areas in a popumenu when the
|
|---|
| 911 | style supports scrolling.
|
|---|
| 912 | \value CE_PopupMenuHorizontalExtra extra frame area set aside with PM_PopupMenuFrameHorizontalExtra
|
|---|
| 913 | \value CE_PopupMenuVerticalExtra extra frame area set aside with PM_PopupMenuFrameVerticalExtra
|
|---|
| 914 |
|
|---|
| 915 | \value CE_MenuBarItem a menu item in a QMenuBar.
|
|---|
| 916 |
|
|---|
| 917 | \value CE_ToolButtonLabel a tool button's label.
|
|---|
| 918 |
|
|---|
| 919 | \value CE_MenuBarEmptyArea the empty area of a QMenuBar.
|
|---|
| 920 | \value CE_DockWindowEmptyArea the empty area of a QDockWindow.
|
|---|
| 921 |
|
|---|
| 922 | \value CE_ToolBoxTab the toolbox's tab area
|
|---|
| 923 | \value CE_HeaderLabel the header's label
|
|---|
| 924 |
|
|---|
| 925 | \value CE_CustomBase base value for custom ControlElements. All values above
|
|---|
| 926 | this are reserved for custom use. Therefore, custom values must be
|
|---|
| 927 | greater than this value.
|
|---|
| 928 |
|
|---|
| 929 | \sa drawControl()
|
|---|
| 930 | */
|
|---|
| 931 |
|
|---|
| 932 | /*!
|
|---|
| 933 | \fn void QStyle::drawControl( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how, const QStyleOption& opt) const
|
|---|
| 934 |
|
|---|
| 935 | Draws the ControlElement \a element using the painter \a p in the
|
|---|
| 936 | area \a r. Colors are used from the color group \a cg.
|
|---|
| 937 |
|
|---|
| 938 | The rect \a r should be in screen coordinates.
|
|---|
| 939 |
|
|---|
| 940 | The \a how argument is used to control how the ControlElement is
|
|---|
| 941 | drawn. Multiple flags can be OR'ed together. See the table below
|
|---|
| 942 | for an explanation of which flags are used with the various
|
|---|
| 943 | ControlElements.
|
|---|
| 944 |
|
|---|
| 945 | The \a widget argument is a pointer to a QWidget or one of its
|
|---|
| 946 | subclasses. The widget can be cast to the appropriate type based
|
|---|
| 947 | on the value of \a element. The \a opt argument can be used to
|
|---|
| 948 | pass extra information required when drawing the ControlElement.
|
|---|
| 949 | Note that \a opt may be the default value even for ControlElements
|
|---|
| 950 | that can make use of the extra options. See the table below for
|
|---|
| 951 | the appropriate \a widget and \a opt usage:
|
|---|
| 952 |
|
|---|
| 953 | \table
|
|---|
| 954 | \header \i ControlElement<br>\& Widget Cast
|
|---|
| 955 | \i Style Flags
|
|---|
| 956 | \i Notes
|
|---|
| 957 | \i Options
|
|---|
| 958 | \i Notes
|
|---|
| 959 |
|
|---|
| 960 | \row \i16 \l{CE_PushButton}(const \l QPushButton *)
|
|---|
| 961 |
|
|---|
| 962 | and
|
|---|
| 963 |
|
|---|
| 964 | \l{CE_PushButtonLabel}(const \l QPushButton *)
|
|---|
| 965 | \i \l Style_Enabled \i Set if the button is enabled.
|
|---|
| 966 | \i16 Unused.
|
|---|
| 967 | \i16
|
|---|
| 968 | \row \i \l Style_HasFocus \i Set if the button has input focus.
|
|---|
| 969 | \row \i \l Style_Raised \i Set if the button is not down, not on and not flat.
|
|---|
| 970 | \row \i \l Style_On \i Set if the button is a toggle button and toggled on.
|
|---|
| 971 | \row \i \l Style_Down \i Set if the button is down (i.e., the mouse button or
|
|---|
| 972 | space bar is pressed on the button).
|
|---|
| 973 | \row \i \l Style_ButtonDefault \i Set if the button is a default button.
|
|---|
| 974 |
|
|---|
| 975 | \row \i16 \l{CE_CheckBox}(const \l QCheckBox *)
|
|---|
| 976 |
|
|---|
| 977 | and
|
|---|
| 978 |
|
|---|
| 979 | \l{CE_CheckBoxLabel}(const \l QCheckBox *)
|
|---|
| 980 |
|
|---|
| 981 | \i \l Style_Enabled \i Set if the checkbox is enabled.
|
|---|
| 982 | \i16 Unused.
|
|---|
| 983 | \i16
|
|---|
| 984 | \row \i \l Style_HasFocus \i Set if the checkbox has input focus.
|
|---|
| 985 | \row \i \l Style_On \i Set if the checkbox is checked.
|
|---|
| 986 | \row \i \l Style_Off \i Set if the checkbox is not checked.
|
|---|
| 987 | \row \i \l Style_NoChange \i Set if the checkbox is in the NoChange state.
|
|---|
| 988 | \row \i \l Style_Down \i Set if the checkbox is down (i.e., the mouse button or
|
|---|
| 989 | space bar is pressed on the button).
|
|---|
| 990 |
|
|---|
| 991 | \row \i15 \l{CE_RadioButton}(const QRadioButton *)
|
|---|
| 992 |
|
|---|
| 993 | and
|
|---|
| 994 |
|
|---|
| 995 | \l{CE_RadioButtonLabel}(const QRadioButton *)
|
|---|
| 996 | \i \l Style_Enabled \i Set if the radiobutton is enabled.
|
|---|
| 997 | \i15 Unused.
|
|---|
| 998 | \i15
|
|---|
| 999 | \row \i \l Style_HasFocus \i Set if the radiobutton has input focus.
|
|---|
| 1000 | \row \i \l Style_On \i Set if the radiobutton is checked.
|
|---|
| 1001 | \row \i \l Style_Off \i Set if the radiobutton is not checked.
|
|---|
| 1002 | \row \i \l Style_Down \i Set if the radiobutton is down (i.e., the mouse
|
|---|
| 1003 | button or space bar is pressed on the radiobutton).
|
|---|
| 1004 |
|
|---|
| 1005 | \row \i12 \l{CE_TabBarTab}(const \l QTabBar *)
|
|---|
| 1006 |
|
|---|
| 1007 | and
|
|---|
| 1008 |
|
|---|
| 1009 | \l{CE_TabBarLabel}(const \l QTabBar *)
|
|---|
| 1010 |
|
|---|
| 1011 | \i \l Style_Enabled \i Set if the tabbar and tab is enabled.
|
|---|
| 1012 | \i12 \l QStyleOption ( \l QTab *t )
|
|---|
| 1013 | \list
|
|---|
| 1014 | \i opt.\link QStyleOption::tab() tab\endlink()
|
|---|
| 1015 | \endlist
|
|---|
| 1016 | \i12 \e t is the QTab being drawn.
|
|---|
| 1017 | \row \i \l Style_Selected \i Set if the tab is the current tab.
|
|---|
| 1018 |
|
|---|
| 1019 | \row \i12 \l{CE_ProgressBarGroove}(const QProgressBar *)
|
|---|
| 1020 |
|
|---|
| 1021 | and
|
|---|
| 1022 |
|
|---|
| 1023 | \l{CE_ProgressBarContents}(const QProgressBar *)
|
|---|
| 1024 |
|
|---|
| 1025 | and
|
|---|
| 1026 |
|
|---|
| 1027 | \l{CE_ProgressBarLabel}(const QProgressBar *)
|
|---|
| 1028 |
|
|---|
| 1029 | \i \l Style_Enabled \i Set if the progressbar is enabled.
|
|---|
| 1030 | \i12 Unused.
|
|---|
| 1031 | \i12
|
|---|
| 1032 | \row \i \l Style_HasFocus \i Set if the progressbar has input focus.
|
|---|
| 1033 |
|
|---|
| 1034 | \row \i13 \l{CE_PopupMenuItem}(const \l QPopupMenu *)
|
|---|
| 1035 | \i \l Style_Enabled \i Set if the menuitem is enabled.
|
|---|
| 1036 | \i13 \l QStyleOption ( QMenuItem *mi, int tabwidth, int maxpmwidth )
|
|---|
| 1037 | \list
|
|---|
| 1038 | \i opt.\link QStyleOption::menuItem() menuItem\endlink()
|
|---|
| 1039 | \i opt.\link QStyleOption::tabWidth() tabWidth\endlink()
|
|---|
| 1040 | \i opt.\link QStyleOption::maxIconWidth() maxIconWidth\endlink()
|
|---|
| 1041 | \endlist
|
|---|
| 1042 | \i \e mi is the menu item being drawn. QMenuItem is currently an
|
|---|
| 1043 | internal class.
|
|---|
| 1044 | \row \i \l Style_Active \i Set if the menuitem is the current item.
|
|---|
| 1045 | \i \e tabwidth is the width of the tab column where key accelerators
|
|---|
| 1046 | are drawn.
|
|---|
| 1047 | \row \i \l Style_Down \i Set if the menuitem is down (i.e., the mouse button
|
|---|
| 1048 | or space bar is pressed).
|
|---|
| 1049 | \i \e maxpmwidth is the maximum width of the check column where
|
|---|
| 1050 | checkmarks and iconsets are drawn.
|
|---|
| 1051 |
|
|---|
| 1052 | \row \i14 \l{CE_MenuBarItem}(const \l QMenuBar *)
|
|---|
| 1053 | \i \l Style_Enabled \i Set if the menuitem is enabled
|
|---|
| 1054 | \i14 \l QStyleOption ( QMenuItem *mi )
|
|---|
| 1055 | \list
|
|---|
| 1056 | \i opt.\link QStyleOption::menuItem() menuItem\endlink()
|
|---|
| 1057 | \endlist
|
|---|
| 1058 | \i14 \e mi is the menu item being drawn.
|
|---|
| 1059 | \row \i \l Style_Active \i Set if the menuitem is the current item.
|
|---|
| 1060 | \row \i \l Style_Down \i Set if the menuitem is down (i.e., a mouse button or
|
|---|
| 1061 | the space bar is pressed).
|
|---|
| 1062 | \row \i \l Style_HasFocus \i Set if the menubar has input focus.
|
|---|
| 1063 |
|
|---|
| 1064 | \row \i17 \l{CE_ToolButtonLabel}(const \l QToolButton *)
|
|---|
| 1065 | \i \l Style_Enabled \i Set if the toolbutton is enabled.
|
|---|
| 1066 | \i17 \l QStyleOption ( \l ArrowType t )
|
|---|
| 1067 | \list
|
|---|
| 1068 | \i opt.\link QStyleOption::arrowType() arrowType\endlink()
|
|---|
| 1069 | \endlist
|
|---|
| 1070 | \i17 When the tool button only contains an arrow, \e t is the
|
|---|
| 1071 | arrow's type.
|
|---|
| 1072 | \row \i \l Style_HasFocus \i Set if the toolbutton has input focus.
|
|---|
| 1073 | \row \i \l Style_Down \i Set if the toolbutton is down (i.e., a
|
|---|
| 1074 | mouse button or the space is pressed).
|
|---|
| 1075 | \row \i \l Style_On \i Set if the toolbutton is a toggle button
|
|---|
| 1076 | and is toggled on.
|
|---|
| 1077 | \row \i \l Style_AutoRaise \i Set if the toolbutton has auto-raise enabled.
|
|---|
| 1078 | \row \i \l Style_MouseOver \i Set if the mouse pointer is over the toolbutton.
|
|---|
| 1079 | \row \i \l Style_Raised \i Set if the button is not down, not on and doesn't
|
|---|
| 1080 | contain the mouse when auto-raise is enabled.
|
|---|
| 1081 | \endtable
|
|---|
| 1082 |
|
|---|
| 1083 | \sa ControlElement, StyleFlags
|
|---|
| 1084 | */
|
|---|
| 1085 |
|
|---|
| 1086 | /*!
|
|---|
| 1087 | \fn void QStyle::drawControlMask( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QStyleOption& opt) const
|
|---|
| 1088 |
|
|---|
| 1089 | Draw a bitmask for the ControlElement \a element using the painter
|
|---|
| 1090 | \a p in the area \a r. See drawControl() for an explanation of the
|
|---|
| 1091 | use of the \a widget and \a opt arguments.
|
|---|
| 1092 |
|
|---|
| 1093 | The rect \a r should be in screen coordinates.
|
|---|
| 1094 |
|
|---|
| 1095 | \sa drawControl(), ControlElement
|
|---|
| 1096 | */
|
|---|
| 1097 |
|
|---|
| 1098 | /*!
|
|---|
| 1099 | \enum QStyle::SubRect
|
|---|
| 1100 |
|
|---|
| 1101 | This enum represents a sub-area of a widget. Style implementations
|
|---|
| 1102 | would use these areas to draw the different parts of a widget.
|
|---|
| 1103 |
|
|---|
| 1104 | \value SR_PushButtonContents area containing the label (iconset
|
|---|
| 1105 | with text or pixmap).
|
|---|
| 1106 | \value SR_PushButtonFocusRect area for the focus rect (usually
|
|---|
| 1107 | larger than the contents rect).
|
|---|
| 1108 |
|
|---|
| 1109 | \value SR_CheckBoxIndicator area for the state indicator (e.g. check mark).
|
|---|
| 1110 | \value SR_CheckBoxContents area for the label (text or pixmap).
|
|---|
| 1111 | \value SR_CheckBoxFocusRect area for the focus indicator.
|
|---|
| 1112 |
|
|---|
| 1113 |
|
|---|
| 1114 | \value SR_RadioButtonIndicator area for the state indicator.
|
|---|
| 1115 | \value SR_RadioButtonContents area for the label.
|
|---|
| 1116 | \value SR_RadioButtonFocusRect area for the focus indicator.
|
|---|
| 1117 |
|
|---|
| 1118 |
|
|---|
| 1119 | \value SR_ComboBoxFocusRect area for the focus indicator.
|
|---|
| 1120 |
|
|---|
| 1121 |
|
|---|
| 1122 | \value SR_SliderFocusRect area for the focus indicator.
|
|---|
| 1123 |
|
|---|
| 1124 |
|
|---|
| 1125 | \value SR_DockWindowHandleRect area for the tear-off handle.
|
|---|
| 1126 |
|
|---|
| 1127 |
|
|---|
| 1128 | \value SR_ProgressBarGroove area for the groove.
|
|---|
| 1129 | \value SR_ProgressBarContents area for the progress indicator.
|
|---|
| 1130 | \value SR_ProgressBarLabel area for the text label.
|
|---|
| 1131 |
|
|---|
| 1132 |
|
|---|
| 1133 | \value SR_ToolButtonContents area for the tool button's label.
|
|---|
| 1134 |
|
|---|
| 1135 | \value SR_DialogButtonAccept area for a dialog's accept button.
|
|---|
| 1136 | \value SR_DialogButtonReject area for a dialog's reject button.
|
|---|
| 1137 | \value SR_DialogButtonApply area for a dialog's apply button.
|
|---|
| 1138 | \value SR_DialogButtonHelp area for a dialog's help button.
|
|---|
| 1139 | \value SR_DialogButtonAll area for a dialog's all button.
|
|---|
| 1140 | \value SR_DialogButtonRetry area for a dialog's retry button.
|
|---|
| 1141 | \value SR_DialogButtonAbort area for a dialog's abort button.
|
|---|
| 1142 | \value SR_DialogButtonIgnore area for a dialog's ignore button.
|
|---|
| 1143 | \value SR_DialogButtonCustom area for a dialog's custom widget area (in button row).
|
|---|
| 1144 |
|
|---|
| 1145 | \value SR_ToolBoxTabContents area for a toolbox tab's icon and label
|
|---|
| 1146 |
|
|---|
| 1147 | \value SR_CustomBase base value for custom ControlElements. All values above
|
|---|
| 1148 | this are reserved for custom use. Therefore, custom values must be
|
|---|
| 1149 | greater than this value.
|
|---|
| 1150 |
|
|---|
| 1151 | \sa subRect()
|
|---|
| 1152 | */
|
|---|
| 1153 |
|
|---|
| 1154 | /*!
|
|---|
| 1155 | \fn QRect QStyle::subRect( SubRect subrect, const QWidget *widget ) const;
|
|---|
| 1156 |
|
|---|
| 1157 | Returns the sub-area \a subrect for the \a widget in logical
|
|---|
| 1158 | coordinates.
|
|---|
| 1159 |
|
|---|
| 1160 | The \a widget argument is a pointer to a QWidget or one of its
|
|---|
| 1161 | subclasses. The widget can be cast to the appropriate type based
|
|---|
| 1162 | on the value of \a subrect. See the table below for the
|
|---|
| 1163 | appropriate \a widget casts:
|
|---|
| 1164 |
|
|---|
| 1165 | \table
|
|---|
| 1166 | \header \i SubRect \i Widget Cast
|
|---|
| 1167 | \row \i \l SR_PushButtonContents \i (const \l QPushButton *)
|
|---|
| 1168 | \row \i \l SR_PushButtonFocusRect \i (const \l QPushButton *)
|
|---|
| 1169 | \row \i \l SR_CheckBoxIndicator \i (const \l QCheckBox *)
|
|---|
| 1170 | \row \i \l SR_CheckBoxContents \i (const \l QCheckBox *)
|
|---|
| 1171 | \row \i \l SR_CheckBoxFocusRect \i (const \l QCheckBox *)
|
|---|
| 1172 | \row \i \l SR_RadioButtonIndicator \i (const \l QRadioButton *)
|
|---|
| 1173 | \row \i \l SR_RadioButtonContents \i (const \l QRadioButton *)
|
|---|
| 1174 | \row \i \l SR_RadioButtonFocusRect \i (const \l QRadioButton *)
|
|---|
| 1175 | \row \i \l SR_ComboBoxFocusRect \i (const \l QComboBox *)
|
|---|
| 1176 | \row \i \l SR_DockWindowHandleRect \i (const \l QWidget *)
|
|---|
| 1177 | \row \i \l SR_ProgressBarGroove \i (const \l QProgressBar *)
|
|---|
| 1178 | \row \i \l SR_ProgressBarContents \i (const \l QProgressBar *)
|
|---|
| 1179 | \row \i \l SR_ProgressBarLabel \i (const \l QProgressBar *)
|
|---|
| 1180 | \endtable
|
|---|
| 1181 |
|
|---|
| 1182 | The tear-off handle (SR_DockWindowHandleRect) for QDockWindow
|
|---|
| 1183 | is a private class. Use QWidget::parentWidget() to access the
|
|---|
| 1184 | QDockWindow:
|
|---|
| 1185 |
|
|---|
| 1186 | \code
|
|---|
| 1187 | if ( !widget->parentWidget() )
|
|---|
| 1188 | return;
|
|---|
| 1189 | const QDockWindow *dw = (const QDockWindow *) widget->parentWidget();
|
|---|
| 1190 | \endcode
|
|---|
| 1191 |
|
|---|
| 1192 | \sa SubRect
|
|---|
| 1193 | */
|
|---|
| 1194 |
|
|---|
| 1195 | /*!
|
|---|
| 1196 | \enum QStyle::ComplexControl
|
|---|
| 1197 |
|
|---|
| 1198 | This enum represents a ComplexControl. ComplexControls have
|
|---|
| 1199 | different behaviour depending upon where the user clicks on them
|
|---|
| 1200 | or which keys are pressed.
|
|---|
| 1201 |
|
|---|
| 1202 | \value CC_SpinWidget
|
|---|
| 1203 | \value CC_ComboBox
|
|---|
| 1204 | \value CC_ScrollBar
|
|---|
| 1205 | \value CC_Slider
|
|---|
| 1206 | \value CC_ToolButton
|
|---|
| 1207 | \value CC_TitleBar
|
|---|
| 1208 | \value CC_ListView
|
|---|
| 1209 |
|
|---|
| 1210 |
|
|---|
| 1211 | \value CC_CustomBase base value for custom ControlElements. All
|
|---|
| 1212 | values above this are reserved for custom use. Therefore,
|
|---|
| 1213 | custom values must be greater than this value.
|
|---|
| 1214 |
|
|---|
| 1215 | \sa SubControl drawComplexControl()
|
|---|
| 1216 | */
|
|---|
| 1217 |
|
|---|
| 1218 | /*!
|
|---|
| 1219 | \enum QStyle::SubControl
|
|---|
| 1220 |
|
|---|
| 1221 | This enum represents a SubControl within a ComplexControl.
|
|---|
| 1222 |
|
|---|
| 1223 | \value SC_None special value that matches no other SubControl.
|
|---|
| 1224 |
|
|---|
| 1225 |
|
|---|
| 1226 | \value SC_ScrollBarAddLine scrollbar add line (i.e. down/right
|
|---|
| 1227 | arrow); see also QScrollbar.
|
|---|
| 1228 | \value SC_ScrollBarSubLine scrollbar sub line (i.e. up/left arrow).
|
|---|
| 1229 | \value SC_ScrollBarAddPage scrollbar add page (i.e. page down).
|
|---|
| 1230 | \value SC_ScrollBarSubPage scrollbar sub page (i.e. page up).
|
|---|
| 1231 | \value SC_ScrollBarFirst scrollbar first line (i.e. home).
|
|---|
| 1232 | \value SC_ScrollBarLast scrollbar last line (i.e. end).
|
|---|
| 1233 | \value SC_ScrollBarSlider scrollbar slider handle.
|
|---|
| 1234 | \value SC_ScrollBarGroove special subcontrol which contains the
|
|---|
| 1235 | area in which the slider handle may move.
|
|---|
| 1236 |
|
|---|
| 1237 |
|
|---|
| 1238 | \value SC_SpinWidgetUp spinwidget up/increase; see also QSpinBox.
|
|---|
| 1239 | \value SC_SpinWidgetDown spinwidget down/decrease.
|
|---|
| 1240 | \value SC_SpinWidgetFrame spinwidget frame.
|
|---|
| 1241 | \value SC_SpinWidgetEditField spinwidget edit field.
|
|---|
| 1242 | \value SC_SpinWidgetButtonField spinwidget button field.
|
|---|
| 1243 |
|
|---|
| 1244 |
|
|---|
| 1245 | \value SC_ComboBoxEditField combobox edit field; see also QComboBox.
|
|---|
| 1246 | \value SC_ComboBoxArrow combobox arrow
|
|---|
| 1247 | \value SC_ComboBoxFrame combobox frame
|
|---|
| 1248 | \value SC_ComboBoxListBoxPopup combobox list box
|
|---|
| 1249 |
|
|---|
| 1250 | \value SC_SliderGroove special subcontrol which contains the area
|
|---|
| 1251 | in which the slider handle may move.
|
|---|
| 1252 | \value SC_SliderHandle slider handle.
|
|---|
| 1253 | \value SC_SliderTickmarks slider tickmarks.
|
|---|
| 1254 |
|
|---|
| 1255 |
|
|---|
| 1256 | \value SC_ToolButton tool button; see also QToolbutton.
|
|---|
| 1257 | \value SC_ToolButtonMenu subcontrol for opening a popup menu in a
|
|---|
| 1258 | tool button; see also QPopupMenu.
|
|---|
| 1259 |
|
|---|
| 1260 |
|
|---|
| 1261 | \value SC_TitleBarSysMenu system menu button (i.e. restore, close, etc.).
|
|---|
| 1262 | \value SC_TitleBarMinButton minimize button.
|
|---|
| 1263 | \value SC_TitleBarMaxButton maximize button.
|
|---|
| 1264 | \value SC_TitleBarCloseButton close button.
|
|---|
| 1265 | \value SC_TitleBarLabel window title label.
|
|---|
| 1266 | \value SC_TitleBarNormalButton normal (restore) button.
|
|---|
| 1267 | \value SC_TitleBarShadeButton shade button.
|
|---|
| 1268 | \value SC_TitleBarUnshadeButton unshade button.
|
|---|
| 1269 |
|
|---|
| 1270 |
|
|---|
| 1271 | \value SC_ListView the list view area.
|
|---|
| 1272 | \value SC_ListViewBranch (internal)
|
|---|
| 1273 | \value SC_ListViewExpand expand item (i.e. show/hide child items).
|
|---|
| 1274 |
|
|---|
| 1275 |
|
|---|
| 1276 | \value SC_All special value that matches all SubControls.
|
|---|
| 1277 |
|
|---|
| 1278 |
|
|---|
| 1279 | \sa ComplexControl
|
|---|
| 1280 | */
|
|---|
| 1281 |
|
|---|
| 1282 | /*!
|
|---|
| 1283 | \fn void QStyle::drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, const QStyleOption& opt ) const
|
|---|
| 1284 |
|
|---|
| 1285 | Draws the ComplexControl \a control using the painter \a p in the
|
|---|
| 1286 | area \a r. Colors are used from the color group \a cg. The \a sub
|
|---|
| 1287 | argument specifies which SubControls to draw. Multiple SubControls
|
|---|
| 1288 | can be OR'ed together. The \a subActive argument specifies which
|
|---|
| 1289 | SubControl is active.
|
|---|
| 1290 |
|
|---|
| 1291 | The rect \a r should be in logical coordinates. Reimplementations
|
|---|
| 1292 | of this function should use visualRect() to change the logical
|
|---|
| 1293 | coordinates into screen coordinates when using drawPrimitive() and
|
|---|
| 1294 | drawControl().
|
|---|
| 1295 |
|
|---|
| 1296 | The \a how argument is used to control how the ComplexControl is
|
|---|
| 1297 | drawn. Multiple flags can OR'ed together. See the table below for
|
|---|
| 1298 | an explanation of which flags are used with the various
|
|---|
| 1299 | ComplexControls.
|
|---|
| 1300 |
|
|---|
| 1301 | The \a widget argument is a pointer to a QWidget or one of its
|
|---|
| 1302 | subclasses. The widget can be cast to the appropriate type based
|
|---|
| 1303 | on the value of \a control. The \a opt argument can be used to
|
|---|
| 1304 | pass extra information required when drawing the ComplexControl.
|
|---|
| 1305 | Note that \a opt may be the default value even for ComplexControls
|
|---|
| 1306 | that can make use of the extra options. See the table below for
|
|---|
| 1307 | the appropriate \a widget and \a opt usage:
|
|---|
| 1308 |
|
|---|
| 1309 | \table
|
|---|
| 1310 | \header \i ComplexControl<br>\& Widget Cast
|
|---|
| 1311 | \i Style Flags
|
|---|
| 1312 | \i Notes
|
|---|
| 1313 | \i Options
|
|---|
| 1314 | \i Notes
|
|---|
| 1315 |
|
|---|
| 1316 | \row \i12 \l{CC_SpinWidget}(const QSpinWidget *)
|
|---|
| 1317 | \i \l Style_Enabled \i Set if the spinwidget is enabled.
|
|---|
| 1318 | \i12 Unused.
|
|---|
| 1319 | \i12
|
|---|
| 1320 | \row \i \l Style_HasFocus \i Set if the spinwidget has input focus.
|
|---|
| 1321 |
|
|---|
| 1322 | \row \i12 \l{CC_ComboBox}(const \l QComboBox *)
|
|---|
| 1323 | \i \l Style_Enabled \i Set if the combobox is enabled.
|
|---|
| 1324 | \i12 Unused.
|
|---|
| 1325 | \i12
|
|---|
| 1326 | \row \i \l Style_HasFocus \i Set if the combobox has input focus.
|
|---|
| 1327 |
|
|---|
| 1328 | \row \i12 \l{CC_ScrollBar}(const \l QScrollBar *)
|
|---|
| 1329 | \i \l Style_Enabled \i Set if the scrollbar is enabled.
|
|---|
| 1330 | \i12 Unused.
|
|---|
| 1331 | \i12
|
|---|
| 1332 | \row \i \l Style_HasFocus \i Set if the scrollbar has input focus.
|
|---|
| 1333 |
|
|---|
| 1334 | \row \i12 \l{CC_Slider}(const \l QSlider *)
|
|---|
| 1335 | \i \l Style_Enabled \i Set if the slider is enabled.
|
|---|
| 1336 | \i12 Unused.
|
|---|
| 1337 | \i12
|
|---|
| 1338 |
|
|---|
| 1339 | \row \i \l Style_HasFocus \i Set if the slider has input focus.
|
|---|
| 1340 |
|
|---|
| 1341 | \row \i16 \l{CC_ToolButton}(const \l QToolButton *)
|
|---|
| 1342 | \i \l Style_Enabled \i Set if the toolbutton is enabled.
|
|---|
| 1343 | \i16 \l QStyleOption ( \l ArrowType t )
|
|---|
| 1344 | \list
|
|---|
| 1345 | \i opt.\link QStyleOption::arrowType() arrowType\endlink()
|
|---|
| 1346 | \endlist
|
|---|
| 1347 | \i16 When the tool button only contains an arrow, \e t is the
|
|---|
| 1348 | arrow's type.
|
|---|
| 1349 | \row \i \l Style_HasFocus \i Set if the toolbutton has input focus.
|
|---|
| 1350 | \row \i \l Style_Down \i Set if the toolbutton is down (ie. mouse
|
|---|
| 1351 | button or space pressed).
|
|---|
| 1352 | \row \i \l Style_On \i Set if the toolbutton is a toggle button
|
|---|
| 1353 | and is toggled on.
|
|---|
| 1354 | \row \i \l Style_AutoRaise \i Set if the toolbutton has auto-raise enabled.
|
|---|
| 1355 | \row \i \l Style_Raised \i Set if the button is not down, not on and doesn't
|
|---|
| 1356 | contain the mouse when auto-raise is enabled.
|
|---|
| 1357 |
|
|---|
| 1358 | \row \i \l{CC_TitleBar}(const \l QWidget *)
|
|---|
| 1359 | \i \l Style_Enabled \i Set if the titlebar is enabled.
|
|---|
| 1360 | \i Unused.
|
|---|
| 1361 | \i
|
|---|
| 1362 |
|
|---|
| 1363 | \row \i \l{CC_ListView}(const \l QListView *)
|
|---|
| 1364 | \i \l Style_Enabled \i Set if the titlebar is enabled.
|
|---|
| 1365 | \i \l QStyleOption ( \l QListViewItem *item )
|
|---|
| 1366 | \list
|
|---|
| 1367 | \i opt.\link QStyleOption::listViewItem() listViewItem\endlink()
|
|---|
| 1368 | \endlist
|
|---|
| 1369 | \i \e item is the item that needs branches drawn
|
|---|
| 1370 | \endtable
|
|---|
| 1371 |
|
|---|
| 1372 | \sa ComplexControl, SubControl
|
|---|
| 1373 | */
|
|---|
| 1374 |
|
|---|
| 1375 | /*!
|
|---|
| 1376 | \fn void QStyle::drawComplexControlMask( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QStyleOption& opt) const
|
|---|
| 1377 |
|
|---|
| 1378 | Draw a bitmask for the ComplexControl \a control using the painter
|
|---|
| 1379 | \a p in the area \a r. See drawComplexControl() for an explanation
|
|---|
| 1380 | of the use of the \a widget and \a opt arguments.
|
|---|
| 1381 |
|
|---|
| 1382 | The rect \a r should be in logical coordinates. Reimplementations
|
|---|
| 1383 | of this function should use visualRect() to change the logical
|
|---|
| 1384 | corrdinates into screen coordinates when using drawPrimitive() and
|
|---|
| 1385 | drawControl().
|
|---|
| 1386 |
|
|---|
| 1387 | \sa drawComplexControl() ComplexControl
|
|---|
| 1388 | */
|
|---|
| 1389 |
|
|---|
| 1390 | /*!
|
|---|
| 1391 | \fn QRect QStyle::querySubControlMetrics( ComplexControl control, const QWidget *widget, SubControl subcontrol, const QStyleOption& opt = QStyleOption::Default ) const;
|
|---|
| 1392 |
|
|---|
| 1393 | Returns the rect for the SubControl \a subcontrol for \a widget in
|
|---|
| 1394 | logical coordinates.
|
|---|
| 1395 |
|
|---|
| 1396 | The \a widget argument is a pointer to a QWidget or one of its
|
|---|
| 1397 | subclasses. The widget can be cast to the appropriate type based
|
|---|
| 1398 | on the value of \a control. The \a opt argument can be used to
|
|---|
| 1399 | pass extra information required when drawing the ComplexControl.
|
|---|
| 1400 | Note that \a opt may be the default value even for ComplexControls
|
|---|
| 1401 | that can make use of the extra options. See drawComplexControl()
|
|---|
| 1402 | for an explanation of the \a widget and \a opt arguments.
|
|---|
| 1403 |
|
|---|
| 1404 | \sa drawComplexControl(), ComplexControl, SubControl
|
|---|
| 1405 | */
|
|---|
| 1406 |
|
|---|
| 1407 | /*!
|
|---|
| 1408 | \fn SubControl QStyle::querySubControl( ComplexControl control, const QWidget *widget, const QPoint &pos, const QStyleOption& opt = QStyleOption::Default ) const;
|
|---|
| 1409 |
|
|---|
| 1410 | Returns the SubControl for \a widget at the point \a pos. The \a
|
|---|
| 1411 | widget argument is a pointer to a QWidget or one of its
|
|---|
| 1412 | subclasses. The widget can be cast to the appropriate type based
|
|---|
| 1413 | on the value of \a control. The \a opt argument can be used to
|
|---|
| 1414 | pass extra information required when drawing the ComplexControl.
|
|---|
| 1415 | Note that \a opt may be the default value even for ComplexControls
|
|---|
| 1416 | that can make use of the extra options. See drawComplexControl()
|
|---|
| 1417 | for an explanation of the \a widget and \a opt arguments.
|
|---|
| 1418 |
|
|---|
| 1419 | Note that \a pos is passed in screen coordinates. When using
|
|---|
| 1420 | querySubControlMetrics() to check for hits and misses, use
|
|---|
| 1421 | visualRect() to change the logical coordinates into screen
|
|---|
| 1422 | coordinates.
|
|---|
| 1423 |
|
|---|
| 1424 | \sa drawComplexControl(), ComplexControl, SubControl, querySubControlMetrics()
|
|---|
| 1425 | */
|
|---|
| 1426 |
|
|---|
| 1427 | /*!
|
|---|
| 1428 | \enum QStyle::PixelMetric
|
|---|
| 1429 |
|
|---|
| 1430 | This enum represents a PixelMetric. A PixelMetric is a style
|
|---|
| 1431 | dependent size represented as a single pixel value.
|
|---|
| 1432 |
|
|---|
| 1433 | \value PM_ButtonMargin amount of whitespace between pushbutton
|
|---|
| 1434 | labels and the frame.
|
|---|
| 1435 | \value PM_ButtonDefaultIndicator width of the default-button indicator frame.
|
|---|
| 1436 | \value PM_MenuButtonIndicator width of the menu button indicator
|
|---|
| 1437 | proportional to the widget height.
|
|---|
| 1438 | \value PM_ButtonShiftHorizontal horizontal contents shift of a
|
|---|
| 1439 | button when the button is down.
|
|---|
| 1440 | \value PM_ButtonShiftVertical vertical contents shift of a button when the
|
|---|
| 1441 | button is down.
|
|---|
| 1442 |
|
|---|
| 1443 | \value PM_DefaultFrameWidth default frame width, usually 2.
|
|---|
| 1444 | \value PM_SpinBoxFrameWidth frame width of a spin box.
|
|---|
| 1445 | \value PM_MDIFrameWidth frame width of an MDI window.
|
|---|
| 1446 | \value PM_MDIMinimizedWidth width of a minimized MSI window.
|
|---|
| 1447 |
|
|---|
| 1448 | \value PM_MaximumDragDistance Some feels require the scrollbar or
|
|---|
| 1449 | other sliders to jump back to the original position when the
|
|---|
| 1450 | mouse pointer is too far away while dragging. A value of -1
|
|---|
| 1451 | disables this behavior.
|
|---|
| 1452 |
|
|---|
| 1453 | \value PM_ScrollBarExtent width of a vertical scrollbar and the
|
|---|
| 1454 | height of a horizontal scrollbar.
|
|---|
| 1455 | \value PM_ScrollBarSliderMin the minimum height of a vertical
|
|---|
| 1456 | scrollbar's slider and the minimum width of a horiztonal
|
|---|
| 1457 | scrollbar slider.
|
|---|
| 1458 |
|
|---|
| 1459 | \value PM_SliderThickness total slider thickness.
|
|---|
| 1460 | \value PM_SliderControlThickness thickness of the slider handle.
|
|---|
| 1461 | \value PM_SliderLength length of the slider.
|
|---|
| 1462 | \value PM_SliderTickmarkOffset the offset between the tickmarks
|
|---|
| 1463 | and the slider.
|
|---|
| 1464 | \value PM_SliderSpaceAvailable the available space for the slider to move.
|
|---|
| 1465 |
|
|---|
| 1466 | \value PM_DockWindowSeparatorExtent width of a separator in a
|
|---|
| 1467 | horiztonal dock window and the height of a separator in a
|
|---|
| 1468 | vertical dock window.
|
|---|
| 1469 | \value PM_DockWindowHandleExtent width of the handle in a
|
|---|
| 1470 | horizontal dock window and the height of the handle in a
|
|---|
| 1471 | vertical dock window.
|
|---|
| 1472 | \value PM_DockWindowFrameWidth frame width of a dock window.
|
|---|
| 1473 |
|
|---|
| 1474 | \value PM_MenuBarFrameWidth frame width of a menubar.
|
|---|
| 1475 |
|
|---|
| 1476 | \value PM_MenuBarItemSpacing spacing between menubar items.
|
|---|
| 1477 | \value PM_ToolBarItemSpacing spacing between toolbar items.
|
|---|
| 1478 |
|
|---|
| 1479 | \value PM_TabBarTabOverlap number of pixels the tabs should overlap.
|
|---|
| 1480 | \value PM_TabBarTabHSpace extra space added to the tab width.
|
|---|
| 1481 | \value PM_TabBarTabVSpace extra space added to the tab height.
|
|---|
| 1482 | \value PM_TabBarBaseHeight height of the area between the tab bar
|
|---|
| 1483 | and the tab pages.
|
|---|
| 1484 | \value PM_TabBarBaseOverlap number of pixels the tab bar overlaps
|
|---|
| 1485 | the tab bar base.
|
|---|
| 1486 | \value PM_TabBarScrollButtonWidth
|
|---|
| 1487 | \value PM_TabBarTabShiftHorizontal horizontal pixel shift when a
|
|---|
| 1488 | tab is selected.
|
|---|
| 1489 | \value PM_TabBarTabShiftVertical vertical pixel shift when a
|
|---|
| 1490 | tab is selected.
|
|---|
| 1491 |
|
|---|
| 1492 | \value PM_ProgressBarChunkWidth width of a chunk in a progress bar indicator.
|
|---|
| 1493 |
|
|---|
| 1494 | \value PM_SplitterWidth width of a splitter.
|
|---|
| 1495 |
|
|---|
| 1496 | \value PM_TitleBarHeight height of the title bar.
|
|---|
| 1497 | \value PM_PopupMenuFrameHorizontalExtra additional border, e.g. for panels
|
|---|
| 1498 | \value PM_PopupMenuFrameVerticalExtra additional border, e.g. for panels
|
|---|
| 1499 |
|
|---|
| 1500 | \value PM_IndicatorWidth width of a check box indicator.
|
|---|
| 1501 | \value PM_IndicatorHeight height of a checkbox indicator.
|
|---|
| 1502 | \value PM_ExclusiveIndicatorWidth width of a radio button indicator.
|
|---|
| 1503 | \value PM_ExclusiveIndicatorHeight height of a radio button indicator.
|
|---|
| 1504 |
|
|---|
| 1505 | \value PM_PopupMenuScrollerHeight height of the scroller area in a popupmenu.
|
|---|
| 1506 | \value PM_PopupMenuScrollerHeight height of the scroller area in a popupmenu.
|
|---|
| 1507 | \value PM_CheckListButtonSize area (width/height) of the
|
|---|
| 1508 | checkbox/radiobutton in a QCheckListItem
|
|---|
| 1509 | \value PM_CheckListControllerSize area (width/height) of the
|
|---|
| 1510 | controller in a QCheckListItem
|
|---|
| 1511 |
|
|---|
| 1512 | \value PM_DialogButtonsSeparator distance between buttons in a dialog buttons widget.
|
|---|
| 1513 | \value PM_DialogButtonsButtonWidth minimum width of a button in a dialog buttons widget.
|
|---|
| 1514 | \value PM_DialogButtonsButtonHeight minimum height of a button in a dialog buttons widget.
|
|---|
| 1515 |
|
|---|
| 1516 | \value PM_HeaderMarkSize
|
|---|
| 1517 | \value PM_HeaderGripMargin
|
|---|
| 1518 | \value PM_HeaderMargin
|
|---|
| 1519 |
|
|---|
| 1520 | \value PM_CustomBase base value for custom ControlElements. All
|
|---|
| 1521 | values above this are reserved for custom use. Therefore,
|
|---|
| 1522 | custom values must be greater than this value.
|
|---|
| 1523 |
|
|---|
| 1524 |
|
|---|
| 1525 | \sa pixelMetric()
|
|---|
| 1526 | */
|
|---|
| 1527 |
|
|---|
| 1528 | /*!
|
|---|
| 1529 | \fn int QStyle::pixelMetric( PixelMetric metric, const QWidget *widget = 0 ) const;
|
|---|
| 1530 |
|
|---|
| 1531 | Returns the pixel metric for \a metric. The \a widget argument is
|
|---|
| 1532 | a pointer to a QWidget or one of its subclasses. The widget can be
|
|---|
| 1533 | cast to the appropriate type based on the value of \a metric. Note
|
|---|
| 1534 | that \a widget may be zero even for PixelMetrics that can make use
|
|---|
| 1535 | of \a widget. See the table below for the appropriate \a widget
|
|---|
| 1536 | casts:
|
|---|
| 1537 |
|
|---|
| 1538 | \table
|
|---|
| 1539 | \header \i PixelMetric \i Widget Cast
|
|---|
| 1540 | \row \i \l PM_SliderControlThickness \i (const \l QSlider *)
|
|---|
| 1541 | \row \i \l PM_SliderLength \i (const \l QSlider *)
|
|---|
| 1542 | \row \i \l PM_SliderTickmarkOffset \i (const \l QSlider *)
|
|---|
| 1543 | \row \i \l PM_SliderSpaceAvailable \i (const \l QSlider *)
|
|---|
| 1544 | \row \i \l PM_TabBarTabOverlap \i (const \l QTabBar *)
|
|---|
| 1545 | \row \i \l PM_TabBarTabHSpace \i (const \l QTabBar *)
|
|---|
| 1546 | \row \i \l PM_TabBarTabVSpace \i (const \l QTabBar *)
|
|---|
| 1547 | \row \i \l PM_TabBarBaseHeight \i (const \l QTabBar *)
|
|---|
| 1548 | \row \i \l PM_TabBarBaseOverlap \i (const \l QTabBar *)
|
|---|
| 1549 | \endtable
|
|---|
| 1550 | */
|
|---|
| 1551 |
|
|---|
| 1552 | /*!
|
|---|
| 1553 | \enum QStyle::ContentsType
|
|---|
| 1554 |
|
|---|
| 1555 | This enum represents a ContentsType. It is used to calculate sizes
|
|---|
| 1556 | for the contents of various widgets.
|
|---|
| 1557 |
|
|---|
| 1558 | \value CT_PushButton
|
|---|
| 1559 | \value CT_CheckBox
|
|---|
| 1560 | \value CT_RadioButton
|
|---|
| 1561 | \value CT_ToolButton
|
|---|
| 1562 | \value CT_ComboBox
|
|---|
| 1563 | \value CT_Splitter
|
|---|
| 1564 | \value CT_DockWindow
|
|---|
| 1565 | \value CT_ProgressBar
|
|---|
| 1566 | \value CT_PopupMenuItem
|
|---|
| 1567 | \value CT_TabBarTab
|
|---|
| 1568 | \value CT_Slider
|
|---|
| 1569 | \value CT_Header
|
|---|
| 1570 | \value CT_LineEdit
|
|---|
| 1571 | \value CT_MenuBar
|
|---|
| 1572 | \value CT_SpinBox
|
|---|
| 1573 | \value CT_SizeGrip
|
|---|
| 1574 | \value CT_TabWidget
|
|---|
| 1575 | \value CT_DialogButtons
|
|---|
| 1576 |
|
|---|
| 1577 | \value CT_CustomBase base value for custom ControlElements. All
|
|---|
| 1578 | values above this are reserved for custom use. Custom values
|
|---|
| 1579 | must be greater than this value.
|
|---|
| 1580 |
|
|---|
| 1581 | \sa sizeFromContents()
|
|---|
| 1582 | */
|
|---|
| 1583 |
|
|---|
| 1584 | /*!
|
|---|
| 1585 | \fn QSize QStyle::sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize, const QStyleOption& opt = QStyleOption::Default ) const;
|
|---|
| 1586 |
|
|---|
| 1587 | Returns the size of \a widget based on the contents size \a
|
|---|
| 1588 | contentsSize.
|
|---|
| 1589 |
|
|---|
| 1590 | The \a widget argument is a pointer to a QWidget or one of its
|
|---|
| 1591 | subclasses. The widget can be cast to the appropriate type based
|
|---|
| 1592 | on the value of \a contents. The \a opt argument can be used to
|
|---|
| 1593 | pass extra information required when calculating the size. Note
|
|---|
| 1594 | that \a opt may be the default value even for ContentsTypes that
|
|---|
| 1595 | can make use of the extra options. See the table below for the
|
|---|
| 1596 | appropriate \a widget and \a opt usage:
|
|---|
| 1597 |
|
|---|
| 1598 | \table
|
|---|
| 1599 | \header \i ContentsType \i Widget Cast \i Options \i Notes
|
|---|
| 1600 | \row \i \l CT_PushButton \i (const \l QPushButton *) \i Unused. \i
|
|---|
| 1601 | \row \i \l CT_CheckBox \i (const \l QCheckBox *) \i Unused. \i
|
|---|
| 1602 | \row \i \l CT_RadioButton \i (const \l QRadioButton *) \i Unused. \i
|
|---|
| 1603 | \row \i \l CT_ToolButton \i (const \l QToolButton *) \i Unused. \i
|
|---|
| 1604 | \row \i \l CT_ComboBox \i (const \l QComboBox *) \i Unused. \i
|
|---|
| 1605 | \row \i \l CT_Splitter \i (const \l QSplitter *) \i Unused. \i
|
|---|
| 1606 | \row \i \l CT_DockWindow \i (const \l QDockWindow *) \i Unused. \i
|
|---|
| 1607 | \row \i \l CT_ProgressBar \i (const \l QProgressBar *) \i Unused. \i
|
|---|
| 1608 | \row \i \l CT_PopupMenuItem \i (const QPopupMenu *)
|
|---|
| 1609 | \i \l QStyleOption ( QMenuItem *mi )
|
|---|
| 1610 | \list
|
|---|
| 1611 | \i opt.\link QStyleOption::menuItem() menuItem\endlink()
|
|---|
| 1612 | \endlist
|
|---|
| 1613 | \i \e mi is the menu item to use when calculating the size.
|
|---|
| 1614 | QMenuItem is currently an internal class.
|
|---|
| 1615 | \endtable
|
|---|
| 1616 | */
|
|---|
| 1617 |
|
|---|
| 1618 | /*!
|
|---|
| 1619 | \enum QStyle::StyleHint
|
|---|
| 1620 |
|
|---|
| 1621 | This enum represents a StyleHint. A StyleHint is a general look
|
|---|
| 1622 | and/or feel hint.
|
|---|
| 1623 |
|
|---|
| 1624 | \value SH_EtchDisabledText disabled text is "etched" like Windows.
|
|---|
| 1625 |
|
|---|
| 1626 | \value SH_GUIStyle the GUI style to use.
|
|---|
| 1627 |
|
|---|
| 1628 | \value SH_ScrollBar_BackgroundMode the background mode for a
|
|---|
| 1629 | QScrollBar. Possible values are any of those in the \link
|
|---|
| 1630 | Qt::BackgroundMode BackgroundMode\endlink enum.
|
|---|
| 1631 |
|
|---|
| 1632 | \value SH_ScrollBar_MiddleClickAbsolutePosition a boolean value.
|
|---|
| 1633 | If TRUE, middle clicking on a scrollbar causes the slider to
|
|---|
| 1634 | jump to that position. If FALSE, the middle clicking is
|
|---|
| 1635 | ignored.
|
|---|
| 1636 |
|
|---|
| 1637 | \value SH_ScrollBar_LeftClickAbsolutePosition a boolean value.
|
|---|
| 1638 | If TRUE, left clicking on a scrollbar causes the slider to
|
|---|
| 1639 | jump to that position. If FALSE, the left clicking will
|
|---|
| 1640 | behave as appropriate for each control.
|
|---|
| 1641 |
|
|---|
| 1642 | \value SH_ScrollBar_ScrollWhenPointerLeavesControl a boolean
|
|---|
| 1643 | value. If TRUE, when clicking a scrollbar SubControl, holding
|
|---|
| 1644 | the mouse button down and moving the pointer outside the
|
|---|
| 1645 | SubControl, the scrollbar continues to scroll. If FALSE, the
|
|---|
| 1646 | scollbar stops scrolling when the pointer leaves the
|
|---|
| 1647 | SubControl.
|
|---|
| 1648 |
|
|---|
| 1649 | \value SH_TabBar_Alignment the alignment for tabs in a
|
|---|
| 1650 | QTabWidget. Possible values are \c Qt::AlignLeft, \c
|
|---|
| 1651 | Qt::AlignCenter and \c Qt::AlignRight.
|
|---|
| 1652 |
|
|---|
| 1653 | \value SH_Header_ArrowAlignment the placement of the sorting
|
|---|
| 1654 | indicator may appear in list or table headers. Possible values
|
|---|
| 1655 | are \c Qt::Left or \c Qt::Right.
|
|---|
| 1656 |
|
|---|
| 1657 | \value SH_Slider_SnapToValue sliders snap to values while moving,
|
|---|
| 1658 | like Windows
|
|---|
| 1659 |
|
|---|
| 1660 | \value SH_Slider_SloppyKeyEvents key presses handled in a sloppy
|
|---|
| 1661 | manner, i.e. left on a vertical slider subtracts a line.
|
|---|
| 1662 |
|
|---|
| 1663 | \value SH_ProgressDialog_CenterCancelButton center button on
|
|---|
| 1664 | progress dialogs, like Motif, otherwise right aligned.
|
|---|
| 1665 |
|
|---|
| 1666 | \value SH_ProgressDialog_TextLabelAlignment Qt::AlignmentFlags --
|
|---|
| 1667 | text label alignment in progress dialogs; Center on windows,
|
|---|
| 1668 | Auto|VCenter otherwise.
|
|---|
| 1669 |
|
|---|
| 1670 | \value SH_PrintDialog_RightAlignButtons right align buttons in
|
|---|
| 1671 | the print dialog, like Windows.
|
|---|
| 1672 |
|
|---|
| 1673 | \value SH_MainWindow_SpaceBelowMenuBar 1 or 2 pixel space between
|
|---|
| 1674 | the menubar and the dockarea, like Windows.
|
|---|
| 1675 |
|
|---|
| 1676 | \value SH_FontDialog_SelectAssociatedText select the text in the
|
|---|
| 1677 | line edit, or when selecting an item from the listbox, or when
|
|---|
| 1678 | the line edit receives focus, like Windows.
|
|---|
| 1679 |
|
|---|
| 1680 | \value SH_PopupMenu_AllowActiveAndDisabled allows disabled menu
|
|---|
| 1681 | items to be active.
|
|---|
| 1682 |
|
|---|
| 1683 | \value SH_PopupMenu_SpaceActivatesItem pressing Space activates
|
|---|
| 1684 | the item, like Motif.
|
|---|
| 1685 |
|
|---|
| 1686 | \value SH_PopupMenu_SubMenuPopupDelay the number of milliseconds
|
|---|
| 1687 | to wait before opening a submenu; 256 on windows, 96 on Motif.
|
|---|
| 1688 |
|
|---|
| 1689 | \value SH_PopupMenu_Scrollable whether popupmenu's must support
|
|---|
| 1690 | scrolling.
|
|---|
| 1691 |
|
|---|
| 1692 | \value SH_PopupMenu_SloppySubMenus whether popupmenu's must support
|
|---|
| 1693 | sloppy submenu; as implemented on Mac OS.
|
|---|
| 1694 |
|
|---|
| 1695 | \value SH_ScrollView_FrameOnlyAroundContents whether scrollviews
|
|---|
| 1696 | draw their frame only around contents (like Motif), or around
|
|---|
| 1697 | contents, scrollbars and corner widgets (like Windows).
|
|---|
| 1698 |
|
|---|
| 1699 | \value SH_MenuBar_AltKeyNavigation menubars items are navigable
|
|---|
| 1700 | by pressing Alt, followed by using the arrow keys to select
|
|---|
| 1701 | the desired item.
|
|---|
| 1702 |
|
|---|
| 1703 | \value SH_ComboBox_ListMouseTracking mouse tracking in combobox
|
|---|
| 1704 | dropdown lists.
|
|---|
| 1705 |
|
|---|
| 1706 | \value SH_PopupMenu_MouseTracking mouse tracking in popup menus.
|
|---|
| 1707 |
|
|---|
| 1708 | \value SH_MenuBar_MouseTracking mouse tracking in menubars.
|
|---|
| 1709 |
|
|---|
| 1710 | \value SH_ItemView_ChangeHighlightOnFocus gray out selected items
|
|---|
| 1711 | when losing focus.
|
|---|
| 1712 |
|
|---|
| 1713 | \value SH_Widget_ShareActivation turn on sharing activation with
|
|---|
| 1714 | floating modeless dialogs.
|
|---|
| 1715 |
|
|---|
| 1716 | \value SH_TabBar_SelectMouseType which type of mouse event should
|
|---|
| 1717 | cause a tab to be selected.
|
|---|
| 1718 |
|
|---|
| 1719 | \value SH_ListViewExpand_SelectMouseType which type of mouse event should
|
|---|
| 1720 | cause a listview expansion to be selected.
|
|---|
| 1721 |
|
|---|
| 1722 | \value SH_TabBar_PreferNoArrows whether a tabbar should suggest a size
|
|---|
| 1723 | to prevent scoll arrows.
|
|---|
| 1724 |
|
|---|
| 1725 | \value SH_ComboBox_Popup allows popups as a combobox dropdown
|
|---|
| 1726 | menu.
|
|---|
| 1727 |
|
|---|
| 1728 | \value SH_Workspace_FillSpaceOnMaximize the workspace should
|
|---|
| 1729 | maximize the client area.
|
|---|
| 1730 |
|
|---|
| 1731 | \value SH_TitleBar_NoBorder the titlebar has no border
|
|---|
| 1732 |
|
|---|
| 1733 | \value SH_ScrollBar_StopMouseOverSlider stops autorepeat when
|
|---|
| 1734 | slider reaches mouse
|
|---|
| 1735 |
|
|---|
| 1736 | \value SH_BlinkCursorWhenTextSelected whether cursor should blink
|
|---|
| 1737 | when text is selected
|
|---|
| 1738 |
|
|---|
| 1739 | \value SH_RichText_FullWidthSelection whether richtext selections
|
|---|
| 1740 | should extend the full width of the document.
|
|---|
| 1741 |
|
|---|
| 1742 | \value SH_GroupBox_TextLabelVerticalAlignment how to vertically align a
|
|---|
| 1743 | groupbox's text label.
|
|---|
| 1744 |
|
|---|
| 1745 | \value SH_GroupBox_TextLabelColor how to paint a groupbox's text label.
|
|---|
| 1746 |
|
|---|
| 1747 | \value SH_DialogButtons_DefaultButton which buttons gets the
|
|---|
| 1748 | default status in a dialog's button widget.
|
|---|
| 1749 |
|
|---|
| 1750 | \value SH_CustomBase base value for custom ControlElements. All
|
|---|
| 1751 | values above this are reserved for custom use. Therefore,
|
|---|
| 1752 | custom values must be greater than this value.
|
|---|
| 1753 |
|
|---|
| 1754 | \value SH_ToolButton_Uses3D indicates whether QToolButtons should
|
|---|
| 1755 | use a 3D frame when the mouse is over them
|
|---|
| 1756 |
|
|---|
| 1757 | \value SH_ToolBox_SelectedPageTitleBold Boldness of the selected
|
|---|
| 1758 | page title in a QToolBox.
|
|---|
| 1759 |
|
|---|
| 1760 | \value SH_LineEdit_PasswordCharacter The QChar Unicode character
|
|---|
| 1761 | to be used for passwords.
|
|---|
| 1762 |
|
|---|
| 1763 | \value SH_Table_GridLineColor
|
|---|
| 1764 |
|
|---|
| 1765 | \value SH_UnderlineAccelerator whether accelerators are underlined
|
|---|
| 1766 |
|
|---|
| 1767 | \sa styleHint()
|
|---|
| 1768 | */
|
|---|
| 1769 |
|
|---|
| 1770 | /*!
|
|---|
| 1771 | \fn int QStyle::styleHint( StyleHint stylehint, const QWidget *widget = 0, const QStyleOption &opt = QStyleOption::Default, QStyleHintReturn *returnData = 0 ) const;
|
|---|
| 1772 |
|
|---|
| 1773 | Returns the style hint \a stylehint for \a widget. Currently, \a
|
|---|
| 1774 | widget, \a opt, and \a returnData are unused; they're included to
|
|---|
| 1775 | allow for future enhancements.
|
|---|
| 1776 |
|
|---|
| 1777 | For an explanation of the return value see \l StyleHint.
|
|---|
| 1778 | */
|
|---|
| 1779 |
|
|---|
| 1780 | /*!
|
|---|
| 1781 | \enum QStyle::StylePixmap
|
|---|
| 1782 |
|
|---|
| 1783 | This enum represents a StylePixmap. A StylePixmap is a pixmap that
|
|---|
| 1784 | can follow some existing GUI style or guideline.
|
|---|
| 1785 |
|
|---|
| 1786 |
|
|---|
| 1787 | \value SP_TitleBarMinButton minimize button on titlebars. For
|
|---|
| 1788 | example, in a QWorkspace.
|
|---|
| 1789 | \value SP_TitleBarMaxButton maximize button on titlebars.
|
|---|
| 1790 | \value SP_TitleBarCloseButton close button on titlebars.
|
|---|
| 1791 | \value SP_TitleBarNormalButton normal (restore) button on titlebars.
|
|---|
| 1792 | \value SP_TitleBarShadeButton shade button on titlebars.
|
|---|
| 1793 | \value SP_TitleBarUnshadeButton unshade button on titlebars.
|
|---|
| 1794 | \value SP_MessageBoxInformation the 'information' icon.
|
|---|
| 1795 | \value SP_MessageBoxWarning the 'warning' icon.
|
|---|
| 1796 | \value SP_MessageBoxCritical the 'critical' icon.
|
|---|
| 1797 | \value SP_MessageBoxQuestion the 'question' icon.
|
|---|
| 1798 |
|
|---|
| 1799 |
|
|---|
| 1800 | \value SP_DockWindowCloseButton close button on dock windows;
|
|---|
| 1801 | see also QDockWindow.
|
|---|
| 1802 |
|
|---|
| 1803 |
|
|---|
| 1804 | \value SP_CustomBase base value for custom ControlElements. All
|
|---|
| 1805 | values above this are reserved for custom use. Therefore,
|
|---|
| 1806 | custom values must be greater than this value.
|
|---|
| 1807 |
|
|---|
| 1808 | \sa stylePixmap()
|
|---|
| 1809 | */
|
|---|
| 1810 |
|
|---|
| 1811 | /*!
|
|---|
| 1812 | \fn QPixmap QStyle::stylePixmap( StylePixmap stylepixmap, const QWidget *widget = 0, const QStyleOption& opt = QStyleOption::Default ) const;
|
|---|
| 1813 |
|
|---|
| 1814 | Returns a pixmap for \a stylepixmap.
|
|---|
| 1815 |
|
|---|
| 1816 | The \a opt argument can be used to pass extra information required
|
|---|
| 1817 | when drawing the ControlElement. Note that \a opt may be the
|
|---|
| 1818 | default value even for StylePixmaps that can make use of the extra
|
|---|
| 1819 | options. Currently, the \a opt argument is unused.
|
|---|
| 1820 |
|
|---|
| 1821 | The \a widget argument is a pointer to a QWidget or one of its
|
|---|
| 1822 | subclasses. The widget can be cast to the appropriate type based
|
|---|
| 1823 | on the value of \a stylepixmap. See the table below for the
|
|---|
| 1824 | appropriate \a widget casts:
|
|---|
| 1825 |
|
|---|
| 1826 | \table
|
|---|
| 1827 | \header \i StylePixmap \i Widget Cast
|
|---|
| 1828 | \row \i \l SP_TitleBarMinButton \i (const \l QWidget *)
|
|---|
| 1829 | \row \i \l SP_TitleBarMaxButton \i (const \l QWidget *)
|
|---|
| 1830 | \row \i \l SP_TitleBarCloseButton \i (const \l QWidget *)
|
|---|
| 1831 | \row \i \l SP_TitleBarNormalButton \i (const \l QWidget *)
|
|---|
| 1832 | \row \i \l SP_TitleBarShadeButton \i (const \l QWidget *)
|
|---|
| 1833 | \row \i \l SP_TitleBarUnshadeButton \i (const \l QWidget *)
|
|---|
| 1834 | \row \i \l SP_DockWindowCloseButton \i (const \l QDockWindow *)
|
|---|
| 1835 | \endtable
|
|---|
| 1836 |
|
|---|
| 1837 | \sa StylePixmap
|
|---|
| 1838 | */
|
|---|
| 1839 |
|
|---|
| 1840 | /*!
|
|---|
| 1841 | \fn QRect QStyle::visualRect( const QRect &logical, const QWidget *w );
|
|---|
| 1842 |
|
|---|
| 1843 | Returns the rect \a logical in screen coordinates. The bounding
|
|---|
| 1844 | rect for widget \a w is used to perform the translation. This
|
|---|
| 1845 | function is provided to aid style implementors in supporting
|
|---|
| 1846 | right-to-left mode.
|
|---|
| 1847 |
|
|---|
| 1848 | \sa QApplication::reverseLayout()
|
|---|
| 1849 | */
|
|---|
| 1850 | QRect QStyle::visualRect( const QRect &logical, const QWidget *w )
|
|---|
| 1851 | {
|
|---|
| 1852 | QRect boundingRect = w->rect();
|
|---|
| 1853 | QRect r = logical;
|
|---|
| 1854 | if ( QApplication::reverseLayout() )
|
|---|
| 1855 | r.moveBy( 2*(boundingRect.right() - logical.right()) +
|
|---|
| 1856 | logical.width() - boundingRect.width(), 0 );
|
|---|
| 1857 | return r;
|
|---|
| 1858 | }
|
|---|
| 1859 |
|
|---|
| 1860 | /*!
|
|---|
| 1861 | \overload QRect QStyle::visualRect( const QRect &logical, const QRect &bounding );
|
|---|
| 1862 |
|
|---|
| 1863 | Returns the rect \a logical in screen coordinates. The rect \a
|
|---|
| 1864 | bounding is used to perform the translation. This function is
|
|---|
| 1865 | provided to aid style implementors in supporting right-to-left
|
|---|
| 1866 | mode.
|
|---|
| 1867 |
|
|---|
| 1868 | \sa QApplication::reverseLayout()
|
|---|
| 1869 | */
|
|---|
| 1870 | QRect QStyle::visualRect( const QRect &logical, const QRect &boundingRect )
|
|---|
| 1871 | {
|
|---|
| 1872 | QRect r = logical;
|
|---|
| 1873 | if ( QApplication::reverseLayout() )
|
|---|
| 1874 | r.moveBy( 2*(boundingRect.right() - logical.right()) +
|
|---|
| 1875 | logical.width() - boundingRect.width(), 0 );
|
|---|
| 1876 | return r;
|
|---|
| 1877 | }
|
|---|
| 1878 |
|
|---|
| 1879 | /*!
|
|---|
| 1880 | \fn int QStyle::defaultFrameWidth() const
|
|---|
| 1881 | \obsolete
|
|---|
| 1882 | */
|
|---|
| 1883 |
|
|---|
| 1884 | /*!
|
|---|
| 1885 | \fn void QStyle::tabbarMetrics( const QWidget *, int &, int &, int & ) const
|
|---|
| 1886 | \obsolete
|
|---|
| 1887 | */
|
|---|
| 1888 |
|
|---|
| 1889 | /*!
|
|---|
| 1890 | \fn QSize QStyle::scrollBarExtent() const
|
|---|
| 1891 | \obsolete
|
|---|
| 1892 | */
|
|---|
| 1893 |
|
|---|
| 1894 | #endif // QT_NO_STYLE
|
|---|