Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qstyle.h" | - |
43 | #include "qapplication.h" | - |
44 | #include "qpainter.h" | - |
45 | #include "qwidget.h" | - |
46 | #include "qbitmap.h" | - |
47 | #include "qpixmapcache.h" | - |
48 | #include "qstyleoption.h" | - |
49 | #include "private/qstyle_p.h" | - |
50 | #include "private/qguiapplication_p.h" | - |
51 | #ifndef QT_NO_DEBUG | - |
52 | #include "qdebug.h" | - |
53 | #endif | - |
54 | | - |
55 | #include <limits.h> | - |
56 | | - |
57 | QT_BEGIN_NAMESPACE | - |
58 | | - |
59 | static const int MaxBits = 8 * sizeof(QSizePolicy::ControlType); | - |
60 | | - |
61 | static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::ControlType *array) | - |
62 | { | - |
63 | if (!controls) partially evaluated: !controls no Evaluation Count:0 | yes Evaluation Count:4114 |
| 0-4114 |
64 | return 0; never executed: return 0; | 0 |
65 | | - |
66 | // optimization: exactly one bit is set | - |
67 | if ((controls & (controls - 1)) == 0) { partially evaluated: (controls & (controls - 1)) == 0 yes Evaluation Count:4114 | no Evaluation Count:0 |
| 0-4114 |
68 | array[0] = QSizePolicy::ControlType(uint(controls)); executed (the execution status of this line is deduced): array[0] = QSizePolicy::ControlType(uint(controls)); | - |
69 | return 1; executed: return 1; Execution Count:4114 | 4114 |
70 | } | - |
71 | | - |
72 | int count = 0; never executed (the execution status of this line is deduced): int count = 0; | - |
73 | for (int i = 0; i < MaxBits; ++i) { never evaluated: i < MaxBits | 0 |
74 | if (uint bit = (controls & (0x1 << i))) never evaluated: uint bit = (controls & (0x1 << i)) | 0 |
75 | array[count++] = QSizePolicy::ControlType(bit); never executed: array[count++] = QSizePolicy::ControlType(bit); | 0 |
76 | } | 0 |
77 | return count; never executed: return count; | 0 |
78 | } | - |
79 | | - |
80 | /*! | - |
81 | \page qwidget-styling.html | - |
82 | \title Styling | - |
83 | | - |
84 | Qt's built-in widgets use the QStyle class to perform nearly all | - |
85 | of their drawing. QStyle is an abstract base class that | - |
86 | encapsulates the look and feel of a GUI, and can be used to make | - |
87 | the widgets look exactly like the equivalent native widgets or to | - |
88 | give the widgets a custom look. | - |
89 | | - |
90 | Qt provides a set of QStyle subclasses that emulate the native | - |
91 | look of the different platforms supported by Qt (QWindowsStyle, | - |
92 | QMacStyle, etc.). These styles are built into the | - |
93 | Qt GUI module, other styles can be made available using Qt's | - |
94 | plugin mechansim. | - |
95 | | - |
96 | Most functions for drawing style elements take four arguments: | - |
97 | | - |
98 | \list | - |
99 | \li an enum value specifying which graphical element to draw | - |
100 | \li a QStyleOption object specifying how and where to render that element | - |
101 | \li a QPainter object that should be used to draw the element | - |
102 | \li a QWidget object on which the drawing is performed (optional) | - |
103 | \endlist | - |
104 | | - |
105 | The style gets all the information it needs to render the | - |
106 | graphical element from the QStyleOption class. The widget is | - |
107 | passed as the last argument in case the style needs it to perform | - |
108 | special effects (such as animated default buttons on Mac OS X), | - |
109 | but it isn't mandatory. In fact, QStyle can be used to draw on any | - |
110 | paint device (not just widgets), in which case the widget argument | - |
111 | is a zero pointer. | - |
112 | | - |
113 | \image paintsystem-stylepainter.png | - |
114 | | - |
115 | The paint system also provides the QStylePainter class inheriting | - |
116 | from QPainter. QStylePainter is a convenience class for drawing | - |
117 | QStyle elements inside a widget, and extends QPainter with a set | - |
118 | of high-level drawing functions implemented on top of QStyle's | - |
119 | API. The advantage of using QStylePainter is that the parameter | - |
120 | lists get considerably shorter. | - |
121 | | - |
122 | \table 100% | - |
123 | \row | - |
124 | \li \inlineimage paintsystem-icon.png | - |
125 | \li \b QIcon | - |
126 | | - |
127 | The QIcon class provides scalable icons in different modes and states. | - |
128 | | - |
129 | QIcon can generate pixmaps reflecting an icon's state, mode and | - |
130 | size. These pixmaps are generated from the set of pixmaps | - |
131 | made available to the icon, and are used by Qt widgets to show an | - |
132 | icon representing a particular action. | - |
133 | | - |
134 | The rendering of a QIcon object is handled by the QIconEngine | - |
135 | class. Each icon has a corresponding icon engine that is | - |
136 | responsible for drawing the icon with a requested size, mode and | - |
137 | state. | - |
138 | | - |
139 | \endtable | - |
140 | | - |
141 | For more information about widget styling and appearance, see the | - |
142 | \l{Styles and Style Aware Widgets}. | - |
143 | */ | - |
144 | | - |
145 | | - |
146 | /*! | - |
147 | \class QStyle | - |
148 | \brief The QStyle class is an abstract base class that encapsulates the look and feel of a GUI. | - |
149 | | - |
150 | \ingroup appearance | - |
151 | \inmodule QtWidgets | - |
152 | | - |
153 | Qt contains a set of QStyle subclasses that emulate the styles of | - |
154 | the different platforms supported by Qt (QWindowsStyle, | - |
155 | QMacStyle etc.). By default, these styles are built | - |
156 | into the Qt GUI module. Styles can also be made available as | - |
157 | plugins. | - |
158 | | - |
159 | Qt's built-in widgets use QStyle to perform nearly all of their | - |
160 | drawing, ensuring that they look exactly like the equivalent | - |
161 | native widgets. The diagram below shows a QComboBox in eight | - |
162 | different styles. | - |
163 | | - |
164 | \image qstyle-comboboxes.png Eight combo boxes | - |
165 | | - |
166 | Topics: | - |
167 | | - |
168 | \tableofcontents | - |
169 | | - |
170 | \section1 Setting a Style | - |
171 | | - |
172 | The style of the entire application can be set using the | - |
173 | QApplication::setStyle() function. It can also be specified by the | - |
174 | user of the application, using the \c -style command-line option: | - |
175 | | - |
176 | \snippet code/src_gui_styles_qstyle.cpp 0 | - |
177 | | - |
178 | If no style is specified, Qt will choose the most appropriate | - |
179 | style for the user's platform or desktop environment. | - |
180 | | - |
181 | A style can also be set on an individual widget using the | - |
182 | QWidget::setStyle() function. | - |
183 | | - |
184 | \section1 Developing Style-Aware Custom Widgets | - |
185 | | - |
186 | If you are developing custom widgets and want them to look good on | - |
187 | all platforms, you can use QStyle functions to perform parts of | - |
188 | the widget drawing, such as drawItemText(), drawItemPixmap(), | - |
189 | drawPrimitive(), drawControl(), and drawComplexControl(). | - |
190 | | - |
191 | Most QStyle draw functions take four arguments: | - |
192 | \list | - |
193 | \li an enum value specifying which graphical element to draw | - |
194 | \li a QStyleOption specifying how and where to render that element | - |
195 | \li a QPainter that should be used to draw the element | - |
196 | \li a QWidget on which the drawing is performed (optional) | - |
197 | \endlist | - |
198 | | - |
199 | For example, if you want to draw a focus rectangle on your | - |
200 | widget, you can write: | - |
201 | | - |
202 | \snippet styles/styles.cpp 1 | - |
203 | | - |
204 | QStyle gets all the information it needs to render the graphical | - |
205 | element from QStyleOption. The widget is passed as the last | - |
206 | argument in case the style needs it to perform special effects | - |
207 | (such as animated default buttons on Mac OS X), but it isn't | - |
208 | mandatory. In fact, you can use QStyle to draw on any paint | - |
209 | device, not just widgets, by setting the QPainter properly. | - |
210 | | - |
211 | QStyleOption has various subclasses for the various types of | - |
212 | graphical elements that can be drawn. For example, | - |
213 | PE_FrameFocusRect expects a QStyleOptionFocusRect argument. | - |
214 | | - |
215 | To ensure that drawing operations are as fast as possible, | - |
216 | QStyleOption and its subclasses have public data members. See the | - |
217 | QStyleOption class documentation for details on how to use it. | - |
218 | | - |
219 | For convenience, Qt provides the QStylePainter class, which | - |
220 | combines a QStyle, a QPainter, and a QWidget. This makes it | - |
221 | possible to write | - |
222 | | - |
223 | \snippet styles/styles.cpp 5 | - |
224 | \dots | - |
225 | \snippet styles/styles.cpp 7 | - |
226 | | - |
227 | instead of | - |
228 | | - |
229 | \snippet styles/styles.cpp 2 | - |
230 | \dots | - |
231 | \snippet styles/styles.cpp 3 | - |
232 | | - |
233 | \section1 Creating a Custom Style | - |
234 | | - |
235 | You can create a custom look and feel for your application by | - |
236 | creating a custom style. There are two approaches to creating a | - |
237 | custom style. In the static approach, you either choose an | - |
238 | existing QStyle class, subclass it, and reimplement virtual | - |
239 | functions to provide the custom behavior, or you create an entire | - |
240 | QStyle class from scratch. In the dynamic approach, you modify the | - |
241 | behavior of your system style at runtime. The static approach is | - |
242 | described below. The dynamic approach is described in QProxyStyle. | - |
243 | | - |
244 | The first step in the static approach is to pick one of the styles | - |
245 | provided by Qt from which you will build your custom style. Your | - |
246 | choice of QStyle class will depend on which style resembles your | - |
247 | desired style the most. The most general class that you can use as | - |
248 | a base is QCommonStyle (not QStyle). This is because Qt requires | - |
249 | its styles to be \l{QCommonStyle}s. | - |
250 | | - |
251 | Depending on which parts of the base style you want to change, | - |
252 | you must reimplement the functions that are used to draw those | - |
253 | parts of the interface. To illustrate this, we will modify the | - |
254 | look of the spin box arrows drawn by QWindowsStyle. The arrows | - |
255 | are \e{primitive elements} that are drawn by the drawPrimitive() | - |
256 | function, so we need to reimplement that function. We need the | - |
257 | following class declaration: | - |
258 | | - |
259 | \snippet customstyle/customstyle.h 0 | - |
260 | | - |
261 | To draw its up and down arrows, QSpinBox uses the | - |
262 | PE_IndicatorSpinUp and PE_IndicatorSpinDown primitive elements. | - |
263 | Here's how to reimplement the drawPrimitive() function to draw | - |
264 | them differently: | - |
265 | | - |
266 | \snippet customstyle/customstyle.cpp 2 | - |
267 | \snippet customstyle/customstyle.cpp 3 | - |
268 | \snippet customstyle/customstyle.cpp 4 | - |
269 | | - |
270 | Notice that we don't use the \c widget argument, except to pass it | - |
271 | on to the QWindowStyle::drawPrimitive() function. As mentioned | - |
272 | earlier, the information about what is to be drawn and how it | - |
273 | should be drawn is specified by a QStyleOption object, so there is | - |
274 | no need to ask the widget. | - |
275 | | - |
276 | If you need to use the \c widget argument to obtain additional | - |
277 | information, be careful to ensure that it isn't 0 and that it is | - |
278 | of the correct type before using it. For example: | - |
279 | | - |
280 | \snippet customstyle/customstyle.cpp 0 | - |
281 | \dots | - |
282 | \snippet customstyle/customstyle.cpp 1 | - |
283 | | - |
284 | When implementing a custom style, you cannot assume that the | - |
285 | widget is a QSpinBox just because the enum value is called | - |
286 | PE_IndicatorSpinUp or PE_IndicatorSpinDown. | - |
287 | | - |
288 | The documentation for the \l{widgets/styles}{Styles} example | - |
289 | covers this topic in more detail. | - |
290 | | - |
291 | \warning Qt style sheets are currently not supported for custom QStyle | - |
292 | subclasses. We plan to address this in some future release. | - |
293 | | - |
294 | | - |
295 | \section1 Using a Custom Style | - |
296 | | - |
297 | There are several ways of using a custom style in a Qt | - |
298 | application. The simplest way is to pass the custom style to the | - |
299 | QApplication::setStyle() static function before creating the | - |
300 | QApplication object: | - |
301 | | - |
302 | \snippet customstyle/main.cpp using a custom style | - |
303 | | - |
304 | You can call QApplication::setStyle() at any time, but by calling | - |
305 | it before the constructor, you ensure that the user's preference, | - |
306 | set using the \c -style command-line option, is respected. | - |
307 | | - |
308 | You may want to make your custom style available for use in other | - |
309 | applications, which may not be yours and hence not available for | - |
310 | you to recompile. The Qt Plugin system makes it possible to create | - |
311 | styles as plugins. Styles created as plugins are loaded as shared | - |
312 | objects at runtime by Qt itself. Please refer to the \l{plugins-howto.html}{Qt Plugin} documentation for more | - |
313 | information on how to go about creating a style plugin. | - |
314 | | - |
315 | Compile your plugin and put it into Qt's \c plugins/styles | - |
316 | directory. We now have a pluggable style that Qt can load | - |
317 | automatically. To use your new style with existing applications, | - |
318 | simply start the application with the following argument: | - |
319 | | - |
320 | \snippet code/src_gui_styles_qstyle.cpp 1 | - |
321 | | - |
322 | The application will use the look and feel from the custom style you | - |
323 | implemented. | - |
324 | | - |
325 | \section1 Right-to-Left Desktops | - |
326 | | - |
327 | Languages written from right to left (such as Arabic and Hebrew) | - |
328 | usually also mirror the whole layout of widgets, and require the | - |
329 | light to come from the screen's top-right corner instead of | - |
330 | top-left. | - |
331 | | - |
332 | If you create a custom style, you should take special care when | - |
333 | drawing asymmetric elements to make sure that they also look | - |
334 | correct in a mirrored layout. An easy way to test your styles is | - |
335 | to run applications with the \c -reverse command-line option or | - |
336 | to call QApplication::setLayoutDirection() in your \c main() | - |
337 | function. | - |
338 | | - |
339 | Here are some things to keep in mind when making a style work well in a | - |
340 | right-to-left environment: | - |
341 | | - |
342 | \list | - |
343 | \li subControlRect() and subElementRect() return rectangles in screen coordinates | - |
344 | \li QStyleOption::direction indicates in which direction the item should be drawn in | - |
345 | \li If a style is not right-to-left aware it will display items as if it were left-to-right | - |
346 | \li visualRect(), visualPos(), and visualAlignment() are helpful functions that will | - |
347 | translate from logical to screen representations. | - |
348 | \li alignedRect() will return a logical rect aligned for the current direction | - |
349 | \endlist | - |
350 | | - |
351 | \section1 Styles in Item Views | - |
352 | | - |
353 | The painting of items in views is performed by a delegate. Qt's | - |
354 | default delegate, QStyledItemDelegate, is also used for for calculating bounding | - |
355 | rectangles of items, and their sub-elements for the various kind | - |
356 | of item \l{Qt::ItemDataRole}{data roles} | - |
357 | QStyledItemDelegate supports. See the QStyledItemDelegate class | - |
358 | description to find out which datatypes and roles are supported. You | - |
359 | can read more about item data roles in \l{Model/View Programming}. | - |
360 | | - |
361 | When QStyledItemDelegate paints its items, it draws | - |
362 | CE_ItemViewItem, and calculates their size with CT_ItemViewItem. | - |
363 | Note also that it uses SE_ItemViewItemText to set the size of | - |
364 | editors. When implementing a style to customize drawing of item | - |
365 | views, you need to check the implementation of QCommonStyle (and | - |
366 | any other subclasses from which your style | - |
367 | inherits). This way, you find out which and how | - |
368 | other style elements are painted, and you can then reimplement the | - |
369 | painting of elements that should be drawn differently. | - |
370 | | - |
371 | We include a small example where we customize the drawing of item | - |
372 | backgrounds. | - |
373 | | - |
374 | \snippet customviewstyle.cpp 0 | - |
375 | | - |
376 | The primitive element PE_PanelItemViewItem is responsible for | - |
377 | painting the background of items, and is called from | - |
378 | \l{QCommonStyle}'s implementation of CE_ItemViewItem. | - |
379 | | - |
380 | To add support for drawing of new datatypes and item data roles, | - |
381 | it is necessary to create a custom delegate. But if you only | - |
382 | need to support the datatypes implemented by the default | - |
383 | delegate, a custom style does not need an accompanying | - |
384 | delegate. The QStyledItemDelegate class description gives more | - |
385 | information on custom delegates. | - |
386 | | - |
387 | The drawing of item view headers is also done by the style, giving | - |
388 | control over size of header items and row and column sizes. | - |
389 | | - |
390 | \sa QStyleOption, QStylePainter, {Styles Example}, | - |
391 | {Styles and Style Aware Widgets}, QStyledItemDelegate, {Styling} | - |
392 | */ | - |
393 | | - |
394 | /*! | - |
395 | Constructs a style object. | - |
396 | */ | - |
397 | QStyle::QStyle() | - |
398 | : QObject(*new QStylePrivate) | - |
399 | { | - |
400 | Q_D(QStyle); never executed (the execution status of this line is deduced): QStylePrivate * const d = d_func(); | - |
401 | d->proxyStyle = this; never executed (the execution status of this line is deduced): d->proxyStyle = this; | - |
402 | } | 0 |
403 | | - |
404 | /*! | - |
405 | \internal | - |
406 | | - |
407 | Constructs a style object. | - |
408 | */ | - |
409 | QStyle::QStyle(QStylePrivate &dd) | - |
410 | : QObject(dd) | - |
411 | { | - |
412 | Q_D(QStyle); executed (the execution status of this line is deduced): QStylePrivate * const d = d_func(); | - |
413 | d->proxyStyle = this; executed (the execution status of this line is deduced): d->proxyStyle = this; | - |
414 | } executed: } Execution Count:1164 | 1164 |
415 | | - |
416 | /*! | - |
417 | Destroys the style object. | - |
418 | */ | - |
419 | QStyle::~QStyle() | - |
420 | { | - |
421 | } | - |
422 | | - |
423 | /*! | - |
424 | Initializes the appearance of the given \a widget. | - |
425 | | - |
426 | This function is called for every widget at some point after it | - |
427 | has been fully created but just \e before it is shown for the very | - |
428 | first time. | - |
429 | | - |
430 | Note that the default implementation does nothing. Reasonable | - |
431 | actions in this function might be to call the | - |
432 | QWidget::setBackgroundMode() function for the widget. Do not use | - |
433 | the function to set, for example, the geometry. Reimplementing | - |
434 | this function provides a back-door through which the appearance | - |
435 | of a widget can be changed, but with Qt's style engine it is | - |
436 | rarely necessary to implement this function; reimplement | - |
437 | drawItemPixmap(), drawItemText(), drawPrimitive(), etc. instead. | - |
438 | | - |
439 | The QWidget::inherits() function may provide enough information to | - |
440 | allow class-specific customizations. But because new QStyle | - |
441 | subclasses are expected to work reasonably with all current and \e | - |
442 | future widgets, limited use of hard-coded customization is | - |
443 | recommended. | - |
444 | | - |
445 | \sa unpolish() | - |
446 | */ | - |
447 | void QStyle::polish(QWidget * /* widget */) | - |
448 | { | - |
449 | } | - |
450 | | - |
451 | /*! | - |
452 | Uninitialize the given \a{widget}'s appearance. | - |
453 | | - |
454 | This function is the counterpart to polish(). It is called for | - |
455 | every polished widget whenever the style is dynamically changed; | - |
456 | the former style has to unpolish its settings before the new style | - |
457 | can polish them again. | - |
458 | | - |
459 | Note that unpolish() will only be called if the widget is | - |
460 | destroyed. This can cause problems in some cases, e.g, if you | - |
461 | remove a widget from the UI, cache it, and then reinsert it after | - |
462 | the style has changed; some of Qt's classes cache their widgets. | - |
463 | | - |
464 | \sa polish() | - |
465 | */ | - |
466 | void QStyle::unpolish(QWidget * /* widget */) | - |
467 | { | - |
468 | } | - |
469 | | - |
470 | /*! | - |
471 | \fn void QStyle::polish(QApplication * application) | - |
472 | \overload | - |
473 | | - |
474 | Late initialization of the given \a application object. | - |
475 | */ | - |
476 | void QStyle::polish(QApplication * /* app */) | - |
477 | { | - |
478 | } | - |
479 | | - |
480 | /*! | - |
481 | \fn void QStyle::unpolish(QApplication * application) | - |
482 | \overload | - |
483 | | - |
484 | Uninitialize the given \a application. | - |
485 | */ | - |
486 | void QStyle::unpolish(QApplication * /* app */) | - |
487 | { | - |
488 | } | - |
489 | | - |
490 | /*! | - |
491 | \fn void QStyle::polish(QPalette & palette) | - |
492 | \overload | - |
493 | | - |
494 | Changes the \a palette according to style specific requirements | - |
495 | for color palettes (if any). | - |
496 | | - |
497 | \sa QPalette, QApplication::setPalette() | - |
498 | */ | - |
499 | void QStyle::polish(QPalette & /* pal */) | - |
500 | { | - |
501 | } | - |
502 | | - |
503 | /*! | - |
504 | \fn QRect QStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const | - |
505 | | - |
506 | Returns the area within the given \a rectangle in which to draw | - |
507 | the provided \a text according to the specified font \a metrics | - |
508 | and \a alignment. The \a enabled parameter indicates whether or | - |
509 | not the associated item is enabled. | - |
510 | | - |
511 | If the given \a rectangle is larger than the area needed to render | - |
512 | the \a text, the rectangle that is returned will be offset within | - |
513 | \a rectangle according to the specified \a alignment. For | - |
514 | example, if \a alignment is Qt::AlignCenter, the returned | - |
515 | rectangle will be centered within \a rectangle. If the given \a | - |
516 | rectangle is smaller than the area needed, the returned rectangle | - |
517 | will be the smallest rectangle large enough to render the \a text. | - |
518 | | - |
519 | \sa Qt::Alignment | - |
520 | */ | - |
521 | QRect QStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled, | - |
522 | const QString &text) const | - |
523 | { | - |
524 | QRect result; executed (the execution status of this line is deduced): QRect result; | - |
525 | int x, y, w, h; executed (the execution status of this line is deduced): int x, y, w, h; | - |
526 | rect.getRect(&x, &y, &w, &h); executed (the execution status of this line is deduced): rect.getRect(&x, &y, &w, &h); | - |
527 | if (!text.isEmpty()) { evaluated: !text.isEmpty() yes Evaluation Count:44 | yes Evaluation Count:18 |
| 18-44 |
528 | result = metrics.boundingRect(x, y, w, h, alignment, text); executed (the execution status of this line is deduced): result = metrics.boundingRect(x, y, w, h, alignment, text); | - |
529 | if (!enabled && proxy()->styleHint(SH_EtchDisabledText)) { evaluated: !enabled yes Evaluation Count:35 | yes Evaluation Count:9 |
partially evaluated: proxy()->styleHint(SH_EtchDisabledText) yes Evaluation Count:35 | no Evaluation Count:0 |
| 0-35 |
530 | result.setWidth(result.width()+1); executed (the execution status of this line is deduced): result.setWidth(result.width()+1); | - |
531 | result.setHeight(result.height()+1); executed (the execution status of this line is deduced): result.setHeight(result.height()+1); | - |
532 | } executed: } Execution Count:35 | 35 |
533 | } else { executed: } Execution Count:44 | 44 |
534 | result = QRect(x, y, w, h); executed (the execution status of this line is deduced): result = QRect(x, y, w, h); | - |
535 | } executed: } Execution Count:18 | 18 |
536 | return result; executed: return result; Execution Count:62 | 62 |
537 | } | - |
538 | | - |
539 | /*! | - |
540 | \fn QRect QStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const | - |
541 | | - |
542 | Returns the area within the given \a rectangle in which to draw | - |
543 | the specified \a pixmap according to the defined \a alignment. | - |
544 | */ | - |
545 | QRect QStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pixmap) const | - |
546 | { | - |
547 | QRect result; executed (the execution status of this line is deduced): QRect result; | - |
548 | int x, y, w, h; executed (the execution status of this line is deduced): int x, y, w, h; | - |
549 | rect.getRect(&x, &y, &w, &h); executed (the execution status of this line is deduced): rect.getRect(&x, &y, &w, &h); | - |
550 | if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter) evaluated: (alignment & Qt::AlignVCenter) == Qt::AlignVCenter yes Evaluation Count:130 | yes Evaluation Count:4 |
| 4-130 |
551 | y += h/2 - pixmap.height()/2; executed: y += h/2 - pixmap.height()/2; Execution Count:130 | 130 |
552 | else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom) partially evaluated: (alignment & Qt::AlignBottom) == Qt::AlignBottom no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
553 | y += h - pixmap.height(); never executed: y += h - pixmap.height(); | 0 |
554 | if ((alignment & Qt::AlignRight) == Qt::AlignRight) partially evaluated: (alignment & Qt::AlignRight) == Qt::AlignRight no Evaluation Count:0 | yes Evaluation Count:134 |
| 0-134 |
555 | x += w - pixmap.width(); never executed: x += w - pixmap.width(); | 0 |
556 | else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter) evaluated: (alignment & Qt::AlignHCenter) == Qt::AlignHCenter yes Evaluation Count:4 | yes Evaluation Count:130 |
| 4-130 |
557 | x += w/2 - pixmap.width()/2; executed: x += w/2 - pixmap.width()/2; Execution Count:4 | 4 |
558 | else if ((alignment & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft()) partially evaluated: (alignment & Qt::AlignLeft) != Qt::AlignLeft no Evaluation Count:0 | yes Evaluation Count:130 |
never evaluated: QApplication::isRightToLeft() | 0-130 |
559 | x += w - pixmap.width(); never executed: x += w - pixmap.width(); | 0 |
560 | result = QRect(x, y, pixmap.width(), pixmap.height()); executed (the execution status of this line is deduced): result = QRect(x, y, pixmap.width(), pixmap.height()); | - |
561 | return result; executed: return result; Execution Count:134 | 134 |
562 | } | - |
563 | | - |
564 | /*! | - |
565 | \fn void QStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString& text, QPalette::ColorRole textRole) const | - |
566 | | - |
567 | Draws the given \a text in the specified \a rectangle using the | - |
568 | provided \a painter and \a palette. | - |
569 | | - |
570 | The text is drawn using the painter's pen, and aligned and wrapped | - |
571 | according to the specified \a alignment. If an explicit \a | - |
572 | textRole is specified, the text is drawn using the \a palette's | - |
573 | color for the given role. The \a enabled parameter indicates | - |
574 | whether or not the item is enabled; when reimplementing this | - |
575 | function, the \a enabled parameter should influence how the item is | - |
576 | drawn. | - |
577 | | - |
578 | \sa Qt::Alignment, drawItemPixmap() | - |
579 | */ | - |
580 | void QStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, | - |
581 | bool enabled, const QString& text, QPalette::ColorRole textRole) const | - |
582 | { | - |
583 | if (text.isEmpty()) evaluated: text.isEmpty() yes Evaluation Count:350 | yes Evaluation Count:3509 |
| 350-3509 |
584 | return; executed: return; Execution Count:350 | 350 |
585 | QPen savedPen; executed (the execution status of this line is deduced): QPen savedPen; | - |
586 | if (textRole != QPalette::NoRole) { evaluated: textRole != QPalette::NoRole yes Evaluation Count:3350 | yes Evaluation Count:159 |
| 159-3350 |
587 | savedPen = painter->pen(); executed (the execution status of this line is deduced): savedPen = painter->pen(); | - |
588 | painter->setPen(QPen(pal.brush(textRole), savedPen.widthF())); executed (the execution status of this line is deduced): painter->setPen(QPen(pal.brush(textRole), savedPen.widthF())); | - |
589 | } executed: } Execution Count:3350 | 3350 |
590 | if (!enabled) { evaluated: !enabled yes Evaluation Count:43 | yes Evaluation Count:3466 |
| 43-3466 |
591 | if (proxy()->styleHint(SH_DitherDisabledText)) { partially evaluated: proxy()->styleHint(SH_DitherDisabledText) no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
592 | QRect br; never executed (the execution status of this line is deduced): QRect br; | - |
593 | painter->drawText(rect, alignment, text, &br); never executed (the execution status of this line is deduced): painter->drawText(rect, alignment, text, &br); | - |
594 | painter->fillRect(br, QBrush(painter->background().color(), Qt::Dense5Pattern)); never executed (the execution status of this line is deduced): painter->fillRect(br, QBrush(painter->background().color(), Qt::Dense5Pattern)); | - |
595 | return; | 0 |
596 | } else if (proxy()->styleHint(SH_EtchDisabledText)) { partially evaluated: proxy()->styleHint(SH_EtchDisabledText) yes Evaluation Count:43 | no Evaluation Count:0 |
| 0-43 |
597 | QPen pen = painter->pen(); executed (the execution status of this line is deduced): QPen pen = painter->pen(); | - |
598 | painter->setPen(pal.light().color()); executed (the execution status of this line is deduced): painter->setPen(pal.light().color()); | - |
599 | painter->drawText(rect.adjusted(1, 1, 1, 1), alignment, text); executed (the execution status of this line is deduced): painter->drawText(rect.adjusted(1, 1, 1, 1), alignment, text); | - |
600 | painter->setPen(pen); executed (the execution status of this line is deduced): painter->setPen(pen); | - |
601 | } executed: } Execution Count:43 | 43 |
602 | } | - |
603 | painter->drawText(rect, alignment, text); executed (the execution status of this line is deduced): painter->drawText(rect, alignment, text); | - |
604 | if (textRole != QPalette::NoRole) evaluated: textRole != QPalette::NoRole yes Evaluation Count:3350 | yes Evaluation Count:159 |
| 159-3350 |
605 | painter->setPen(savedPen); executed: painter->setPen(savedPen); Execution Count:3350 | 3350 |
606 | } executed: } Execution Count:3509 | 3509 |
607 | | - |
608 | /*! | - |
609 | \fn void QStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, | - |
610 | const QPixmap &pixmap) const | - |
611 | | - |
612 | Draws the given \a pixmap in the specified \a rectangle, according | - |
613 | to the specified \a alignment, using the provided \a painter. | - |
614 | | - |
615 | \sa drawItemText() | - |
616 | */ | - |
617 | | - |
618 | void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, | - |
619 | const QPixmap &pixmap) const | - |
620 | { | - |
621 | int scale = pixmap.devicePixelRatio(); executed (the execution status of this line is deduced): int scale = pixmap.devicePixelRatio(); | - |
622 | QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect); executed (the execution status of this line is deduced): QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect); | - |
623 | QRect inter = aligned.intersected(rect); executed (the execution status of this line is deduced): QRect inter = aligned.intersected(rect); | - |
624 | | - |
625 | painter->drawPixmap(inter.x(), inter.y(), pixmap, inter.x() - aligned.x(), inter.y() - aligned.y(), inter.width() * scale, inter.height() *scale); executed (the execution status of this line is deduced): painter->drawPixmap(inter.x(), inter.y(), pixmap, inter.x() - aligned.x(), inter.y() - aligned.y(), inter.width() * scale, inter.height() *scale); | - |
626 | } executed: } Execution Count:1251 | 1251 |
627 | | - |
628 | /*! | - |
629 | \enum QStyle::PrimitiveElement | - |
630 | | - |
631 | This enum describes the various primitive elements. A | - |
632 | primitive element is a common GUI element, such as a checkbox | - |
633 | indicator or button bevel. | - |
634 | | - |
635 | \omitvalue PE_IndicatorViewItemCheck | - |
636 | \value PE_FrameStatusBar Frame | - |
637 | | - |
638 | \value PE_PanelButtonCommand Button used to initiate an action, for | - |
639 | example, a QPushButton. | - |
640 | | - |
641 | \value PE_FrameDefaultButton This frame around a default button, e.g. in a dialog. | - |
642 | \value PE_PanelButtonBevel Generic panel with a button bevel. | - |
643 | \value PE_PanelButtonTool Panel for a Tool button, used with QToolButton. | - |
644 | \value PE_PanelLineEdit Panel for a QLineEdit. | - |
645 | \value PE_IndicatorButtonDropDown Indicator for a drop down button, for example, a tool | - |
646 | button that displays a menu. | - |
647 | | - |
648 | \value PE_FrameFocusRect Generic focus indicator. | - |
649 | | - |
650 | \value PE_IndicatorArrowUp Generic Up arrow. | - |
651 | \value PE_IndicatorArrowDown Generic Down arrow. | - |
652 | \value PE_IndicatorArrowRight Generic Right arrow. | - |
653 | \value PE_IndicatorArrowLeft Generic Left arrow. | - |
654 | | - |
655 | \value PE_IndicatorSpinUp Up symbol for a spin widget, for example a QSpinBox. | - |
656 | \value PE_IndicatorSpinDown Down symbol for a spin widget. | - |
657 | \value PE_IndicatorSpinPlus Increase symbol for a spin widget. | - |
658 | \value PE_IndicatorSpinMinus Decrease symbol for a spin widget. | - |
659 | | - |
660 | \value PE_IndicatorItemViewItemCheck On/off indicator for a view item. | - |
661 | | - |
662 | \value PE_IndicatorCheckBox On/off indicator, for example, a QCheckBox. | - |
663 | \value PE_IndicatorRadioButton Exclusive on/off indicator, for example, a QRadioButton. | - |
664 | | - |
665 | \value PE_IndicatorDockWidgetResizeHandle Resize handle for dock windows. | - |
666 | | - |
667 | \value PE_Frame Generic frame | - |
668 | \value PE_FrameMenu Frame for popup windows/menus; see also QMenu. | - |
669 | \value PE_PanelMenuBar Panel for menu bars. | - |
670 | \value PE_PanelScrollAreaCorner Panel at the bottom-right (or | - |
671 | bottom-left) corner of a scroll area. | - |
672 | | - |
673 | \value PE_FrameDockWidget Panel frame for dock windows and toolbars. | - |
674 | \value PE_FrameTabWidget Frame for tab widgets. | - |
675 | \value PE_FrameLineEdit Panel frame for line edits. | - |
676 | \value PE_FrameGroupBox Panel frame around group boxes. | - |
677 | \value PE_FrameButtonBevel Panel frame for a button bevel. | - |
678 | \value PE_FrameButtonTool Panel frame for a tool button. | - |
679 | | - |
680 | \value PE_IndicatorHeaderArrow Arrow used to indicate sorting on a list or table | - |
681 | header. | - |
682 | \value PE_FrameStatusBarItem Frame for an item of a status bar; see also QStatusBar. | - |
683 | | - |
684 | \value PE_FrameWindow Frame around a MDI window or a docking window. | - |
685 | | - |
686 | \value PE_IndicatorMenuCheckMark Check mark used in a menu. | - |
687 | | - |
688 | \value PE_IndicatorProgressChunk Section of a progress bar indicator; see also QProgressBar. | - |
689 | | - |
690 | \value PE_IndicatorBranch Lines used to represent the branch of a tree in a tree view. | - |
691 | \value PE_IndicatorToolBarHandle The handle of a toolbar. | - |
692 | \value PE_IndicatorToolBarSeparator The separator in a toolbar. | - |
693 | \value PE_PanelToolBar The panel for a toolbar. | - |
694 | \value PE_PanelTipLabel The panel for a tip label. | - |
695 | \value PE_FrameTabBarBase The frame that is drawn for a tab bar, ususally drawn for a tab bar that isn't part of a tab widget. | - |
696 | \value PE_IndicatorTabTear An indicator that a tab is partially scrolled out of the visible tab bar when there are many tabs. | - |
697 | \value PE_IndicatorColumnViewArrow An arrow in a QColumnView. | - |
698 | | - |
699 | \value PE_Widget A plain QWidget. | - |
700 | | - |
701 | \value PE_CustomBase Base value for custom primitive elements. | - |
702 | All values above this are reserved for custom use. Custom values | - |
703 | must be greater than this value. | - |
704 | | - |
705 | \value PE_IndicatorItemViewItemDrop An indicator that is drawn to show where an item in an item view is about to be dropped | - |
706 | during a drag-and-drop operation in an item view. | - |
707 | \value PE_PanelItemViewItem The background for an item in an item view. | - |
708 | \value PE_PanelItemViewRow The background of a row in an item view. | - |
709 | | - |
710 | \value PE_PanelStatusBar The panel for a status bar. | - |
711 | | - |
712 | \value PE_IndicatorTabClose The close button on a tab bar. | - |
713 | \value PE_PanelMenu The panel for a menu. | - |
714 | | - |
715 | \sa drawPrimitive() | - |
716 | */ | - |
717 | | - |
718 | | - |
719 | /*! | - |
720 | \enum QStyle::StateFlag | - |
721 | | - |
722 | This enum describes flags that are used when drawing primitive | - |
723 | elements. | - |
724 | | - |
725 | Note that not all primitives use all of these flags, and that the | - |
726 | flags may mean different things to different items. | - |
727 | | - |
728 | \value State_None Indicates that the widget does not have a state. | - |
729 | \value State_Active Indicates that the widget is active. | - |
730 | \value State_AutoRaise Used to indicate if auto-raise appearance should be usd on a tool button. | - |
731 | \value State_Children Used to indicate if an item view branch has children. | - |
732 | \value State_DownArrow Used to indicate if a down arrow should be visible on the widget. | - |
733 | \value State_Editing Used to indicate if an editor is opened on the widget. | - |
734 | \value State_Enabled Used to indicate if the widget is enabled. | - |
735 | \value State_HasEditFocus Used to indicate if the widget currently has edit focus. | - |
736 | \value State_HasFocus Used to indicate if the widget has focus. | - |
737 | \value State_Horizontal Used to indicate if the widget is laid out horizontally, for example. a tool bar. | - |
738 | \value State_KeyboardFocusChange Used to indicate if the focus was changed with the keyboard, e.g., tab, backtab or shortcut. | - |
739 | \value State_MouseOver Used to indicate if the widget is under the mouse. | - |
740 | \value State_NoChange Used to indicate a tri-state checkbox. | - |
741 | \value State_Off Used to indicate if the widget is not checked. | - |
742 | \value State_On Used to indicate if the widget is checked. | - |
743 | \value State_Raised Used to indicate if a button is raised. | - |
744 | \value State_ReadOnly Used to indicate if a widget is read-only. | - |
745 | \value State_Selected Used to indicate if a widget is selected. | - |
746 | \value State_Item Used by item views to indicate if a horizontal branch should be drawn. | - |
747 | \value State_Open Used by item views to indicate if the tree branch is open. | - |
748 | \value State_Sibling Used by item views to indicate if a vertical line needs to be drawn (for siblings). | - |
749 | \value State_Sunken Used to indicate if the widget is sunken or pressed. | - |
750 | \value State_UpArrow Used to indicate if an up arrow should be visible on the widget. | - |
751 | \value State_Mini Used to indicate a mini style Mac widget or button. | - |
752 | \value State_Small Used to indicate a small style Mac widget or button. | - |
753 | \omitvalue State_Window | - |
754 | \omitvalue State_Bottom | - |
755 | \omitvalue State_FocusAtBorder | - |
756 | \omitvalue State_Top | - |
757 | | - |
758 | \sa drawPrimitive() | - |
759 | */ | - |
760 | | - |
761 | /*! | - |
762 | \fn void QStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, \ | - |
763 | QPainter *painter, const QWidget *widget) const | - |
764 | | - |
765 | Draws the given primitive \a element with the provided \a painter using the style | - |
766 | options specified by \a option. | - |
767 | | - |
768 | The \a widget argument is optional and may contain a widget that may | - |
769 | aid in drawing the primitive element. | - |
770 | | - |
771 | The table below is listing the primitive elements and their | - |
772 | associated style option subclasses. The style options contain all | - |
773 | the parameters required to draw the elements, including | - |
774 | QStyleOption::state which holds the style flags that are used when | - |
775 | drawing. The table also describes which flags that are set when | - |
776 | casting the given option to the appropriate subclass. | - |
777 | | - |
778 | Note that if a primitive element is not listed here, it is because | - |
779 | it uses a plain QStyleOption object. | - |
780 | | - |
781 | \table | - |
782 | \header \li Primitive Element \li QStyleOption Subclass \li Style Flag \li Remark | - |
783 | \row \li \l PE_FrameFocusRect \li \l QStyleOptionFocusRect | - |
784 | \li \l State_FocusAtBorder | - |
785 | \li Whether the focus is is at the border or inside the widget. | - |
786 | \row \li{1,2} \l PE_IndicatorCheckBox \li{1,2} \l QStyleOptionButton | - |
787 | \li \l State_NoChange \li Indicates a "tri-state" checkbox. | - |
788 | \row \li \l State_On \li Indicates the indicator is checked. | - |
789 | \row \li \l PE_IndicatorRadioButton \li \l QStyleOptionButton | - |
790 | \li \l State_On \li Indicates that a radio button is selected. | - |
791 | \row \li \l State_NoChange \li Indicates a "tri-state" controller. | - |
792 | \row \li \l State_Enabled \li Indicates the controller is enabled. | - |
793 | \row \li{1,4} \l PE_IndicatorBranch \li{1,4} \l QStyleOption | - |
794 | \li \l State_Children \li Indicates that the control for expanding the tree to show child items, should be drawn. | - |
795 | \row \li \l State_Item \li Indicates that a horizontal branch (to show a child item), should be drawn. | - |
796 | \row \li \l State_Open \li Indicates that the tree branch is expanded. | - |
797 | \row \li \l State_Sibling \li Indicates that a vertical line (to show a sibling item), should be drawn. | - |
798 | \row \li \l PE_IndicatorHeaderArrow \li \l QStyleOptionHeader | - |
799 | \li \l State_UpArrow \li Indicates that the arrow should be drawn up; | - |
800 | otherwise it should be down. | - |
801 | \row \li \l PE_FrameGroupBox, \l PE_Frame, \l PE_FrameLineEdit, | - |
802 | \l PE_FrameMenu, \l PE_FrameDockWidget, \l PE_FrameWindow | - |
803 | \li \l QStyleOptionFrame \li \l State_Sunken | - |
804 | \li Indicates that the Frame should be sunken. | - |
805 | \row \li \l PE_IndicatorToolBarHandle \li \l QStyleOption | - |
806 | \li \l State_Horizontal \li Indicates that the window handle is horizontal | - |
807 | instead of vertical. | - |
808 | \row \li \l PE_IndicatorSpinPlus, \l PE_IndicatorSpinMinus, \l PE_IndicatorSpinUp, | - |
809 | \l PE_IndicatorSpinDown, | - |
810 | \li \l QStyleOptionSpinBox | - |
811 | \li \l State_Sunken \li Indicates that the button is pressed. | - |
812 | \row \li{1,5} \l PE_PanelButtonCommand | - |
813 | \li{1,5} \l QStyleOptionButton | - |
814 | \li \l State_Enabled \li Set if the button is enabled. | - |
815 | \row \li \l State_HasFocus \li Set if the button has input focus. | - |
816 | \row \li \l State_Raised \li Set if the button is not down, not on and not flat. | - |
817 | \row \li \l State_On \li Set if the button is a toggle button and is toggled on. | - |
818 | \row \li \l State_Sunken | - |
819 | \li Set if the button is down (i.e., the mouse button or the | - |
820 | space bar is pressed on the button). | - |
821 | \endtable | - |
822 | | - |
823 | \sa drawComplexControl(), drawControl() | - |
824 | */ | - |
825 | | - |
826 | /*! | - |
827 | \enum QStyle::ControlElement | - |
828 | | - |
829 | This enum represents a control element. A control element is a | - |
830 | part of a widget that performs some action or displays information | - |
831 | to the user. | - |
832 | | - |
833 | \value CE_PushButton A QPushButton, draws CE_PushButtonBevel, CE_PushButtonLabel and PE_FrameFocusRect. | - |
834 | \value CE_PushButtonBevel The bevel and default indicator of a QPushButton. | - |
835 | \value CE_PushButtonLabel The label (an icon with text or pixmap) of a QPushButton. | - |
836 | | - |
837 | \value CE_DockWidgetTitle Dock window title. | - |
838 | \value CE_Splitter Splitter handle; see also QSplitter. | - |
839 | | - |
840 | | - |
841 | \value CE_CheckBox A QCheckBox, draws a PE_IndicatorCheckBox, a CE_CheckBoxLabel and a PE_FrameFocusRect. | - |
842 | \value CE_CheckBoxLabel The label (text or pixmap) of a QCheckBox. | - |
843 | | - |
844 | \value CE_RadioButton A QRadioButton, draws a PE_IndicatorRadioButton, a CE_RadioButtonLabel and a PE_FrameFocusRect. | - |
845 | \value CE_RadioButtonLabel The label (text or pixmap) of a QRadioButton. | - |
846 | | - |
847 | \value CE_TabBarTab The tab and label within a QTabBar. | - |
848 | \value CE_TabBarTabShape The tab shape within a tab bar. | - |
849 | \value CE_TabBarTabLabel The label within a tab. | - |
850 | | - |
851 | \value CE_ProgressBar A QProgressBar, draws CE_ProgressBarGroove, CE_ProgressBarContents and CE_ProgressBarLabel. | - |
852 | \value CE_ProgressBarGroove The groove where the progress | - |
853 | indicator is drawn in a QProgressBar. | - |
854 | \value CE_ProgressBarContents The progress indicator of a QProgressBar. | - |
855 | \value CE_ProgressBarLabel The text label of a QProgressBar. | - |
856 | | - |
857 | \value CE_ToolButtonLabel A tool button's label. | - |
858 | | - |
859 | \value CE_MenuBarItem A menu item in a QMenuBar. | - |
860 | \value CE_MenuBarEmptyArea The empty area of a QMenuBar. | - |
861 | | - |
862 | \value CE_MenuItem A menu item in a QMenu. | - |
863 | \value CE_MenuScroller Scrolling areas in a QMenu when the | - |
864 | style supports scrolling. | - |
865 | \value CE_MenuTearoff A menu item representing the tear off section of | - |
866 | a QMenu. | - |
867 | \value CE_MenuEmptyArea The area in a menu without menu items. | - |
868 | \value CE_MenuHMargin The horizontal extra space on the left/right of a menu. | - |
869 | \value CE_MenuVMargin The vertical extra space on the top/bottom of a menu. | - |
870 | | - |
871 | \value CE_ToolBoxTab The toolbox's tab and label within a QToolBox. | - |
872 | \value CE_SizeGrip Window resize handle; see also QSizeGrip. | - |
873 | | - |
874 | \value CE_Header A header. | - |
875 | \value CE_HeaderSection A header section. | - |
876 | \value CE_HeaderLabel The header's label. | - |
877 | | - |
878 | \value CE_ScrollBarAddLine Scroll bar line increase indicator. | - |
879 | (i.e., scroll down); see also QScrollBar. | - |
880 | \value CE_ScrollBarSubLine Scroll bar line decrease indicator (i.e., scroll up). | - |
881 | \value CE_ScrollBarAddPage Scolllbar page increase indicator (i.e., page down). | - |
882 | \value CE_ScrollBarSubPage Scroll bar page decrease indicator (i.e., page up). | - |
883 | \value CE_ScrollBarSlider Scroll bar slider. | - |
884 | \value CE_ScrollBarFirst Scroll bar first line indicator (i.e., home). | - |
885 | \value CE_ScrollBarLast Scroll bar last line indicator (i.e., end). | - |
886 | | - |
887 | \value CE_RubberBand Rubber band used in for example an icon view. | - |
888 | | - |
889 | \value CE_FocusFrame Focus frame that is style controlled. | - |
890 | | - |
891 | \value CE_ItemViewItem An item inside an item view. | - |
892 | | - |
893 | \value CE_CustomBase Base value for custom control elements; | - |
894 | custom values must be greater than this value. | - |
895 | \value CE_ComboBoxLabel The label of a non-editable QComboBox. | - |
896 | \value CE_ToolBar A toolbar like QToolBar. | - |
897 | \value CE_ToolBoxTabShape The toolbox's tab shape. | - |
898 | \value CE_ToolBoxTabLabel The toolbox's tab label. | - |
899 | \value CE_HeaderEmptyArea The area of a header view where there are no header sections. | - |
900 | | - |
901 | \value CE_ShapedFrame The frame with the shape specified in the QStyleOptionFrameV3; see QFrame. | - |
902 | | - |
903 | \omitvalue CE_ColumnViewGrip | - |
904 | | - |
905 | \sa drawControl() | - |
906 | */ | - |
907 | | - |
908 | /*! | - |
909 | \fn void QStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const | - |
910 | | - |
911 | Draws the given \a element with the provided \a painter with the | - |
912 | style options specified by \a option. | - |
913 | | - |
914 | The \a widget argument is optional and can be used as aid in | - |
915 | drawing the control. The \a option parameter is a pointer to a | - |
916 | QStyleOption object that can be cast to the correct subclass | - |
917 | using the qstyleoption_cast() function. | - |
918 | | - |
919 | The table below is listing the control elements and their | - |
920 | associated style option subclass. The style options contain all | - |
921 | the parameters required to draw the controls, including | - |
922 | QStyleOption::state which holds the style flags that are used when | - |
923 | drawing. The table also describes which flags that are set when | - |
924 | casting the given option to the appropriate subclass. | - |
925 | | - |
926 | Note that if a control element is not listed here, it is because | - |
927 | it uses a plain QStyleOption object. | - |
928 | | - |
929 | \table | - |
930 | \header \li Control Element \li QStyleOption Subclass \li Style Flag \li Remark | - |
931 | \row \li{1,5} \l CE_MenuItem, \l CE_MenuBarItem | - |
932 | \li{1,5} \l QStyleOptionMenuItem | - |
933 | \li \l State_Selected \li The menu item is currently selected item. | - |
934 | \row \li \l State_Enabled \li The item is enabled. | - |
935 | \row \li \l State_DownArrow \li Indicates that a scroll down arrow should be drawn. | - |
936 | \row \li \l State_UpArrow \li Indicates that a scroll up arrow should be drawn | - |
937 | \row \li \l State_HasFocus \li Set if the menu bar has input focus. | - |
938 | | - |
939 | \row \li{1,5} \l CE_PushButton, \l CE_PushButtonBevel, \l CE_PushButtonLabel | - |
940 | \li{1,5} \l QStyleOptionButton | - |
941 | \li \l State_Enabled \li Set if the button is enabled. | - |
942 | \row \li \l State_HasFocus \li Set if the button has input focus. | - |
943 | \row \li \l State_Raised \li Set if the button is not down, not on and not flat. | - |
944 | \row \li \l State_On \li Set if the button is a toggle button and is toggled on. | - |
945 | \row \li \l State_Sunken | - |
946 | \li Set if the button is down (i.e., the mouse button or the | - |
947 | space bar is pressed on the button). | - |
948 | | - |
949 | \row \li{1,6} \l CE_RadioButton, \l CE_RadioButtonLabel, | - |
950 | \l CE_CheckBox, \l CE_CheckBoxLabel | - |
951 | \li{1,6} \l QStyleOptionButton | - |
952 | \li \l State_Enabled \li Set if the button is enabled. | - |
953 | \row \li \l State_HasFocus \li Set if the button has input focus. | - |
954 | \row \li \l State_On \li Set if the button is checked. | - |
955 | \row \li \l State_Off \li Set if the button is not checked. | - |
956 | \row \li \l State_NoChange \li Set if the button is in the NoChange state. | - |
957 | \row \li \l State_Sunken | - |
958 | \li Set if the button is down (i.e., the mouse button or | - |
959 | the space bar is pressed on the button). | - |
960 | | - |
961 | \row \li{1,2} \l CE_ProgressBarContents, \l CE_ProgressBarLabel, | - |
962 | \l CE_ProgressBarGroove | - |
963 | \li{1,2} \l QStyleOptionProgressBar | - |
964 | \li \l State_Enabled \li Set if the progress bar is enabled. | - |
965 | \row \li \l State_HasFocus \li Set if the progress bar has input focus. | - |
966 | | - |
967 | \row \li \l CE_Header, \l CE_HeaderSection, \l CE_HeaderLabel \li \l QStyleOptionHeader \li \li | - |
968 | | - |
969 | \row \li{1,3} \l CE_TabBarTab, CE_TabBarTabShape, CE_TabBarTabLabel | - |
970 | \li{1,3} \l QStyleOptionTab | - |
971 | \li \l State_Enabled \li Set if the tab bar is enabled. | - |
972 | \row \li \l State_Selected \li The tab bar is the currently selected tab bar. | - |
973 | \row \li \l State_HasFocus \li Set if the tab bar tab has input focus. | - |
974 | | - |
975 | \row \li{1,7} \l CE_ToolButtonLabel | - |
976 | \li{1,7} \l QStyleOptionToolButton | - |
977 | \li \l State_Enabled \li Set if the tool button is enabled. | - |
978 | \row \li \l State_HasFocus \li Set if the tool button has input focus. | - |
979 | \row \li \l State_Sunken | - |
980 | \li Set if the tool button is down (i.e., a mouse button or | - |
981 | the space bar is pressed). | - |
982 | \row \li \l State_On \li Set if the tool button is a toggle button and is toggled on. | - |
983 | \row \li \l State_AutoRaise \li Set if the tool button has auto-raise enabled. | - |
984 | \row \li \l State_MouseOver \li Set if the mouse pointer is over the tool button. | - |
985 | \row \li \l State_Raised \li Set if the button is not down and is not on. | - |
986 | | - |
987 | \row \li \l CE_ToolBoxTab \li \l QStyleOptionToolBox | - |
988 | \li \l State_Selected \li The tab is the currently selected tab. | - |
989 | \row \li{1,3} \l CE_HeaderSection \li{1,3} \l QStyleOptionHeader | - |
990 | \li \l State_Sunken \li Indicates that the section is pressed. | - |
991 | \row \li \l State_UpArrow \li Indicates that the sort indicator should be pointing up. | - |
992 | \row \li \l State_DownArrow \li Indicates that the sort indicator should be pointing down. | - |
993 | \endtable | - |
994 | | - |
995 | \sa drawPrimitive(), drawComplexControl() | - |
996 | */ | - |
997 | | - |
998 | /*! | - |
999 | \enum QStyle::SubElement | - |
1000 | | - |
1001 | This enum represents a sub-area of a widget. Style implementations | - |
1002 | use these areas to draw the different parts of a widget. | - |
1003 | | - |
1004 | \value SE_PushButtonContents Area containing the label (icon | - |
1005 | with text or pixmap). | - |
1006 | \value SE_PushButtonFocusRect Area for the focus rect (usually | - |
1007 | larger than the contents rect). | - |
1008 | \value SE_PushButtonLayoutItem Area that counts for the parent layout. | - |
1009 | | - |
1010 | \value SE_CheckBoxIndicator Area for the state indicator (e.g., check mark). | - |
1011 | \value SE_CheckBoxContents Area for the label (text or pixmap). | - |
1012 | \value SE_CheckBoxFocusRect Area for the focus indicator. | - |
1013 | \value SE_CheckBoxClickRect Clickable area, defaults to SE_CheckBoxFocusRect. | - |
1014 | \value SE_CheckBoxLayoutItem Area that counts for the parent layout. | - |
1015 | | - |
1016 | \value SE_DateTimeEditLayoutItem Area that counts for the parent layout. | - |
1017 | | - |
1018 | \value SE_RadioButtonIndicator Area for the state indicator. | - |
1019 | \value SE_RadioButtonContents Area for the label. | - |
1020 | \value SE_RadioButtonFocusRect Area for the focus indicator. | - |
1021 | \value SE_RadioButtonClickRect Clickable area, defaults to SE_RadioButtonFocusRect. | - |
1022 | \value SE_RadioButtonLayoutItem Area that counts for the parent layout. | - |
1023 | | - |
1024 | \value SE_ComboBoxFocusRect Area for the focus indicator. | - |
1025 | | - |
1026 | \value SE_SliderFocusRect Area for the focus indicator. | - |
1027 | \value SE_SliderLayoutItem Area that counts for the parent layout. | - |
1028 | | - |
1029 | \value SE_SpinBoxLayoutItem Area that counts for the parent layout. | - |
1030 | | - |
1031 | \value SE_ProgressBarGroove Area for the groove. | - |
1032 | \value SE_ProgressBarContents Area for the progress indicator. | - |
1033 | \value SE_ProgressBarLabel Area for the text label. | - |
1034 | \value SE_ProgressBarLayoutItem Area that counts for the parent layout. | - |
1035 | | - |
1036 | \omitvalue SE_ViewItemCheckIndicator | - |
1037 | | - |
1038 | \value SE_FrameContents Area for a frame's contents. | - |
1039 | \value SE_ShapedFrameContents Area for a frame's contents using the shape in QStyleOptionFrameV3; see QFrame | - |
1040 | \value SE_FrameLayoutItem Area that counts for the parent layout. | - |
1041 | | - |
1042 | \value SE_HeaderArrow Area for the sort indicator for a header. | - |
1043 | \value SE_HeaderLabel Area for the label in a header. | - |
1044 | | - |
1045 | \value SE_LabelLayoutItem Area that counts for the parent layout. | - |
1046 | | - |
1047 | \value SE_LineEditContents Area for a line edit's contents. | - |
1048 | | - |
1049 | \value SE_TabWidgetLeftCorner Area for the left corner widget in a tab widget. | - |
1050 | \value SE_TabWidgetRightCorner Area for the right corner widget in a tab widget. | - |
1051 | \value SE_TabWidgetTabBar Area for the tab bar widget in a tab widget. | - |
1052 | \value SE_TabWidgetTabContents Area for the contents of the tab widget. | - |
1053 | \value SE_TabWidgetTabPane Area for the pane of a tab widget. | - |
1054 | \value SE_TabWidgetLayoutItem Area that counts for the parent layout. | - |
1055 | | - |
1056 | \value SE_ToolBoxTabContents Area for a toolbox tab's icon and label. | - |
1057 | | - |
1058 | \value SE_ToolButtonLayoutItem Area that counts for the parent layout. | - |
1059 | | - |
1060 | \value SE_ItemViewItemCheckIndicator Area for a view item's check mark. | - |
1061 | | - |
1062 | \value SE_TabBarTearIndicator Area for the tear indicator on a tab bar with scroll arrows. | - |
1063 | | - |
1064 | \value SE_TreeViewDisclosureItem Area for the actual disclosure item in a tree branch. | - |
1065 | | - |
1066 | \value SE_DialogButtonBoxLayoutItem Area that counts for the parent layout. | - |
1067 | | - |
1068 | \value SE_GroupBoxLayoutItem Area that counts for the parent layout. | - |
1069 | | - |
1070 | \value SE_CustomBase Base value for custom sub-elements. | - |
1071 | Custom values must be greater than this value. | - |
1072 | | - |
1073 | \value SE_DockWidgetFloatButton The float button of a dock | - |
1074 | widget. | - |
1075 | \value SE_DockWidgetTitleBarText The text bounds of the dock | - |
1076 | widgets title. | - |
1077 | \value SE_DockWidgetCloseButton The close button of a dock | - |
1078 | widget. | - |
1079 | \value SE_DockWidgetIcon The icon of a dock widget. | - |
1080 | \value SE_ComboBoxLayoutItem Area that counts for the parent layout. | - |
1081 | | - |
1082 | | - |
1083 | \value SE_ItemViewItemDecoration Area for a view item's decoration (icon). | - |
1084 | \value SE_ItemViewItemText Area for a view item's text. | - |
1085 | \value SE_ItemViewItemFocusRect Area for a view item's focus rect. | - |
1086 | | - |
1087 | \value SE_TabBarTabLeftButton Area for a widget on the left side of a tab in a tab bar. | - |
1088 | \value SE_TabBarTabRightButton Area for a widget on the right side of a tab in a tab bar. | - |
1089 | \value SE_TabBarTabText Area for the text on a tab in a tab bar. | - |
1090 | | - |
1091 | \value SE_ToolBarHandle Area for the handle of a tool bar. | - |
1092 | | - |
1093 | \sa subElementRect() | - |
1094 | */ | - |
1095 | | - |
1096 | /*! | - |
1097 | \fn QRect QStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const | - |
1098 | | - |
1099 | Returns the sub-area for the given \a element as described in the | - |
1100 | provided style \a option. The returned rectangle is defined in | - |
1101 | screen coordinates. | - |
1102 | | - |
1103 | The \a widget argument is optional and can be used to aid | - |
1104 | determining the area. The QStyleOption object can be cast to the | - |
1105 | appropriate type using the qstyleoption_cast() function. See the | - |
1106 | table below for the appropriate \a option casts: | - |
1107 | | - |
1108 | \table | - |
1109 | \header \li Sub Element \li QStyleOption Subclass | - |
1110 | \row \li \l SE_PushButtonContents \li \l QStyleOptionButton | - |
1111 | \row \li \l SE_PushButtonFocusRect \li \l QStyleOptionButton | - |
1112 | \row \li \l SE_CheckBoxIndicator \li \l QStyleOptionButton | - |
1113 | \row \li \l SE_CheckBoxContents \li \l QStyleOptionButton | - |
1114 | \row \li \l SE_CheckBoxFocusRect \li \l QStyleOptionButton | - |
1115 | \row \li \l SE_RadioButtonIndicator \li \l QStyleOptionButton | - |
1116 | \row \li \l SE_RadioButtonContents \li \l QStyleOptionButton | - |
1117 | \row \li \l SE_RadioButtonFocusRect \li \l QStyleOptionButton | - |
1118 | \row \li \l SE_ComboBoxFocusRect \li \l QStyleOptionComboBox | - |
1119 | \row \li \l SE_ProgressBarGroove \li \l QStyleOptionProgressBar | - |
1120 | \row \li \l SE_ProgressBarContents \li \l QStyleOptionProgressBar | - |
1121 | \row \li \l SE_ProgressBarLabel \li \l QStyleOptionProgressBar | - |
1122 | \endtable | - |
1123 | */ | - |
1124 | | - |
1125 | /*! | - |
1126 | \enum QStyle::ComplexControl | - |
1127 | | - |
1128 | This enum describes the available complex controls. Complex | - |
1129 | controls have different behavior depending upon where the user | - |
1130 | clicks on them or which keys are pressed. | - |
1131 | | - |
1132 | \value CC_SpinBox A spinbox, like QSpinBox. | - |
1133 | \value CC_ComboBox A combobox, like QComboBox. | - |
1134 | \value CC_ScrollBar A scroll bar, like QScrollBar. | - |
1135 | \value CC_Slider A slider, like QSlider. | - |
1136 | \value CC_ToolButton A tool button, like QToolButton. | - |
1137 | \value CC_TitleBar A Title bar, like those used in QMdiSubWindow. | - |
1138 | \value CC_GroupBox A group box, like QGroupBox. | - |
1139 | \value CC_Dial A dial, like QDial. | - |
1140 | \value CC_MdiControls The minimize, close, and normal | - |
1141 | button in the menu bar for a | - |
1142 | maximized MDI subwindow. | - |
1143 | | - |
1144 | \value CC_CustomBase Base value for custom complex controls. Custom | - |
1145 | values must be greater than this value. | - |
1146 | | - |
1147 | \sa SubControl, drawComplexControl() | - |
1148 | */ | - |
1149 | | - |
1150 | /*! | - |
1151 | \enum QStyle::SubControl | - |
1152 | | - |
1153 | This enum describes the available sub controls. A subcontrol is a | - |
1154 | control element within a complex control (ComplexControl). | - |
1155 | | - |
1156 | \value SC_None Special value that matches no other sub control. | - |
1157 | | - |
1158 | \value SC_ScrollBarAddLine Scroll bar add line (i.e., down/right | - |
1159 | arrow); see also QScrollBar. | - |
1160 | \value SC_ScrollBarSubLine Scroll bar sub line (i.e., up/left arrow). | - |
1161 | \value SC_ScrollBarAddPage Scroll bar add page (i.e., page down). | - |
1162 | \value SC_ScrollBarSubPage Scroll bar sub page (i.e., page up). | - |
1163 | \value SC_ScrollBarFirst Scroll bar first line (i.e., home). | - |
1164 | \value SC_ScrollBarLast Scroll bar last line (i.e., end). | - |
1165 | \value SC_ScrollBarSlider Scroll bar slider handle. | - |
1166 | \value SC_ScrollBarGroove Special sub-control which contains the | - |
1167 | area in which the slider handle may move. | - |
1168 | | - |
1169 | \value SC_SpinBoxUp Spin widget up/increase; see also QSpinBox. | - |
1170 | \value SC_SpinBoxDown Spin widget down/decrease. | - |
1171 | \value SC_SpinBoxFrame Spin widget frame. | - |
1172 | \value SC_SpinBoxEditField Spin widget edit field. | - |
1173 | | - |
1174 | \value SC_ComboBoxEditField Combobox edit field; see also QComboBox. | - |
1175 | \value SC_ComboBoxArrow Combobox arrow button. | - |
1176 | \value SC_ComboBoxFrame Combobox frame. | - |
1177 | \value SC_ComboBoxListBoxPopup The reference rectangle for the combobox popup. | - |
1178 | Used to calculate the position of the popup. | - |
1179 | | - |
1180 | \value SC_SliderGroove Special sub-control which contains the area | - |
1181 | in which the slider handle may move. | - |
1182 | \value SC_SliderHandle Slider handle. | - |
1183 | \value SC_SliderTickmarks Slider tickmarks. | - |
1184 | | - |
1185 | \value SC_ToolButton Tool button (see also QToolButton). | - |
1186 | \value SC_ToolButtonMenu Sub-control for opening a popup menu in a | - |
1187 | tool button. | - |
1188 | | - |
1189 | \value SC_TitleBarSysMenu System menu button (i.e., restore, close, etc.). | - |
1190 | \value SC_TitleBarMinButton Minimize button. | - |
1191 | \value SC_TitleBarMaxButton Maximize button. | - |
1192 | \value SC_TitleBarCloseButton Close button. | - |
1193 | \value SC_TitleBarLabel Window title label. | - |
1194 | \value SC_TitleBarNormalButton Normal (restore) button. | - |
1195 | \value SC_TitleBarShadeButton Shade button. | - |
1196 | \value SC_TitleBarUnshadeButton Unshade button. | - |
1197 | \value SC_TitleBarContextHelpButton Context Help button. | - |
1198 | | - |
1199 | \value SC_DialHandle The handle of the dial (i.e. what you use to control the dial). | - |
1200 | \value SC_DialGroove The groove for the dial. | - |
1201 | \value SC_DialTickmarks The tickmarks for the dial. | - |
1202 | | - |
1203 | \value SC_GroupBoxFrame The frame of a group box. | - |
1204 | \value SC_GroupBoxLabel The title of a group box. | - |
1205 | \value SC_GroupBoxCheckBox The optional check box of a group box. | - |
1206 | \value SC_GroupBoxContents The group box contents. | - |
1207 | | - |
1208 | \value SC_MdiNormalButton The normal button for a MDI | - |
1209 | subwindow in the menu bar. | - |
1210 | \value SC_MdiMinButton The minimize button for a MDI | - |
1211 | subwindow in the menu bar. | - |
1212 | \value SC_MdiCloseButton The close button for a MDI subwindow | - |
1213 | in the menu bar. | - |
1214 | | - |
1215 | \value SC_All Special value that matches all sub-controls. | - |
1216 | \omitvalue SC_CustomBase | - |
1217 | | - |
1218 | \sa ComplexControl | - |
1219 | */ | - |
1220 | | - |
1221 | /*! | - |
1222 | \fn void QStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const | - |
1223 | | - |
1224 | Draws the given \a control using the provided \a painter with the | - |
1225 | style options specified by \a option. | - |
1226 | | - |
1227 | The \a widget argument is optional and can be used as aid in | - |
1228 | drawing the control. | - |
1229 | | - |
1230 | The \a option parameter is a pointer to a QStyleOptionComplex | - |
1231 | object that can be cast to the correct subclass using the | - |
1232 | qstyleoption_cast() function. Note that the \c rect member of the | - |
1233 | specified \a option must be in logical | - |
1234 | coordinates. Reimplementations of this function should use | - |
1235 | visualRect() to change the logical coordinates into screen | - |
1236 | coordinates before calling the drawPrimitive() or drawControl() | - |
1237 | function. | - |
1238 | | - |
1239 | The table below is listing the complex control elements and their | - |
1240 | associated style option subclass. The style options contain all | - |
1241 | the parameters required to draw the controls, including | - |
1242 | QStyleOption::state which holds the \l {QStyle::StateFlag}{style | - |
1243 | flags} that are used when drawing. The table also describes which | - |
1244 | flags that are set when casting the given \a option to the | - |
1245 | appropriate subclass. | - |
1246 | | - |
1247 | \table | - |
1248 | \header \li Complex Control \li QStyleOptionComplex Subclass \li Style Flag \li Remark | - |
1249 | \row \li{1,2} \l{CC_SpinBox} \li{1,2} \l QStyleOptionSpinBox | - |
1250 | \li \l State_Enabled \li Set if the spin box is enabled. | - |
1251 | \row \li \l State_HasFocus \li Set if the spin box has input focus. | - |
1252 | | - |
1253 | \row \li{1,2} \l {CC_ComboBox} \li{1,2} \l QStyleOptionComboBox | - |
1254 | \li \l State_Enabled \li Set if the combobox is enabled. | - |
1255 | \row \li \l State_HasFocus \li Set if the combobox has input focus. | - |
1256 | | - |
1257 | \row \li{1,2} \l {CC_ScrollBar} \li{1,2} \l QStyleOptionSlider | - |
1258 | \li \l State_Enabled \li Set if the scroll bar is enabled. | - |
1259 | \row \li \l State_HasFocus \li Set if the scroll bar has input focus. | - |
1260 | | - |
1261 | \row \li{1,2} \l {CC_Slider} \li{1,2} \l QStyleOptionSlider | - |
1262 | \li \l State_Enabled \li Set if the slider is enabled. | - |
1263 | \row \li \l State_HasFocus \li Set if the slider has input focus. | - |
1264 | | - |
1265 | \row \li{1,2} \l {CC_Dial} \li{1,2} \l QStyleOptionSlider | - |
1266 | \li \l State_Enabled \li Set if the dial is enabled. | - |
1267 | \row \li \l State_HasFocus \li Set if the dial has input focus. | - |
1268 | | - |
1269 | \row \li{1,6} \l {CC_ToolButton} \li{1,6} \l QStyleOptionToolButton | - |
1270 | \li \l State_Enabled \li Set if the tool button is enabled. | - |
1271 | \row \li \l State_HasFocus \li Set if the tool button has input focus. | - |
1272 | \row \li \l State_DownArrow \li Set if the tool button is down (i.e., a mouse | - |
1273 | button or the space bar is pressed). | - |
1274 | \row \li \l State_On \li Set if the tool button is a toggle button | - |
1275 | and is toggled on. | - |
1276 | \row \li \l State_AutoRaise \li Set if the tool button has auto-raise enabled. | - |
1277 | \row \li \l State_Raised \li Set if the button is not down, not on, and doesn't | - |
1278 | contain the mouse when auto-raise is enabled. | - |
1279 | | - |
1280 | \row \li \l{CC_TitleBar} \li \l QStyleOptionTitleBar | - |
1281 | \li \l State_Enabled \li Set if the title bar is enabled. | - |
1282 | | - |
1283 | \endtable | - |
1284 | | - |
1285 | \sa drawPrimitive(), drawControl() | - |
1286 | */ | - |
1287 | | - |
1288 | | - |
1289 | /*! | - |
1290 | \fn QRect QStyle::subControlRect(ComplexControl control, | - |
1291 | const QStyleOptionComplex *option, SubControl subControl, | - |
1292 | const QWidget *widget) const = 0 | - |
1293 | | - |
1294 | Returns the rectangle containing the specified \a subControl of | - |
1295 | the given complex \a control (with the style specified by \a | - |
1296 | option). The rectangle is defined in screen coordinates. | - |
1297 | | - |
1298 | The \a option argument is a pointer to QStyleOptionComplex or | - |
1299 | one of its subclasses, and can be cast to the appropriate type | - |
1300 | using the qstyleoption_cast() function. See drawComplexControl() | - |
1301 | for details. The \a widget is optional and can contain additional | - |
1302 | information for the function. | - |
1303 | | - |
1304 | \sa drawComplexControl() | - |
1305 | */ | - |
1306 | | - |
1307 | /*! | - |
1308 | \fn QStyle::SubControl QStyle::hitTestComplexControl(ComplexControl control, | - |
1309 | const QStyleOptionComplex *option, const QPoint &position, | - |
1310 | const QWidget *widget) const = 0 | - |
1311 | | - |
1312 | Returns the sub control at the given \a position in the given | - |
1313 | complex \a control (with the style options specified by \a | - |
1314 | option). | - |
1315 | | - |
1316 | Note that the \a position is expressed in screen coordinates. | - |
1317 | | - |
1318 | The \a option argument is a pointer to a QStyleOptionComplex | - |
1319 | object (or one of its subclasses). The object can be cast to the | - |
1320 | appropriate type using the qstyleoption_cast() function. See | - |
1321 | drawComplexControl() for details. The \a widget argument is | - |
1322 | optional and can contain additional information for the function. | - |
1323 | | - |
1324 | \sa drawComplexControl(), subControlRect() | - |
1325 | */ | - |
1326 | | - |
1327 | /*! | - |
1328 | \enum QStyle::PixelMetric | - |
1329 | | - |
1330 | This enum describes the various available pixel metrics. A pixel | - |
1331 | metric is a style dependent size represented by a single pixel | - |
1332 | value. | - |
1333 | | - |
1334 | \value PM_ButtonMargin Amount of whitespace between push button | - |
1335 | labels and the frame. | - |
1336 | \value PM_DockWidgetTitleBarButtonMargin Amount of whitespace between dock widget's | - |
1337 | title bar button labels and the frame. | - |
1338 | \value PM_ButtonDefaultIndicator Width of the default-button indicator frame. | - |
1339 | \value PM_MenuButtonIndicator Width of the menu button indicator | - |
1340 | proportional to the widget height. | - |
1341 | \value PM_ButtonShiftHorizontal Horizontal contents shift of a | - |
1342 | button when the button is down. | - |
1343 | \value PM_ButtonShiftVertical Vertical contents shift of a button when the | - |
1344 | button is down. | - |
1345 | | - |
1346 | \value PM_DefaultFrameWidth Default frame width (usually 2). | - |
1347 | \value PM_SpinBoxFrameWidth Frame width of a spin box, defaults to PM_DefaultFrameWidth. | - |
1348 | \value PM_ComboBoxFrameWidth Frame width of a combo box, defaults to PM_DefaultFrameWidth. | - |
1349 | | - |
1350 | \value PM_MDIFrameWidth Obsolete. Use PM_MdiSubWindowFrameWidth instead. | - |
1351 | \value PM_MdiSubWindowFrameWidth Frame width of an MDI window. | - |
1352 | \value PM_MDIMinimizedWidth Obsolete. Use PM_MdiSubWindowMinimizedWidth instead. | - |
1353 | \value PM_MdiSubWindowMinimizedWidth Width of a minimized MDI window. | - |
1354 | | - |
1355 | \value PM_LayoutLeftMargin Default \l{QLayout::setContentsMargins()}{left margin} for a | - |
1356 | QLayout. | - |
1357 | \value PM_LayoutTopMargin Default \l{QLayout::setContentsMargins()}{top margin} for a QLayout. | - |
1358 | \value PM_LayoutRightMargin Default \l{QLayout::setContentsMargins()}{right margin} for a | - |
1359 | QLayout. | - |
1360 | \value PM_LayoutBottomMargin Default \l{QLayout::setContentsMargins()}{bottom margin} for a | - |
1361 | QLayout. | - |
1362 | \value PM_LayoutHorizontalSpacing Default \l{QLayout::spacing}{horizontal spacing} for a | - |
1363 | QLayout. | - |
1364 | \value PM_LayoutVerticalSpacing Default \l{QLayout::spacing}{vertical spacing} for a QLayout. | - |
1365 | | - |
1366 | \value PM_MaximumDragDistance The maximum allowed distance between | - |
1367 | the mouse and a scrollbar when dragging. Exceeding the specified | - |
1368 | distance will cause the slider to jump back to the original | - |
1369 | position; a value of -1 disables this behavior. | - |
1370 | | - |
1371 | \value PM_ScrollBarExtent Width of a vertical scroll bar and the | - |
1372 | height of a horizontal scroll bar. | - |
1373 | \value PM_ScrollBarSliderMin The minimum height of a vertical | - |
1374 | scroll bar's slider and the minimum width of a horizontal | - |
1375 | scroll bar's slider. | - |
1376 | | - |
1377 | \value PM_SliderThickness Total slider thickness. | - |
1378 | \value PM_SliderControlThickness Thickness of the slider handle. | - |
1379 | \value PM_SliderLength Length of the slider. | - |
1380 | \value PM_SliderTickmarkOffset The offset between the tickmarks | - |
1381 | and the slider. | - |
1382 | \value PM_SliderSpaceAvailable The available space for the slider to move. | - |
1383 | | - |
1384 | \value PM_DockWidgetSeparatorExtent Width of a separator in a | - |
1385 | horizontal dock window and the height of a separator in a | - |
1386 | vertical dock window. | - |
1387 | \value PM_DockWidgetHandleExtent Width of the handle in a | - |
1388 | horizontal dock window and the height of the handle in a | - |
1389 | vertical dock window. | - |
1390 | \value PM_DockWidgetFrameWidth Frame width of a dock window. | - |
1391 | \value PM_DockWidgetTitleMargin Margin of the dock window title. | - |
1392 | | - |
1393 | \value PM_MenuBarPanelWidth Frame width of a menu bar, defaults to PM_DefaultFrameWidth. | - |
1394 | \value PM_MenuBarItemSpacing Spacing between menu bar items. | - |
1395 | \value PM_MenuBarHMargin Spacing between menu bar items and left/right of bar. | - |
1396 | \value PM_MenuBarVMargin Spacing between menu bar items and top/bottom of bar. | - |
1397 | | - |
1398 | \value PM_ToolBarFrameWidth Width of the frame around toolbars. | - |
1399 | \value PM_ToolBarHandleExtent Width of a toolbar handle in a | - |
1400 | horizontal toolbar and the height of the handle in a vertical toolbar. | - |
1401 | \value PM_ToolBarItemMargin Spacing between the toolbar frame and the items. | - |
1402 | \value PM_ToolBarItemSpacing Spacing between toolbar items. | - |
1403 | \value PM_ToolBarSeparatorExtent Width of a toolbar separator in a | - |
1404 | horizontal toolbar and the height of a separator in a vertical toolbar. | - |
1405 | \value PM_ToolBarExtensionExtent Width of a toolbar extension | - |
1406 | button in a horizontal toolbar and the height of the button in a | - |
1407 | vertical toolbar. | - |
1408 | | - |
1409 | \value PM_TabBarTabOverlap Number of pixels the tabs should overlap. | - |
1410 | (Currently only used in styles, not inside of QTabBar) | - |
1411 | \value PM_TabBarTabHSpace Extra space added to the tab width. | - |
1412 | \value PM_TabBarTabVSpace Extra space added to the tab height. | - |
1413 | \value PM_TabBarBaseHeight Height of the area between the tab bar | - |
1414 | and the tab pages. | - |
1415 | \value PM_TabBarBaseOverlap Number of pixels the tab bar overlaps | - |
1416 | the tab bar base. | - |
1417 | \value PM_TabBarScrollButtonWidth | - |
1418 | \value PM_TabBarTabShiftHorizontal Horizontal pixel shift when a | - |
1419 | tab is selected. | - |
1420 | \value PM_TabBarTabShiftVertical Vertical pixel shift when a | - |
1421 | tab is selected. | - |
1422 | | - |
1423 | \value PM_ProgressBarChunkWidth Width of a chunk in a progress bar indicator. | - |
1424 | | - |
1425 | \value PM_SplitterWidth Width of a splitter. | - |
1426 | | - |
1427 | \value PM_TitleBarHeight Height of the title bar. | - |
1428 | | - |
1429 | \value PM_IndicatorWidth Width of a check box indicator. | - |
1430 | \value PM_IndicatorHeight Height of a checkbox indicator. | - |
1431 | \value PM_ExclusiveIndicatorWidth Width of a radio button indicator. | - |
1432 | \value PM_ExclusiveIndicatorHeight Height of a radio button indicator. | - |
1433 | | - |
1434 | \value PM_MenuPanelWidth Border width (applied on all sides) for a QMenu. | - |
1435 | \value PM_MenuHMargin Additional border (used on left and right) for a QMenu. | - |
1436 | \value PM_MenuVMargin Additional border (used for bottom and top) for a QMenu. | - |
1437 | \value PM_MenuScrollerHeight Height of the scroller area in a QMenu. | - |
1438 | \value PM_MenuTearoffHeight Height of a tear off area in a QMenu. | - |
1439 | \value PM_MenuDesktopFrameWidth The frame width for the menu on the desktop. | - |
1440 | | - |
1441 | \omitvalue PM_DialogButtonsSeparator | - |
1442 | \omitvalue PM_DialogButtonsButtonWidth | - |
1443 | \omitvalue PM_DialogButtonsButtonHeight | - |
1444 | | - |
1445 | \value PM_HeaderMarkSize The size of the sort indicator in a header. | - |
1446 | \value PM_HeaderGripMargin The size of the resize grip in a header. | - |
1447 | \value PM_HeaderMargin The size of the margin between the sort indicator and the text. | - |
1448 | \value PM_SpinBoxSliderHeight The height of the optional spin box slider. | - |
1449 | | - |
1450 | \value PM_ToolBarIconSize Default tool bar icon size | - |
1451 | \value PM_SmallIconSize Default small icon size | - |
1452 | \value PM_LargeIconSize Default large icon size | - |
1453 | | - |
1454 | \value PM_FocusFrameHMargin Horizontal margin that the focus frame will outset the widget by. | - |
1455 | \value PM_FocusFrameVMargin Vertical margin that the focus frame will outset the widget by. | - |
1456 | \value PM_IconViewIconSize The default size for icons in an icon view. | - |
1457 | \value PM_ListViewIconSize The default size for icons in a list view. | - |
1458 | | - |
1459 | \value PM_ToolTipLabelFrameWidth The frame width for a tool tip label. | - |
1460 | \value PM_CheckBoxLabelSpacing The spacing between a check box indicator and its label. | - |
1461 | \value PM_RadioButtonLabelSpacing The spacing between a radio button indicator and its label. | - |
1462 | \value PM_TabBarIconSize The default icon size for a tab bar. | - |
1463 | \value PM_SizeGripSize The size of a size grip. | - |
1464 | \value PM_MessageBoxIconSize The size of the standard icons in a message box | - |
1465 | \value PM_ButtonIconSize The default size of button icons | - |
1466 | \value PM_TextCursorWidth The width of the cursor in a line edit or text edit | - |
1467 | \value PM_TabBar_ScrollButtonOverlap The distance between the left and right buttons in a tab bar. | - |
1468 | | - |
1469 | \value PM_TabCloseIndicatorWidth The default width of a close button on a tab in a tab bar. | - |
1470 | \value PM_TabCloseIndicatorHeight The default height of a close button on a tab in a tab bar. | - |
1471 | | - |
1472 | \value PM_CustomBase Base value for custom pixel metrics. Custom | - |
1473 | values must be greater than this value. | - |
1474 | | - |
1475 | The following values are obsolete: | - |
1476 | | - |
1477 | \value PM_DefaultTopLevelMargin Use PM_LayoutLeftMargin, | - |
1478 | PM_LayoutTopMargin, | - |
1479 | PM_LayoutRightMargin, and | - |
1480 | PM_LayoutBottomMargin instead. | - |
1481 | \value PM_DefaultChildMargin Use PM_LayoutLeftMargin, | - |
1482 | PM_LayoutTopMargin, | - |
1483 | PM_LayoutRightMargin, and | - |
1484 | PM_LayoutBottomMargin instead. | - |
1485 | \value PM_DefaultLayoutSpacing Use PM_LayoutHorizontalSpacing | - |
1486 | and PM_LayoutVerticalSpacing | - |
1487 | instead. | - |
1488 | | - |
1489 | \value PM_ScrollView_ScrollBarSpacing Distance between frame and scrollbar | - |
1490 | with SH_ScrollView_FrameOnlyAroundContents set. | - |
1491 | \value PM_ScrollView_ScrollBarOverlap Overlap between scroll bars and scroll content | - |
1492 | | - |
1493 | \value PM_SubMenuOverlap The horizontal overlap between a submenu and its parent. | - |
1494 | | - |
1495 | | - |
1496 | \sa pixelMetric() | - |
1497 | */ | - |
1498 | | - |
1499 | /*! | - |
1500 | \fn int QStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const; | - |
1501 | | - |
1502 | Returns the value of the given pixel \a metric. | - |
1503 | | - |
1504 | The specified \a option and \a widget can be used for calculating | - |
1505 | the metric. In general, the \a widget argument is not used. The \a | - |
1506 | option can be cast to the appropriate type using the | - |
1507 | qstyleoption_cast() function. Note that the \a option may be zero | - |
1508 | even for PixelMetrics that can make use of it. See the table below | - |
1509 | for the appropriate \a option casts: | - |
1510 | | - |
1511 | \table | - |
1512 | \header \li Pixel Metric \li QStyleOption Subclass | - |
1513 | \row \li \l PM_SliderControlThickness \li \l QStyleOptionSlider | - |
1514 | \row \li \l PM_SliderLength \li \l QStyleOptionSlider | - |
1515 | \row \li \l PM_SliderTickmarkOffset \li \l QStyleOptionSlider | - |
1516 | \row \li \l PM_SliderSpaceAvailable \li \l QStyleOptionSlider | - |
1517 | \row \li \l PM_ScrollBarExtent \li \l QStyleOptionSlider | - |
1518 | \row \li \l PM_TabBarTabOverlap \li \l QStyleOptionTab | - |
1519 | \row \li \l PM_TabBarTabHSpace \li \l QStyleOptionTab | - |
1520 | \row \li \l PM_TabBarTabVSpace \li \l QStyleOptionTab | - |
1521 | \row \li \l PM_TabBarBaseHeight \li \l QStyleOptionTab | - |
1522 | \row \li \l PM_TabBarBaseOverlap \li \l QStyleOptionTab | - |
1523 | \endtable | - |
1524 | | - |
1525 | Some pixel metrics are called from widgets and some are only called | - |
1526 | internally by the style. If the metric is not called by a widget, it is the | - |
1527 | discretion of the style author to make use of it. For some styles, this | - |
1528 | may not be appropriate. | - |
1529 | */ | - |
1530 | | - |
1531 | /*! | - |
1532 | \enum QStyle::ContentsType | - |
1533 | | - |
1534 | This enum describes the available contents types. These are used to | - |
1535 | calculate sizes for the contents of various widgets. | - |
1536 | | - |
1537 | \value CT_CheckBox A check box, like QCheckBox. | - |
1538 | \value CT_ComboBox A combo box, like QComboBox. | - |
1539 | \omitvalue CT_DialogButtons | - |
1540 | \value CT_HeaderSection A header section, like QHeader. | - |
1541 | \value CT_LineEdit A line edit, like QLineEdit. | - |
1542 | \value CT_Menu A menu, like QMenu. | - |
1543 | \value CT_MenuBar A menu bar, like QMenuBar. | - |
1544 | \value CT_MenuBarItem A menu bar item, like the buttons in a QMenuBar. | - |
1545 | \value CT_MenuItem A menu item, like QMenuItem. | - |
1546 | \value CT_ProgressBar A progress bar, like QProgressBar. | - |
1547 | \value CT_PushButton A push button, like QPushButton. | - |
1548 | \value CT_RadioButton A radio button, like QRadioButton. | - |
1549 | \value CT_SizeGrip A size grip, like QSizeGrip. | - |
1550 | \value CT_Slider A slider, like QSlider. | - |
1551 | \value CT_ScrollBar A scroll bar, like QScrollBar. | - |
1552 | \value CT_SpinBox A spin box, like QSpinBox. | - |
1553 | \value CT_Splitter A splitter, like QSplitter. | - |
1554 | \value CT_TabBarTab A tab on a tab bar, like QTabBar. | - |
1555 | \value CT_TabWidget A tab widget, like QTabWidget. | - |
1556 | \value CT_ToolButton A tool button, like QToolButton. | - |
1557 | \value CT_GroupBox A group box, like QGroupBox. | - |
1558 | \value CT_ItemViewItem An item inside an item view. | - |
1559 | | - |
1560 | \value CT_CustomBase Base value for custom contents types. | - |
1561 | Custom values must be greater than this value. | - |
1562 | | - |
1563 | \value CT_MdiControls The minimize, normal, and close button | - |
1564 | in the menu bar for a maximized MDI | - |
1565 | subwindow. | - |
1566 | | - |
1567 | \sa sizeFromContents() | - |
1568 | */ | - |
1569 | | - |
1570 | /*! | - |
1571 | \fn QSize QStyle::sizeFromContents(ContentsType type, const QStyleOption *option, \ | - |
1572 | const QSize &contentsSize, const QWidget *widget) const | - |
1573 | | - |
1574 | Returns the size of the element described by the specified | - |
1575 | \a option and \a type, based on the provided \a contentsSize. | - |
1576 | | - |
1577 | The \a option argument is a pointer to a QStyleOption or one of | - |
1578 | its subclasses. The \a option can be cast to the appropriate type | - |
1579 | using the qstyleoption_cast() function. The \a widget is an | - |
1580 | optional argument and can contain extra information used for | - |
1581 | calculating the size. | - |
1582 | | - |
1583 | See the table below for the appropriate \a option casts: | - |
1584 | | - |
1585 | \table | - |
1586 | \header \li Contents Type \li QStyleOption Subclass | - |
1587 | \row \li \l CT_PushButton \li \l QStyleOptionButton | - |
1588 | \row \li \l CT_CheckBox \li \l QStyleOptionButton | - |
1589 | \row \li \l CT_RadioButton \li \l QStyleOptionButton | - |
1590 | \row \li \l CT_ToolButton \li \l QStyleOptionToolButton | - |
1591 | \row \li \l CT_ComboBox \li \l QStyleOptionComboBox | - |
1592 | \row \li \l CT_Splitter \li \l QStyleOption | - |
1593 | \row \li \l CT_ProgressBar \li \l QStyleOptionProgressBar | - |
1594 | \row \li \l CT_MenuItem \li \l QStyleOptionMenuItem | - |
1595 | \endtable | - |
1596 | | - |
1597 | \sa ContentsType, QStyleOption | - |
1598 | */ | - |
1599 | | - |
1600 | /*! | - |
1601 | \enum QStyle::RequestSoftwareInputPanel | - |
1602 | | - |
1603 | This enum describes under what circumstances a software input panel will be | - |
1604 | requested by input capable widgets. | - |
1605 | | - |
1606 | \value RSIP_OnMouseClickAndAlreadyFocused Requests an input panel if the user | - |
1607 | clicks on the widget, but only if it is already focused. | - |
1608 | \value RSIP_OnMouseClick Requests an input panel if the user clicks on the | - |
1609 | widget. | - |
1610 | | - |
1611 | \sa QInputMethod | - |
1612 | */ | - |
1613 | | - |
1614 | /*! | - |
1615 | \enum QStyle::StyleHint | - |
1616 | | - |
1617 | This enum describes the available style hints. A style hint is a general look | - |
1618 | and/or feel hint. | - |
1619 | | - |
1620 | \value SH_EtchDisabledText Disabled text is "etched" as it is on Windows. | - |
1621 | | - |
1622 | \value SH_DitherDisabledText Disabled text is dithered as it is on Motif. | - |
1623 | | - |
1624 | \value SH_ScrollBar_ContextMenu Whether or not a scroll bar has a context menu. | - |
1625 | | - |
1626 | \value SH_ScrollBar_MiddleClickAbsolutePosition A boolean value. | - |
1627 | If true, middle clicking on a scroll bar causes the slider to | - |
1628 | jump to that position. If false, middle clicking is | - |
1629 | ignored. | - |
1630 | | - |
1631 | \value SH_ScrollBar_LeftClickAbsolutePosition A boolean value. | - |
1632 | If true, left clicking on a scroll bar causes the slider to | - |
1633 | jump to that position. If false, left clicking will | - |
1634 | behave as appropriate for each control. | - |
1635 | | - |
1636 | \value SH_ScrollBar_ScrollWhenPointerLeavesControl A boolean | - |
1637 | value. If true, when clicking a scroll bar SubControl, holding | - |
1638 | the mouse button down and moving the pointer outside the | - |
1639 | SubControl, the scroll bar continues to scroll. If false, the | - |
1640 | scollbar stops scrolling when the pointer leaves the | - |
1641 | SubControl. | - |
1642 | | - |
1643 | \value SH_ScrollBar_RollBetweenButtons A boolean value. | - |
1644 | If true, when clicking a scroll bar button (SC_ScrollBarAddLine or | - |
1645 | SC_ScrollBarSubLine) and dragging over to the opposite button (rolling) | - |
1646 | will press the new button and release the old one. When it is false, the | - |
1647 | original button is released and nothing happens (like a push button). | - |
1648 | | - |
1649 | \value SH_TabBar_Alignment The alignment for tabs in a | - |
1650 | QTabWidget. Possible values are Qt::AlignLeft, | - |
1651 | Qt::AlignCenter and 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 Qt::Left or Qt::Right. | - |
1656 | | - |
1657 | \value SH_Slider_SnapToValue Sliders snap to values while moving, | - |
1658 | as they do on 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, otherwise right aligned. | - |
1665 | | - |
1666 | \value SH_ProgressDialog_TextLabelAlignment The alignment for text | - |
1667 | labels in progress dialogs; Qt::AlignCenter on Windows, | - |
1668 | Qt::AlignVCenter otherwise. | - |
1669 | | - |
1670 | \value SH_PrintDialog_RightAlignButtons Right align buttons in | - |
1671 | the print dialog, as done on Windows. | - |
1672 | | - |
1673 | \value SH_MainWindow_SpaceBelowMenuBar One or two pixel space between | - |
1674 | the menu bar and the dockarea, as done on 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, as done on Windows. | - |
1679 | | - |
1680 | \value SH_Menu_KeyboardSearch Typing causes a menu to be search | - |
1681 | for relevant items, otherwise only mnemnonic is considered. | - |
1682 | | - |
1683 | \value SH_Menu_AllowActiveAndDisabled Allows disabled menu | - |
1684 | items to be active. | - |
1685 | | - |
1686 | \value SH_Menu_SpaceActivatesItem Pressing the space bar activates | - |
1687 | the item, as done on Motif. | - |
1688 | | - |
1689 | \value SH_Menu_SubMenuPopupDelay The number of milliseconds | - |
1690 | to wait before opening a submenu (256 on Windows, 96 on Motif). | - |
1691 | | - |
1692 | \value SH_Menu_Scrollable Whether popup menus must support scrolling. | - |
1693 | | - |
1694 | \value SH_Menu_SloppySubMenus Whether popupmenu's must support | - |
1695 | sloppy submenu; as implemented on Mac OS. | - |
1696 | | - |
1697 | \value SH_ScrollView_FrameOnlyAroundContents Whether scrollviews | - |
1698 | draw their frame only around contents (like Motif), or around | - |
1699 | contents, scroll bars and corner widgets (like Windows). | - |
1700 | | - |
1701 | \value SH_MenuBar_AltKeyNavigation Menu bars items are navigable | - |
1702 | by pressing Alt, followed by using the arrow keys to select | - |
1703 | the desired item. | - |
1704 | | - |
1705 | \value SH_ComboBox_ListMouseTracking Mouse tracking in combobox | - |
1706 | drop-down lists. | - |
1707 | | - |
1708 | \value SH_Menu_MouseTracking Mouse tracking in popup menus. | - |
1709 | | - |
1710 | \value SH_MenuBar_MouseTracking Mouse tracking in menu bars. | - |
1711 | | - |
1712 | \value SH_Menu_FillScreenWithScroll Whether scrolling popups | - |
1713 | should fill the screen as they are scrolled. | - |
1714 | | - |
1715 | \value SH_Menu_SelectionWrap Whether popups should allow the selections | - |
1716 | to wrap, that is when selection should the next item be the first item. | - |
1717 | | - |
1718 | \value SH_ItemView_ChangeHighlightOnFocus Gray out selected items | - |
1719 | when losing focus. | - |
1720 | | - |
1721 | \value SH_Widget_ShareActivation Turn on sharing activation with | - |
1722 | floating modeless dialogs. | - |
1723 | | - |
1724 | \value SH_TabBar_SelectMouseType Which type of mouse event should | - |
1725 | cause a tab to be selected. | - |
1726 | | - |
1727 | \value SH_ListViewExpand_SelectMouseType Which type of mouse event should | - |
1728 | cause a list view expansion to be selected. | - |
1729 | | - |
1730 | \value SH_TabBar_PreferNoArrows Whether a tab bar should suggest a size | - |
1731 | to prevent scoll arrows. | - |
1732 | | - |
1733 | \value SH_ComboBox_Popup Allows popups as a combobox drop-down | - |
1734 | menu. | - |
1735 | | - |
1736 | \value SH_Workspace_FillSpaceOnMaximize The workspace should | - |
1737 | maximize the client area. | - |
1738 | | - |
1739 | \value SH_TitleBar_NoBorder The title bar has no border. | - |
1740 | | - |
1741 | \value SH_ScrollBar_StopMouseOverSlider Obsolete. Use | - |
1742 | SH_Slider_StopMouseOverSlider instead. | - |
1743 | | - |
1744 | \value SH_Slider_StopMouseOverSlider Stops auto-repeat when | - |
1745 | the slider reaches the mouse position. | - |
1746 | | - |
1747 | \value SH_BlinkCursorWhenTextSelected Whether cursor should blink | - |
1748 | when text is selected. | - |
1749 | | - |
1750 | \value SH_RichText_FullWidthSelection Whether richtext selections | - |
1751 | should extend to the full width of the document. | - |
1752 | | - |
1753 | \value SH_GroupBox_TextLabelVerticalAlignment How to vertically align a | - |
1754 | group box's text label. | - |
1755 | | - |
1756 | \value SH_GroupBox_TextLabelColor How to paint a group box's text label. | - |
1757 | | - |
1758 | \value SH_DialogButtons_DefaultButton Which button gets the | - |
1759 | default status in a dialog's button widget. | - |
1760 | | - |
1761 | \value SH_ToolBox_SelectedPageTitleBold Boldness of the selected | - |
1762 | page title in a QToolBox. | - |
1763 | | - |
1764 | \value SH_LineEdit_PasswordCharacter The Unicode character to be | - |
1765 | used for passwords. | - |
1766 | | - |
1767 | \value SH_Table_GridLineColor The RGB value of the grid for a table. | - |
1768 | | - |
1769 | \value SH_UnderlineShortcut Whether shortcuts are underlined. | - |
1770 | | - |
1771 | \value SH_SpellCheckUnderlineStyle A | - |
1772 | QTextCharFormat::UnderlineStyle value that specifies the way | - |
1773 | misspelled words should be underlined. | - |
1774 | | - |
1775 | \value SH_SpinBox_AnimateButton Animate a click when up or down is | - |
1776 | pressed in a spin box. | - |
1777 | \value SH_SpinBox_KeyPressAutoRepeatRate Auto-repeat interval for | - |
1778 | spinbox key presses. | - |
1779 | \value SH_SpinBox_ClickAutoRepeatRate Auto-repeat interval for | - |
1780 | spinbox mouse clicks. | - |
1781 | \value SH_SpinBox_ClickAutoRepeatThreshold Auto-repeat threshold for | - |
1782 | spinbox mouse clicks. | - |
1783 | \value SH_ToolTipLabel_Opacity An integer indicating the opacity for | - |
1784 | the tip label, 0 is completely transparent, 255 is completely | - |
1785 | opaque. | - |
1786 | \value SH_DrawMenuBarSeparator Indicates whether or not the menu bar draws separators. | - |
1787 | \value SH_TitleBar_ModifyNotification Indicates if the title bar should show | - |
1788 | a '*' for windows that are modified. | - |
1789 | | - |
1790 | \value SH_Button_FocusPolicy The default focus policy for buttons. | - |
1791 | | - |
1792 | \value SH_CustomBase Base value for custom style hints. | - |
1793 | Custom values must be greater than this value. | - |
1794 | | - |
1795 | \value SH_MessageBox_UseBorderForButtonSpacing A boolean indicating what the to | - |
1796 | use the border of the buttons (computed as half the button height) for the spacing | - |
1797 | of the button in a message box. | - |
1798 | | - |
1799 | \value SH_MessageBox_CenterButtons A boolean indicating whether the buttons in the | - |
1800 | message box should be centered or not (see QDialogButtonBox::setCentered()). | - |
1801 | | - |
1802 | \value SH_MessageBox_TextInteractionFlags A boolean indicating if | - |
1803 | the text in a message box should allow user interfactions (e.g. | - |
1804 | selection) or not. | - |
1805 | | - |
1806 | \value SH_TitleBar_AutoRaise A boolean indicating whether | - |
1807 | controls on a title bar ought to update when the mouse is over them. | - |
1808 | | - |
1809 | \value SH_ToolButton_PopupDelay An int indicating the popup delay in milliseconds | - |
1810 | for menus attached to tool buttons. | - |
1811 | | - |
1812 | \value SH_FocusFrame_Mask The mask of the focus frame. | - |
1813 | | - |
1814 | \value SH_RubberBand_Mask The mask of the rubber band. | - |
1815 | | - |
1816 | \value SH_WindowFrame_Mask The mask of the window frame. | - |
1817 | | - |
1818 | \value SH_SpinControls_DisableOnBounds Determines if the spin controls will shown | - |
1819 | as disabled when reaching the spin range boundary. | - |
1820 | | - |
1821 | \value SH_Dial_BackgroundRole Defines the style's preferred | - |
1822 | background role (as QPalette::ColorRole) for a dial widget. | - |
1823 | | - |
1824 | \value SH_ComboBox_LayoutDirection The layout direction for the | - |
1825 | combo box. By default it should be the same as indicated by the | - |
1826 | QStyleOption::direction variable. | - |
1827 | | - |
1828 | \value SH_ItemView_EllipsisLocation The location where ellipses should be | - |
1829 | added for item text that is too long to fit in an view item. | - |
1830 | | - |
1831 | \value SH_ItemView_ShowDecorationSelected When an item in an item | - |
1832 | view is selected, also highlight the branch or other decoration. | - |
1833 | | - |
1834 | \value SH_ItemView_ActivateItemOnSingleClick Emit the activated signal | - |
1835 | when the user single clicks on an item in an item in an item view. | - |
1836 | Otherwise the signal is emitted when the user double clicks on an item. | - |
1837 | | - |
1838 | \value SH_Slider_AbsoluteSetButtons Which mouse buttons cause a slider | - |
1839 | to set the value to the position clicked on. | - |
1840 | | - |
1841 | \value SH_Slider_PageSetButtons Which mouse buttons cause a slider | - |
1842 | to page step the value. | - |
1843 | | - |
1844 | \value SH_TabBar_ElideMode The default eliding style for a tab bar. | - |
1845 | | - |
1846 | \value SH_DialogButtonLayout Controls how buttons are laid out in a QDialogButtonBox, returns a QDialogButtonBox::ButtonLayout enum. | - |
1847 | | - |
1848 | \value SH_WizardStyle Controls the look and feel of a QWizard. Returns a QWizard::WizardStyle enum. | - |
1849 | | - |
1850 | \value SH_FormLayoutWrapPolicy Provides a default for how rows are wrapped in a QFormLayout. Returns a QFormLayout::RowWrapPolicy enum. | - |
1851 | \value SH_FormLayoutFieldGrowthPolicy Provides a default for how fields can grow in a QFormLayout. Returns a QFormLayout::FieldGrowthPolicy enum. | - |
1852 | \value SH_FormLayoutFormAlignment Provides a default for how a QFormLayout aligns its contents within the available space. Returns a Qt::Alignment enum. | - |
1853 | \value SH_FormLayoutLabelAlignment Provides a default for how a QFormLayout aligns labels within the available space. Returns a Qt::Alignment enum. | - |
1854 | | - |
1855 | \value SH_ItemView_ArrowKeysNavigateIntoChildren Controls whether the tree view will select the first child when it is exapanded and the right arrow key is pressed. | - |
1856 | \value SH_ComboBox_PopupFrameStyle The frame style used when drawing a combobox popup menu. | - |
1857 | | - |
1858 | \value SH_DialogButtonBox_ButtonsHaveIcons Indicates whether or not StandardButtons in QDialogButtonBox should have icons or not. | - |
1859 | \value SH_ItemView_MovementWithoutUpdatingSelection The item view is able to indicate a current item without changing the selection. | - |
1860 | \value SH_ToolTip_Mask The mask of a tool tip. | - |
1861 | | - |
1862 | \value SH_FocusFrame_AboveWidget The FocusFrame is stacked above the widget that it is "focusing on". | - |
1863 | | - |
1864 | \value SH_TextControl_FocusIndicatorTextCharFormat Specifies the text format used to highlight focused anchors in rich text | - |
1865 | documents displayed for example in QTextBrowser. The format has to be a QTextCharFormat returned in the variant of the | - |
1866 | QStyleHintReturnVariant return value. The QTextFormat::OutlinePen property is used for the outline and QTextFormat::BackgroundBrush | - |
1867 | for the background of the highlighted area. | - |
1868 | | - |
1869 | \value SH_Menu_FlashTriggeredItem Flash triggered item. | - |
1870 | \value SH_Menu_FadeOutOnHide Fade out the menu instead of hiding it immediately. | - |
1871 | | - |
1872 | \value SH_TabWidget_DefaultTabPosition Default position of the tab bar in a tab widget. | - |
1873 | | - |
1874 | \value SH_ToolBar_Movable Determines if the tool bar is movable by default. | - |
1875 | | - |
1876 | \value SH_ItemView_PaintAlternatingRowColorsForEmptyArea Whether QTreeView paints alternating row colors for the area that does not have any items. | - |
1877 | | - |
1878 | \value SH_Menu_Mask The mask for a popup menu. | - |
1879 | | - |
1880 | \value SH_ItemView_DrawDelegateFrame Determines if there should be a frame for a delegate widget. | - |
1881 | | - |
1882 | \value SH_TabBar_CloseButtonPosition Determines the position of the close button on a tab in a tab bar. | - |
1883 | | - |
1884 | \value SH_DockWidget_ButtonsHaveFrame Determines if dockwidget buttons should have frames. Default is true. | - |
1885 | | - |
1886 | \value SH_ToolButtonStyle Determines the default system style for tool buttons that uses Qt::ToolButtonFollowStyle. | - |
1887 | | - |
1888 | \value SH_RequestSoftwareInputPanel Determines when a software input panel should | - |
1889 | be requested by input widgets. Returns an enum of type QStyle::RequestSoftwareInputPanel. | - |
1890 | | - |
1891 | \value SH_ScrollBar_Transient Determines if the style supports transient scroll bars. Transient | - |
1892 | scroll bars appear when the content is scrolled and disappear when they are no longer needed. | - |
1893 | | - |
1894 | \sa styleHint() | - |
1895 | */ | - |
1896 | | - |
1897 | /*! | - |
1898 | \fn int QStyle::styleHint(StyleHint hint, const QStyleOption *option, \ | - |
1899 | const QWidget *widget, QStyleHintReturn *returnData) const | - |
1900 | | - |
1901 | Returns an integer representing the specified style \a hint for | - |
1902 | the given \a widget described by the provided style \a option. | - |
1903 | | - |
1904 | \a returnData is used when the querying widget needs more detailed data than | - |
1905 | the integer that styleHint() returns. See the QStyleHintReturn class | - |
1906 | description for details. | - |
1907 | */ | - |
1908 | | - |
1909 | /*! | - |
1910 | \enum QStyle::StandardPixmap | - |
1911 | | - |
1912 | This enum describes the available standard pixmaps. A standard pixmap is a pixmap that | - |
1913 | can follow some existing GUI style or guideline. | - |
1914 | | - |
1915 | \value SP_TitleBarMinButton Minimize button on title bars (e.g., | - |
1916 | in QMdiSubWindow). | - |
1917 | \value SP_TitleBarMenuButton Menu button on a title bar. | - |
1918 | \value SP_TitleBarMaxButton Maximize button on title bars. | - |
1919 | \value SP_TitleBarCloseButton Close button on title bars. | - |
1920 | \value SP_TitleBarNormalButton Normal (restore) button on title bars. | - |
1921 | \value SP_TitleBarShadeButton Shade button on title bars. | - |
1922 | \value SP_TitleBarUnshadeButton Unshade button on title bars. | - |
1923 | \value SP_TitleBarContextHelpButton The Context help button on title bars. | - |
1924 | \value SP_MessageBoxInformation The "information" icon. | - |
1925 | \value SP_MessageBoxWarning The "warning" icon. | - |
1926 | \value SP_MessageBoxCritical The "critical" icon. | - |
1927 | \value SP_MessageBoxQuestion The "question" icon. | - |
1928 | \value SP_DesktopIcon The "desktop" icon. | - |
1929 | \value SP_TrashIcon The "trash" icon. | - |
1930 | \value SP_ComputerIcon The "My computer" icon. | - |
1931 | \value SP_DriveFDIcon The floppy icon. | - |
1932 | \value SP_DriveHDIcon The harddrive icon. | - |
1933 | \value SP_DriveCDIcon The CD icon. | - |
1934 | \value SP_DriveDVDIcon The DVD icon. | - |
1935 | \value SP_DriveNetIcon The network icon. | - |
1936 | \value SP_DirHomeIcon The home directory icon. | - |
1937 | \value SP_DirOpenIcon The open directory icon. | - |
1938 | \value SP_DirClosedIcon The closed directory icon. | - |
1939 | \value SP_DirIcon The directory icon. | - |
1940 | \value SP_DirLinkIcon The link to directory icon. | - |
1941 | \value SP_DirLinkOpenIcon The link to open directory icon. | - |
1942 | \value SP_FileIcon The file icon. | - |
1943 | \value SP_FileLinkIcon The link to file icon. | - |
1944 | \value SP_FileDialogStart The "start" icon in a file dialog. | - |
1945 | \value SP_FileDialogEnd The "end" icon in a file dialog. | - |
1946 | \value SP_FileDialogToParent The "parent directory" icon in a file dialog. | - |
1947 | \value SP_FileDialogNewFolder The "create new folder" icon in a file dialog. | - |
1948 | \value SP_FileDialogDetailedView The detailed view icon in a file dialog. | - |
1949 | \value SP_FileDialogInfoView The file info icon in a file dialog. | - |
1950 | \value SP_FileDialogContentsView The contents view icon in a file dialog. | - |
1951 | \value SP_FileDialogListView The list view icon in a file dialog. | - |
1952 | \value SP_FileDialogBack The back arrow in a file dialog. | - |
1953 | \value SP_DockWidgetCloseButton Close button on dock windows (see also QDockWidget). | - |
1954 | \value SP_ToolBarHorizontalExtensionButton Extension button for horizontal toolbars. | - |
1955 | \value SP_ToolBarVerticalExtensionButton Extension button for vertical toolbars. | - |
1956 | \value SP_DialogOkButton Icon for a standard OK button in a QDialogButtonBox. | - |
1957 | \value SP_DialogCancelButton Icon for a standard Cancel button in a QDialogButtonBox. | - |
1958 | \value SP_DialogHelpButton Icon for a standard Help button in a QDialogButtonBox. | - |
1959 | \value SP_DialogOpenButton Icon for a standard Open button in a QDialogButtonBox. | - |
1960 | \value SP_DialogSaveButton Icon for a standard Save button in a QDialogButtonBox. | - |
1961 | \value SP_DialogCloseButton Icon for a standard Close button in a QDialogButtonBox. | - |
1962 | \value SP_DialogApplyButton Icon for a standard Apply button in a QDialogButtonBox. | - |
1963 | \value SP_DialogResetButton Icon for a standard Reset button in a QDialogButtonBox. | - |
1964 | \value SP_DialogDiscardButton Icon for a standard Discard button in a QDialogButtonBox. | - |
1965 | \value SP_DialogYesButton Icon for a standard Yes button in a QDialogButtonBox. | - |
1966 | \value SP_DialogNoButton Icon for a standard No button in a QDialogButtonBox. | - |
1967 | \value SP_ArrowUp Icon arrow pointing up. | - |
1968 | \value SP_ArrowDown Icon arrow pointing down. | - |
1969 | \value SP_ArrowLeft Icon arrow pointing left. | - |
1970 | \value SP_ArrowRight Icon arrow pointing right. | - |
1971 | \value SP_ArrowBack Equivalent to SP_ArrowLeft when the current layout direction is Qt::LeftToRight, otherwise SP_ArrowRight. | - |
1972 | \value SP_ArrowForward Equivalent to SP_ArrowRight when the current layout direction is Qt::LeftToRight, otherwise SP_ArrowLeft. | - |
1973 | \value SP_CommandLink Icon used to indicate a Vista style command link glyph. | - |
1974 | \value SP_VistaShield Icon used to indicate UAC prompts on Windows Vista. This will return a null pixmap or icon on all other platforms. | - |
1975 | \value SP_BrowserReload Icon indicating that the current page should be reloaded. | - |
1976 | \value SP_BrowserStop Icon indicating that the page loading should stop. | - |
1977 | \value SP_MediaPlay Icon indicating that media should begin playback. | - |
1978 | \value SP_MediaStop Icon indicating that media should stop playback. | - |
1979 | \value SP_MediaPause Icon indicating that media should pause playback. | - |
1980 | \value SP_MediaSkipForward Icon indicating that media should skip forward. | - |
1981 | \value SP_MediaSkipBackward Icon indicating that media should skip backward. | - |
1982 | \value SP_MediaSeekForward Icon indicating that media should seek forward. | - |
1983 | \value SP_MediaSeekBackward Icon indicating that media should seek backward. | - |
1984 | \value SP_MediaVolume Icon indicating a volume control. | - |
1985 | \value SP_MediaVolumeMuted Icon indicating a muted volume control. | - |
1986 | \value SP_CustomBase Base value for custom standard pixmaps; | - |
1987 | custom values must be greater than this value. | - |
1988 | | - |
1989 | \sa standardIcon() | - |
1990 | */ | - |
1991 | | - |
1992 | /*! | - |
1993 | \fn QPixmap QStyle::generatedIconPixmap(QIcon::Mode iconMode, | - |
1994 | const QPixmap &pixmap, const QStyleOption *option) const | - |
1995 | | - |
1996 | Returns a copy of the given \a pixmap, styled to conform to the | - |
1997 | specified \a iconMode and taking into account the palette | - |
1998 | specified by \a option. | - |
1999 | | - |
2000 | The \a option parameter can pass extra information, but | - |
2001 | it must contain a palette. | - |
2002 | | - |
2003 | Note that not all pixmaps will conform, in which case the returned | - |
2004 | pixmap is a plain copy. | - |
2005 | | - |
2006 | \sa QIcon | - |
2007 | */ | - |
2008 | | - |
2009 | /*! | - |
2010 | \fn QPixmap QStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option, \ | - |
2011 | const QWidget *widget) const | - |
2012 | | - |
2013 | \obsolete | - |
2014 | Returns a pixmap for the given \a standardPixmap. | - |
2015 | | - |
2016 | A standard pixmap is a pixmap that can follow some existing GUI | - |
2017 | style or guideline. The \a option argument can be used to pass | - |
2018 | extra information required when defining the appropriate | - |
2019 | pixmap. The \a widget argument is optional and can also be used to | - |
2020 | aid the determination of the pixmap. | - |
2021 | | - |
2022 | Developers calling standardPixmap() should instead call standardIcon() | - |
2023 | Developers who re-implemented standardPixmap() should instead re-implement | - |
2024 | standardIcon(). | - |
2025 | | - |
2026 | \sa standardIcon() | - |
2027 | */ | - |
2028 | | - |
2029 | | - |
2030 | /*! | - |
2031 | \fn QRect QStyle::visualRect(Qt::LayoutDirection direction, const QRect &boundingRectangle, const QRect &logicalRectangle) | - |
2032 | | - |
2033 | Returns the given \a logicalRectangle converted to screen | - |
2034 | coordinates based on the specified \a direction. The \a | - |
2035 | boundingRectangle is used when performing the translation. | - |
2036 | | - |
2037 | This function is provided to support right-to-left desktops, and | - |
2038 | is typically used in implementations of the subControlRect() | - |
2039 | function. | - |
2040 | | - |
2041 | \sa QWidget::layoutDirection | - |
2042 | */ | - |
2043 | QRect QStyle::visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect) | - |
2044 | { | - |
2045 | if (direction == Qt::LeftToRight) evaluated: direction == Qt::LeftToRight yes Evaluation Count:142533 | yes Evaluation Count:596 |
| 596-142533 |
2046 | return logicalRect; executed: return logicalRect; Execution Count:142533 | 142533 |
2047 | QRect rect = logicalRect; executed (the execution status of this line is deduced): QRect rect = logicalRect; | - |
2048 | rect.translate(2 * (boundingRect.right() - logicalRect.right()) + executed (the execution status of this line is deduced): rect.translate(2 * (boundingRect.right() - logicalRect.right()) + | - |
2049 | logicalRect.width() - boundingRect.width(), 0); executed (the execution status of this line is deduced): logicalRect.width() - boundingRect.width(), 0); | - |
2050 | return rect; executed: return rect; Execution Count:596 | 596 |
2051 | } | - |
2052 | | - |
2053 | /*! | - |
2054 | \fn QPoint QStyle::visualPos(Qt::LayoutDirection direction, const QRect &boundingRectangle, const QPoint &logicalPosition) | - |
2055 | | - |
2056 | Returns the given \a logicalPosition converted to screen | - |
2057 | coordinates based on the specified \a direction. The \a | - |
2058 | boundingRectangle is used when performing the translation. | - |
2059 | | - |
2060 | \sa QWidget::layoutDirection | - |
2061 | */ | - |
2062 | QPoint QStyle::visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos) | - |
2063 | { | - |
2064 | if (direction == Qt::LeftToRight) never evaluated: direction == Qt::LeftToRight | 0 |
2065 | return logicalPos; never executed: return logicalPos; | 0 |
2066 | return QPoint(boundingRect.right() - logicalPos.x(), logicalPos.y()); never executed: return QPoint(boundingRect.right() - logicalPos.x(), logicalPos.y()); | 0 |
2067 | } | - |
2068 | | - |
2069 | /*! | - |
2070 | Returns a new rectangle of the specified \a size that is aligned to the given \a | - |
2071 | rectangle according to the specified \a alignment and \a direction. | - |
2072 | */ | - |
2073 | QRect QStyle::alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle) | - |
2074 | { | - |
2075 | alignment = visualAlignment(direction, alignment); executed (the execution status of this line is deduced): alignment = visualAlignment(direction, alignment); | - |
2076 | int x = rectangle.x(); executed (the execution status of this line is deduced): int x = rectangle.x(); | - |
2077 | int y = rectangle.y(); executed (the execution status of this line is deduced): int y = rectangle.y(); | - |
2078 | int w = size.width(); executed (the execution status of this line is deduced): int w = size.width(); | - |
2079 | int h = size.height(); executed (the execution status of this line is deduced): int h = size.height(); | - |
2080 | if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter) evaluated: (alignment & Qt::AlignVCenter) == Qt::AlignVCenter yes Evaluation Count:55831 | yes Evaluation Count:448 |
| 448-55831 |
2081 | y += rectangle.size().height()/2 - h/2; executed: y += rectangle.size().height()/2 - h/2; Execution Count:55831 | 55831 |
2082 | else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom) partially evaluated: (alignment & Qt::AlignBottom) == Qt::AlignBottom no Evaluation Count:0 | yes Evaluation Count:448 |
| 0-448 |
2083 | y += rectangle.size().height() - h; never executed: y += rectangle.size().height() - h; | 0 |
2084 | if ((alignment & Qt::AlignRight) == Qt::AlignRight) evaluated: (alignment & Qt::AlignRight) == Qt::AlignRight yes Evaluation Count:228 | yes Evaluation Count:56051 |
| 228-56051 |
2085 | x += rectangle.size().width() - w; executed: x += rectangle.size().width() - w; Execution Count:228 | 228 |
2086 | else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter) evaluated: (alignment & Qt::AlignHCenter) == Qt::AlignHCenter yes Evaluation Count:40506 | yes Evaluation Count:15545 |
| 15545-40506 |
2087 | x += rectangle.size().width()/2 - w/2; executed: x += rectangle.size().width()/2 - w/2; Execution Count:40506 | 40506 |
2088 | return QRect(x, y, w, h); executed: return QRect(x, y, w, h); Execution Count:56279 | 56279 |
2089 | } | - |
2090 | | - |
2091 | /*! | - |
2092 | Transforms an \a alignment of Qt::AlignLeft or Qt::AlignRight | - |
2093 | without Qt::AlignAbsolute into Qt::AlignLeft or Qt::AlignRight with | - |
2094 | Qt::AlignAbsolute according to the layout \a direction. The other | - |
2095 | alignment flags are left untouched. | - |
2096 | | - |
2097 | If no horizontal alignment was specified, the function returns the | - |
2098 | default alignment for the given layout \a direction. | - |
2099 | | - |
2100 | QWidget::layoutDirection | - |
2101 | */ | - |
2102 | Qt::Alignment QStyle::visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment) | - |
2103 | { | - |
2104 | return QGuiApplicationPrivate::visualAlignment(direction, alignment); executed: return QGuiApplicationPrivate::visualAlignment(direction, alignment); Execution Count:89647 | 89647 |
2105 | } | - |
2106 | | - |
2107 | /*! | - |
2108 | Converts the given \a logicalValue to a pixel position. The \a min | - |
2109 | parameter maps to 0, \a max maps to \a span and other values are | - |
2110 | distributed evenly in-between. | - |
2111 | | - |
2112 | This function can handle the entire integer range without | - |
2113 | overflow, providing that \a span is less than 4096. | - |
2114 | | - |
2115 | By default, this function assumes that the maximum value is on the | - |
2116 | right for horizontal items and on the bottom for vertical items. | - |
2117 | Set the \a upsideDown parameter to true to reverse this behavior. | - |
2118 | | - |
2119 | \sa sliderValueFromPosition() | - |
2120 | */ | - |
2121 | | - |
2122 | int QStyle::sliderPositionFromValue(int min, int max, int logicalValue, int span, bool upsideDown) | - |
2123 | { | - |
2124 | if (span <= 0 || logicalValue < min || max <= min) evaluated: span <= 0 yes Evaluation Count:1705 | yes Evaluation Count:19544 |
partially evaluated: logicalValue < min no Evaluation Count:0 | yes Evaluation Count:19544 |
partially evaluated: max <= min no Evaluation Count:0 | yes Evaluation Count:19544 |
| 0-19544 |
2125 | return 0; executed: return 0; Execution Count:1705 | 1705 |
2126 | if (logicalValue > max) partially evaluated: logicalValue > max no Evaluation Count:0 | yes Evaluation Count:19544 |
| 0-19544 |
2127 | return upsideDown ? span : min; never executed: return upsideDown ? span : min; | 0 |
2128 | | - |
2129 | uint range = max - min; executed (the execution status of this line is deduced): uint range = max - min; | - |
2130 | uint p = upsideDown ? max - logicalValue : logicalValue - min; evaluated: upsideDown yes Evaluation Count:8 | yes Evaluation Count:19536 |
| 8-19536 |
2131 | | - |
2132 | if (range > (uint)INT_MAX/4096) { evaluated: range > (uint)2147483647/4096 yes Evaluation Count:56 | yes Evaluation Count:19488 |
| 56-19488 |
2133 | double dpos = (double(p))/(double(range)/span); executed (the execution status of this line is deduced): double dpos = (double(p))/(double(range)/span); | - |
2134 | return int(dpos); executed: return int(dpos); Execution Count:56 | 56 |
2135 | } else if (range > (uint)span) { evaluated: range > (uint)span yes Evaluation Count:15384 | yes Evaluation Count:4104 |
| 4104-15384 |
2136 | return (2 * p * span + range) / (2*range); executed: return (2 * p * span + range) / (2*range); Execution Count:15384 | 15384 |
2137 | } else { | - |
2138 | uint div = span / range; executed (the execution status of this line is deduced): uint div = span / range; | - |
2139 | uint mod = span % range; executed (the execution status of this line is deduced): uint mod = span % range; | - |
2140 | return p * div + (2 * p * mod + range) / (2 * range); executed: return p * div + (2 * p * mod + range) / (2 * range); Execution Count:4104 | 4104 |
2141 | } | - |
2142 | // equiv. to (p * span) / range + 0.5 | - |
2143 | // no overflow because of this implicit assumption: | - |
2144 | // span <= 4096 | - |
2145 | } | - |
2146 | | - |
2147 | /*! | - |
2148 | \fn int QStyle::sliderValueFromPosition(int min, int max, int position, int span, bool upsideDown) | - |
2149 | | - |
2150 | Converts the given pixel \a position to a logical value. 0 maps to | - |
2151 | the \a min parameter, \a span maps to \a max and other values are | - |
2152 | distributed evenly in-between. | - |
2153 | | - |
2154 | This function can handle the entire integer range without | - |
2155 | overflow. | - |
2156 | | - |
2157 | By default, this function assumes that the maximum value is on the | - |
2158 | right for horizontal items and on the bottom for vertical | - |
2159 | items. Set the \a upsideDown parameter to true to reverse this | - |
2160 | behavior. | - |
2161 | | - |
2162 | \sa sliderPositionFromValue() | - |
2163 | */ | - |
2164 | | - |
2165 | int QStyle::sliderValueFromPosition(int min, int max, int pos, int span, bool upsideDown) | - |
2166 | { | - |
2167 | if (span <= 0 || pos <= 0) partially evaluated: span <= 0 no Evaluation Count:0 | yes Evaluation Count:5 |
partially evaluated: pos <= 0 no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
2168 | return upsideDown ? max : min; never executed: return upsideDown ? max : min; | 0 |
2169 | if (pos >= span) evaluated: pos >= span yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
2170 | return upsideDown ? min : max; executed: return upsideDown ? min : max; Execution Count:2 | 2 |
2171 | | - |
2172 | uint range = max - min; executed (the execution status of this line is deduced): uint range = max - min; | - |
2173 | | - |
2174 | if ((uint)span > range) { partially evaluated: (uint)span > range yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
2175 | int tmp = (2 * pos * range + span) / (2 * span); executed (the execution status of this line is deduced): int tmp = (2 * pos * range + span) / (2 * span); | - |
2176 | return upsideDown ? max - tmp : tmp + min; executed: return upsideDown ? max - tmp : tmp + min; Execution Count:3 | 3 |
2177 | } else { | - |
2178 | uint div = range / span; never executed (the execution status of this line is deduced): uint div = range / span; | - |
2179 | uint mod = range % span; never executed (the execution status of this line is deduced): uint mod = range % span; | - |
2180 | int tmp = pos * div + (2 * pos * mod + span) / (2 * span); never executed (the execution status of this line is deduced): int tmp = pos * div + (2 * pos * mod + span) / (2 * span); | - |
2181 | return upsideDown ? max - tmp : tmp + min; never executed: return upsideDown ? max - tmp : tmp + min; | 0 |
2182 | } | - |
2183 | // equiv. to min + (pos*range)/span + 0.5 | - |
2184 | // no overflow because of this implicit assumption: | - |
2185 | // pos <= span < sqrt(INT_MAX+0.0625)+0.25 ~ sqrt(INT_MAX) | - |
2186 | } | - |
2187 | | - |
2188 | /*! | - |
2189 | Returns the style's standard palette. | - |
2190 | | - |
2191 | Note that on systems that support system colors, the style's | - |
2192 | standard palette is not used. In particular, the Windows XP, | - |
2193 | Vista, and Mac styles do not use the standard palette, but make | - |
2194 | use of native theme engines. With these styles, you should not set | - |
2195 | the palette with QApplication::setStandardPalette(). | - |
2196 | | - |
2197 | */ | - |
2198 | QPalette QStyle::standardPalette() const | - |
2199 | { | - |
2200 | QColor background = QColor(0xd4, 0xd0, 0xc8); // win 2000 grey executed (the execution status of this line is deduced): QColor background = QColor(0xd4, 0xd0, 0xc8); | - |
2201 | | - |
2202 | QColor light(background.lighter()); executed (the execution status of this line is deduced): QColor light(background.lighter()); | - |
2203 | QColor dark(background.darker()); executed (the execution status of this line is deduced): QColor dark(background.darker()); | - |
2204 | QColor mid(Qt::gray); executed (the execution status of this line is deduced): QColor mid(Qt::gray); | - |
2205 | QPalette palette(Qt::black, background, light, dark, mid, Qt::black, Qt::white); executed (the execution status of this line is deduced): QPalette palette(Qt::black, background, light, dark, mid, Qt::black, Qt::white); | - |
2206 | palette.setBrush(QPalette::Disabled, QPalette::WindowText, dark); executed (the execution status of this line is deduced): palette.setBrush(QPalette::Disabled, QPalette::WindowText, dark); | - |
2207 | palette.setBrush(QPalette::Disabled, QPalette::Text, dark); executed (the execution status of this line is deduced): palette.setBrush(QPalette::Disabled, QPalette::Text, dark); | - |
2208 | palette.setBrush(QPalette::Disabled, QPalette::ButtonText, dark); executed (the execution status of this line is deduced): palette.setBrush(QPalette::Disabled, QPalette::ButtonText, dark); | - |
2209 | palette.setBrush(QPalette::Disabled, QPalette::Base, background); executed (the execution status of this line is deduced): palette.setBrush(QPalette::Disabled, QPalette::Base, background); | - |
2210 | return palette; executed: return palette; Execution Count:215 | 215 |
2211 | } | - |
2212 | | - |
2213 | /*! | - |
2214 | \since 4.1 | - |
2215 | | - |
2216 | \fn QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0, | - |
2217 | const QWidget *widget = 0) const = 0; | - |
2218 | | - |
2219 | Returns an icon for the given \a standardIcon. | - |
2220 | | - |
2221 | The \a standardIcon is a standard pixmap which can follow some | - |
2222 | existing GUI style or guideline. The \a option argument can be | - |
2223 | used to pass extra information required when defining the | - |
2224 | appropriate icon. The \a widget argument is optional and can also | - |
2225 | be used to aid the determination of the icon. | - |
2226 | */ | - |
2227 | | - |
2228 | /*! | - |
2229 | \since 4.3 | - |
2230 | | - |
2231 | \fn int QStyle::layoutSpacing(QSizePolicy::ControlType control1, | - |
2232 | QSizePolicy::ControlType control2, Qt::Orientation orientation, | - |
2233 | const QStyleOption *option = 0, const QWidget *widget = 0) const | - |
2234 | | - |
2235 | Returns the spacing that should be used between \a control1 and | - |
2236 | \a control2 in a layout. \a orientation specifies whether the | - |
2237 | controls are laid out side by side or stacked vertically. The \a | - |
2238 | option parameter can be used to pass extra information about the | - |
2239 | parent widget. The \a widget parameter is optional and can also | - |
2240 | be used if \a option is 0. | - |
2241 | | - |
2242 | This function is called by the layout system. It is used only if | - |
2243 | PM_LayoutHorizontalSpacing or PM_LayoutVerticalSpacing returns a | - |
2244 | negative value. | - |
2245 | | - |
2246 | \sa combinedLayoutSpacing() | - |
2247 | */ | - |
2248 | | - |
2249 | /*! | - |
2250 | \since 4.3 | - |
2251 | | - |
2252 | Returns the spacing that should be used between \a controls1 and | - |
2253 | \a controls2 in a layout. \a orientation specifies whether the | - |
2254 | controls are laid out side by side or stacked vertically. The \a | - |
2255 | option parameter can be used to pass extra information about the | - |
2256 | parent widget. The \a widget parameter is optional and can also | - |
2257 | be used if \a option is 0. | - |
2258 | | - |
2259 | \a controls1 and \a controls2 are OR-combination of zero or more | - |
2260 | \l{QSizePolicy::ControlTypes}{control types}. | - |
2261 | | - |
2262 | This function is called by the layout system. It is used only if | - |
2263 | PM_LayoutHorizontalSpacing or PM_LayoutVerticalSpacing returns a | - |
2264 | negative value. | - |
2265 | | - |
2266 | \sa layoutSpacing() | - |
2267 | */ | - |
2268 | int QStyle::combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, | - |
2269 | QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, | - |
2270 | QStyleOption *option, QWidget *widget) const | - |
2271 | { | - |
2272 | QSizePolicy::ControlType array1[MaxBits]; executed (the execution status of this line is deduced): QSizePolicy::ControlType array1[MaxBits]; | - |
2273 | QSizePolicy::ControlType array2[MaxBits]; executed (the execution status of this line is deduced): QSizePolicy::ControlType array2[MaxBits]; | - |
2274 | int count1 = unpackControlTypes(controls1, array1); executed (the execution status of this line is deduced): int count1 = unpackControlTypes(controls1, array1); | - |
2275 | int count2 = unpackControlTypes(controls2, array2); executed (the execution status of this line is deduced): int count2 = unpackControlTypes(controls2, array2); | - |
2276 | int result = -1; executed (the execution status of this line is deduced): int result = -1; | - |
2277 | | - |
2278 | for (int i = 0; i < count1; ++i) { evaluated: i < count1 yes Evaluation Count:2057 | yes Evaluation Count:2057 |
| 2057 |
2279 | for (int j = 0; j < count2; ++j) { evaluated: j < count2 yes Evaluation Count:2057 | yes Evaluation Count:2057 |
| 2057 |
2280 | int spacing = layoutSpacing(array1[i], array2[j], orientation, option, widget); executed (the execution status of this line is deduced): int spacing = layoutSpacing(array1[i], array2[j], orientation, option, widget); | - |
2281 | result = qMax(spacing, result); executed (the execution status of this line is deduced): result = qMax(spacing, result); | - |
2282 | } executed: } Execution Count:2057 | 2057 |
2283 | } executed: } Execution Count:2057 | 2057 |
2284 | return result; executed: return result; Execution Count:2057 | 2057 |
2285 | } | - |
2286 | | - |
2287 | QT_BEGIN_INCLUDE_NAMESPACE | - |
2288 | #include <QDebug> | - |
2289 | QT_END_INCLUDE_NAMESPACE | - |
2290 | | - |
2291 | #if !defined(QT_NO_DEBUG_STREAM) | - |
2292 | QDebug operator<<(QDebug debug, QStyle::State state) | - |
2293 | { | - |
2294 | #if !defined(QT_NO_DEBUG) | - |
2295 | debug << "QStyle::State("; | - |
2296 | | - |
2297 | QStringList states; | - |
2298 | if (state & QStyle::State_Active) states << QLatin1String("Active"); | - |
2299 | if (state & QStyle::State_AutoRaise) states << QLatin1String("AutoRaise"); | - |
2300 | if (state & QStyle::State_Bottom) states << QLatin1String("Bottom"); | - |
2301 | if (state & QStyle::State_Children) states << QLatin1String("Children"); | - |
2302 | if (state & QStyle::State_DownArrow) states << QLatin1String("DownArrow"); | - |
2303 | if (state & QStyle::State_Editing) states << QLatin1String("Editing"); | - |
2304 | if (state & QStyle::State_Enabled) states << QLatin1String("Enabled"); | - |
2305 | if (state & QStyle::State_FocusAtBorder) states << QLatin1String("FocusAtBorder"); | - |
2306 | if (state & QStyle::State_HasFocus) states << QLatin1String("HasFocus"); | - |
2307 | if (state & QStyle::State_Horizontal) states << QLatin1String("Horizontal"); | - |
2308 | if (state & QStyle::State_Item) states << QLatin1String("Item"); | - |
2309 | if (state & QStyle::State_KeyboardFocusChange) states << QLatin1String("KeyboardFocusChange"); | - |
2310 | if (state & QStyle::State_MouseOver) states << QLatin1String("MouseOver"); | - |
2311 | if (state & QStyle::State_NoChange) states << QLatin1String("NoChange"); | - |
2312 | if (state & QStyle::State_Off) states << QLatin1String("Off"); | - |
2313 | if (state & QStyle::State_On) states << QLatin1String("On"); | - |
2314 | if (state & QStyle::State_Open) states << QLatin1String("Open"); | - |
2315 | if (state & QStyle::State_Raised) states << QLatin1String("Raised"); | - |
2316 | if (state & QStyle::State_ReadOnly) states << QLatin1String("ReadOnly"); | - |
2317 | if (state & QStyle::State_Selected) states << QLatin1String("Selected"); | - |
2318 | if (state & QStyle::State_Sibling) states << QLatin1String("Sibling"); | - |
2319 | if (state & QStyle::State_Sunken) states << QLatin1String("Sunken"); | - |
2320 | if (state & QStyle::State_Top) states << QLatin1String("Top"); | - |
2321 | if (state & QStyle::State_UpArrow) states << QLatin1String("UpArrow"); | - |
2322 | | - |
2323 | qSort(states); | - |
2324 | debug << states.join(QLatin1String(" | ")); | - |
2325 | debug << ')'; | - |
2326 | #else | - |
2327 | Q_UNUSED(state); never executed (the execution status of this line is deduced): (void)state;; | - |
2328 | #endif | - |
2329 | return debug; never executed: return debug; | 0 |
2330 | } | - |
2331 | #endif | - |
2332 | | - |
2333 | /*! | - |
2334 | \since 4.6 | - |
2335 | | - |
2336 | \fn const QStyle *QStyle::proxy() const | - |
2337 | | - |
2338 | This function returns the current proxy for this style. | - |
2339 | By default most styles will return themselves. However | - |
2340 | when a proxy style is in use, it will allow the style to | - |
2341 | call back into its proxy. | - |
2342 | */ | - |
2343 | const QStyle * QStyle::proxy() const | - |
2344 | { | - |
2345 | Q_D(const QStyle); executed (the execution status of this line is deduced): const QStylePrivate * const d = d_func(); | - |
2346 | return d->proxyStyle; executed: return d->proxyStyle; Execution Count:224293 | 224293 |
2347 | } | - |
2348 | | - |
2349 | /* \internal | - |
2350 | | - |
2351 | This function sets the base style that style calls will be | - |
2352 | redirected to. Note that ownership is not transferred. | - |
2353 | */ | - |
2354 | void QStyle::setProxy(QStyle *style) | - |
2355 | { | - |
2356 | Q_D(QStyle); executed (the execution status of this line is deduced): QStylePrivate * const d = d_func(); | - |
2357 | d->proxyStyle = style; executed (the execution status of this line is deduced): d->proxyStyle = style; | - |
2358 | } executed: } Execution Count:67 | 67 |
2359 | | - |
2360 | QT_END_NAMESPACE | - |
2361 | | - |
| | |