1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtWidgets 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 The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QSTYLE_H |
41 | #define QSTYLE_H |
42 | |
43 | #include <QtWidgets/qtwidgetsglobal.h> |
44 | #include <QtCore/qobject.h> |
45 | #include <QtCore/qrect.h> |
46 | #include <QtCore/qsize.h> |
47 | #include <QtGui/qicon.h> |
48 | #include <QtGui/qpixmap.h> |
49 | #include <QtGui/qpalette.h> |
50 | #include <QtWidgets/qsizepolicy.h> |
51 | |
52 | QT_BEGIN_NAMESPACE |
53 | |
54 | |
55 | class QAction; |
56 | class QDebug; |
57 | class QTab; |
58 | class QFontMetrics; |
59 | class QStyleHintReturn; |
60 | class QStyleOption; |
61 | class QStyleOptionComplex; |
62 | class QStylePrivate; |
63 | |
64 | class Q_WIDGETS_EXPORT QStyle : public QObject |
65 | { |
66 | Q_OBJECT |
67 | Q_DECLARE_PRIVATE(QStyle) |
68 | |
69 | protected: |
70 | QStyle(QStylePrivate &dd); |
71 | |
72 | public: |
73 | QStyle(); |
74 | virtual ~QStyle(); |
75 | |
76 | virtual void polish(QWidget *widget); |
77 | virtual void unpolish(QWidget *widget); |
78 | |
79 | virtual void polish(QApplication *application); |
80 | virtual void unpolish(QApplication *application); |
81 | |
82 | virtual void polish(QPalette &palette); |
83 | |
84 | virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, |
85 | int flags, bool enabled, |
86 | const QString &text) const; |
87 | |
88 | virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; |
89 | |
90 | virtual void drawItemText(QPainter *painter, const QRect &rect, |
91 | int flags, const QPalette &pal, bool enabled, |
92 | const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; |
93 | |
94 | virtual void drawItemPixmap(QPainter *painter, const QRect &rect, |
95 | int alignment, const QPixmap &pixmap) const; |
96 | |
97 | virtual QPalette standardPalette() const; |
98 | |
99 | enum StateFlag { |
100 | State_None = 0x00000000, |
101 | State_Enabled = 0x00000001, |
102 | State_Raised = 0x00000002, |
103 | State_Sunken = 0x00000004, |
104 | State_Off = 0x00000008, |
105 | State_NoChange = 0x00000010, |
106 | State_On = 0x00000020, |
107 | State_DownArrow = 0x00000040, |
108 | State_Horizontal = 0x00000080, |
109 | State_HasFocus = 0x00000100, |
110 | State_Top = 0x00000200, |
111 | State_Bottom = 0x00000400, |
112 | State_FocusAtBorder = 0x00000800, |
113 | State_AutoRaise = 0x00001000, |
114 | State_MouseOver = 0x00002000, |
115 | State_UpArrow = 0x00004000, |
116 | State_Selected = 0x00008000, |
117 | State_Active = 0x00010000, |
118 | State_Window = 0x00020000, |
119 | State_Open = 0x00040000, |
120 | State_Children = 0x00080000, |
121 | State_Item = 0x00100000, |
122 | State_Sibling = 0x00200000, |
123 | State_Editing = 0x00400000, |
124 | State_KeyboardFocusChange = 0x00800000, |
125 | #ifdef QT_KEYPAD_NAVIGATION |
126 | State_HasEditFocus = 0x01000000, |
127 | #endif |
128 | State_ReadOnly = 0x02000000, |
129 | State_Small = 0x04000000, |
130 | State_Mini = 0x08000000 |
131 | }; |
132 | Q_ENUM(StateFlag) |
133 | Q_DECLARE_FLAGS(State, StateFlag) |
134 | |
135 | |
136 | enum PrimitiveElement { |
137 | PE_Frame, |
138 | PE_FrameDefaultButton, |
139 | PE_FrameDockWidget, |
140 | PE_FrameFocusRect, |
141 | PE_FrameGroupBox, |
142 | PE_FrameLineEdit, |
143 | , |
144 | PE_FrameStatusBarItem, |
145 | PE_FrameTabWidget, |
146 | PE_FrameWindow, |
147 | PE_FrameButtonBevel, |
148 | PE_FrameButtonTool, |
149 | PE_FrameTabBarBase, |
150 | |
151 | PE_PanelButtonCommand, |
152 | PE_PanelButtonBevel, |
153 | PE_PanelButtonTool, |
154 | , |
155 | PE_PanelToolBar, |
156 | PE_PanelLineEdit, |
157 | |
158 | PE_IndicatorArrowDown, |
159 | PE_IndicatorArrowLeft, |
160 | PE_IndicatorArrowRight, |
161 | PE_IndicatorArrowUp, |
162 | PE_IndicatorBranch, |
163 | PE_IndicatorButtonDropDown, |
164 | PE_IndicatorItemViewItemCheck, |
165 | PE_IndicatorCheckBox, |
166 | PE_IndicatorDockWidgetResizeHandle, |
167 | , |
168 | , |
169 | PE_IndicatorProgressChunk, |
170 | PE_IndicatorRadioButton, |
171 | PE_IndicatorSpinDown, |
172 | PE_IndicatorSpinMinus, |
173 | PE_IndicatorSpinPlus, |
174 | PE_IndicatorSpinUp, |
175 | PE_IndicatorToolBarHandle, |
176 | PE_IndicatorToolBarSeparator, |
177 | PE_PanelTipLabel, |
178 | PE_IndicatorTabTear, |
179 | PE_IndicatorTabTearLeft = PE_IndicatorTabTear, |
180 | PE_PanelScrollAreaCorner, |
181 | |
182 | PE_Widget, |
183 | |
184 | PE_IndicatorColumnViewArrow, |
185 | PE_IndicatorItemViewItemDrop, |
186 | |
187 | PE_PanelItemViewItem, |
188 | PE_PanelItemViewRow, |
189 | |
190 | PE_PanelStatusBar, |
191 | |
192 | PE_IndicatorTabClose, |
193 | , |
194 | |
195 | PE_IndicatorTabTearRight, |
196 | |
197 | // do not add any values below/greater this |
198 | PE_CustomBase = 0xf000000 |
199 | }; |
200 | Q_ENUM(PrimitiveElement) |
201 | |
202 | virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, |
203 | const QWidget *w = nullptr) const = 0; |
204 | enum ControlElement { |
205 | CE_PushButton, |
206 | CE_PushButtonBevel, |
207 | CE_PushButtonLabel, |
208 | |
209 | CE_CheckBox, |
210 | CE_CheckBoxLabel, |
211 | |
212 | CE_RadioButton, |
213 | CE_RadioButtonLabel, |
214 | |
215 | CE_TabBarTab, |
216 | CE_TabBarTabShape, |
217 | CE_TabBarTabLabel, |
218 | |
219 | CE_ProgressBar, |
220 | CE_ProgressBarGroove, |
221 | CE_ProgressBarContents, |
222 | CE_ProgressBarLabel, |
223 | |
224 | , |
225 | , |
226 | , |
227 | , |
228 | , |
229 | , |
230 | |
231 | , |
232 | , |
233 | |
234 | CE_ToolButtonLabel, |
235 | |
236 | , |
237 | , |
238 | , |
239 | |
240 | CE_ToolBoxTab, |
241 | CE_SizeGrip, |
242 | CE_Splitter, |
243 | CE_RubberBand, |
244 | CE_DockWidgetTitle, |
245 | |
246 | CE_ScrollBarAddLine, |
247 | CE_ScrollBarSubLine, |
248 | CE_ScrollBarAddPage, |
249 | CE_ScrollBarSubPage, |
250 | CE_ScrollBarSlider, |
251 | CE_ScrollBarFirst, |
252 | CE_ScrollBarLast, |
253 | |
254 | CE_FocusFrame, |
255 | CE_ComboBoxLabel, |
256 | |
257 | CE_ToolBar, |
258 | CE_ToolBoxTabShape, |
259 | CE_ToolBoxTabLabel, |
260 | , |
261 | |
262 | CE_ColumnViewGrip, |
263 | |
264 | CE_ItemViewItem, |
265 | |
266 | CE_ShapedFrame, |
267 | |
268 | // do not add any values below/greater than this |
269 | CE_CustomBase = 0xf0000000 |
270 | }; |
271 | Q_ENUM(ControlElement) |
272 | |
273 | virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, |
274 | const QWidget *w = nullptr) const = 0; |
275 | |
276 | enum SubElement { |
277 | SE_PushButtonContents, |
278 | SE_PushButtonFocusRect, |
279 | |
280 | SE_CheckBoxIndicator, |
281 | SE_CheckBoxContents, |
282 | SE_CheckBoxFocusRect, |
283 | SE_CheckBoxClickRect, |
284 | |
285 | SE_RadioButtonIndicator, |
286 | SE_RadioButtonContents, |
287 | SE_RadioButtonFocusRect, |
288 | SE_RadioButtonClickRect, |
289 | |
290 | SE_ComboBoxFocusRect, |
291 | |
292 | SE_SliderFocusRect, |
293 | |
294 | SE_ProgressBarGroove, |
295 | SE_ProgressBarContents, |
296 | SE_ProgressBarLabel, |
297 | |
298 | SE_ToolBoxTabContents, |
299 | |
300 | , |
301 | , |
302 | |
303 | SE_TabWidgetTabBar, |
304 | SE_TabWidgetTabPane, |
305 | SE_TabWidgetTabContents, |
306 | SE_TabWidgetLeftCorner, |
307 | SE_TabWidgetRightCorner, |
308 | |
309 | SE_ItemViewItemCheckIndicator, |
310 | SE_TabBarTearIndicator, |
311 | SE_TabBarTearIndicatorLeft = SE_TabBarTearIndicator, |
312 | |
313 | SE_TreeViewDisclosureItem, |
314 | |
315 | SE_LineEditContents, |
316 | SE_FrameContents, |
317 | |
318 | SE_DockWidgetCloseButton, |
319 | SE_DockWidgetFloatButton, |
320 | SE_DockWidgetTitleBarText, |
321 | SE_DockWidgetIcon, |
322 | |
323 | SE_CheckBoxLayoutItem, |
324 | SE_ComboBoxLayoutItem, |
325 | SE_DateTimeEditLayoutItem, |
326 | SE_LabelLayoutItem, |
327 | SE_ProgressBarLayoutItem, |
328 | SE_PushButtonLayoutItem, |
329 | SE_RadioButtonLayoutItem, |
330 | SE_SliderLayoutItem, |
331 | SE_SpinBoxLayoutItem, |
332 | SE_ToolButtonLayoutItem, |
333 | |
334 | SE_FrameLayoutItem, |
335 | SE_GroupBoxLayoutItem, |
336 | SE_TabWidgetLayoutItem, |
337 | |
338 | SE_ItemViewItemDecoration, |
339 | SE_ItemViewItemText, |
340 | SE_ItemViewItemFocusRect, |
341 | |
342 | SE_TabBarTabLeftButton, |
343 | SE_TabBarTabRightButton, |
344 | SE_TabBarTabText, |
345 | |
346 | SE_ShapedFrameContents, |
347 | |
348 | SE_ToolBarHandle, |
349 | |
350 | SE_TabBarScrollLeftButton, |
351 | SE_TabBarScrollRightButton, |
352 | SE_TabBarTearIndicatorRight, |
353 | |
354 | SE_PushButtonBevel, |
355 | |
356 | // do not add any values below/greater than this |
357 | SE_CustomBase = 0xf0000000 |
358 | }; |
359 | Q_ENUM(SubElement) |
360 | |
361 | virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, |
362 | const QWidget *widget = nullptr) const = 0; |
363 | |
364 | |
365 | enum ComplexControl { |
366 | CC_SpinBox, |
367 | CC_ComboBox, |
368 | CC_ScrollBar, |
369 | CC_Slider, |
370 | CC_ToolButton, |
371 | CC_TitleBar, |
372 | CC_Dial, |
373 | CC_GroupBox, |
374 | CC_MdiControls, |
375 | |
376 | // do not add any values below/greater than this |
377 | CC_CustomBase = 0xf0000000 |
378 | }; |
379 | Q_ENUM(ComplexControl) |
380 | |
381 | enum SubControl { |
382 | SC_None = 0x00000000, |
383 | |
384 | SC_ScrollBarAddLine = 0x00000001, |
385 | SC_ScrollBarSubLine = 0x00000002, |
386 | SC_ScrollBarAddPage = 0x00000004, |
387 | SC_ScrollBarSubPage = 0x00000008, |
388 | SC_ScrollBarFirst = 0x00000010, |
389 | SC_ScrollBarLast = 0x00000020, |
390 | SC_ScrollBarSlider = 0x00000040, |
391 | SC_ScrollBarGroove = 0x00000080, |
392 | |
393 | SC_SpinBoxUp = 0x00000001, |
394 | SC_SpinBoxDown = 0x00000002, |
395 | SC_SpinBoxFrame = 0x00000004, |
396 | SC_SpinBoxEditField = 0x00000008, |
397 | |
398 | SC_ComboBoxFrame = 0x00000001, |
399 | SC_ComboBoxEditField = 0x00000002, |
400 | SC_ComboBoxArrow = 0x00000004, |
401 | = 0x00000008, |
402 | |
403 | SC_SliderGroove = 0x00000001, |
404 | SC_SliderHandle = 0x00000002, |
405 | SC_SliderTickmarks = 0x00000004, |
406 | |
407 | SC_ToolButton = 0x00000001, |
408 | = 0x00000002, |
409 | |
410 | = 0x00000001, |
411 | SC_TitleBarMinButton = 0x00000002, |
412 | SC_TitleBarMaxButton = 0x00000004, |
413 | SC_TitleBarCloseButton = 0x00000008, |
414 | SC_TitleBarNormalButton = 0x00000010, |
415 | SC_TitleBarShadeButton = 0x00000020, |
416 | SC_TitleBarUnshadeButton = 0x00000040, |
417 | SC_TitleBarContextHelpButton = 0x00000080, |
418 | SC_TitleBarLabel = 0x00000100, |
419 | |
420 | SC_DialGroove = 0x00000001, |
421 | SC_DialHandle = 0x00000002, |
422 | SC_DialTickmarks = 0x00000004, |
423 | |
424 | SC_GroupBoxCheckBox = 0x00000001, |
425 | SC_GroupBoxLabel = 0x00000002, |
426 | SC_GroupBoxContents = 0x00000004, |
427 | SC_GroupBoxFrame = 0x00000008, |
428 | |
429 | SC_MdiMinButton = 0x00000001, |
430 | SC_MdiNormalButton = 0x00000002, |
431 | SC_MdiCloseButton = 0x00000004, |
432 | |
433 | SC_CustomBase = 0xf0000000, |
434 | SC_All = 0xffffffff |
435 | }; |
436 | Q_ENUM(SubControl) |
437 | Q_DECLARE_FLAGS(SubControls, SubControl) |
438 | |
439 | |
440 | virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, |
441 | const QWidget *widget = nullptr) const = 0; |
442 | virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, |
443 | const QPoint &pt, const QWidget *widget = nullptr) const = 0; |
444 | virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, |
445 | SubControl sc, const QWidget *widget = nullptr) const = 0; |
446 | |
447 | enum PixelMetric { |
448 | PM_ButtonMargin, |
449 | PM_ButtonDefaultIndicator, |
450 | , |
451 | PM_ButtonShiftHorizontal, |
452 | PM_ButtonShiftVertical, |
453 | |
454 | PM_DefaultFrameWidth, |
455 | PM_SpinBoxFrameWidth, |
456 | PM_ComboBoxFrameWidth, |
457 | |
458 | PM_MaximumDragDistance, |
459 | |
460 | PM_ScrollBarExtent, |
461 | PM_ScrollBarSliderMin, |
462 | |
463 | PM_SliderThickness, // total slider thickness |
464 | PM_SliderControlThickness, // thickness of the business part |
465 | PM_SliderLength, // total length of slider |
466 | PM_SliderTickmarkOffset, // |
467 | PM_SliderSpaceAvailable, // available space for slider to move |
468 | |
469 | PM_DockWidgetSeparatorExtent, |
470 | PM_DockWidgetHandleExtent, |
471 | PM_DockWidgetFrameWidth, |
472 | |
473 | PM_TabBarTabOverlap, |
474 | PM_TabBarTabHSpace, |
475 | PM_TabBarTabVSpace, |
476 | PM_TabBarBaseHeight, |
477 | PM_TabBarBaseOverlap, |
478 | |
479 | PM_ProgressBarChunkWidth, |
480 | |
481 | PM_SplitterWidth, |
482 | PM_TitleBarHeight, |
483 | |
484 | , |
485 | , |
486 | , |
487 | , |
488 | , |
489 | , |
490 | |
491 | , |
492 | , |
493 | , |
494 | , |
495 | |
496 | PM_IndicatorWidth, |
497 | PM_IndicatorHeight, |
498 | PM_ExclusiveIndicatorWidth, |
499 | PM_ExclusiveIndicatorHeight, |
500 | |
501 | PM_DialogButtonsSeparator, |
502 | PM_DialogButtonsButtonWidth, |
503 | PM_DialogButtonsButtonHeight, |
504 | |
505 | PM_MdiSubWindowFrameWidth, |
506 | PM_MdiSubWindowMinimizedWidth, |
507 | |
508 | , |
509 | , |
510 | , |
511 | PM_TabBarTabShiftHorizontal, |
512 | PM_TabBarTabShiftVertical, |
513 | PM_TabBarScrollButtonWidth, |
514 | |
515 | PM_ToolBarFrameWidth, |
516 | PM_ToolBarHandleExtent, |
517 | PM_ToolBarItemSpacing, |
518 | PM_ToolBarItemMargin, |
519 | PM_ToolBarSeparatorExtent, |
520 | PM_ToolBarExtensionExtent, |
521 | |
522 | PM_SpinBoxSliderHeight, |
523 | |
524 | PM_ToolBarIconSize, |
525 | PM_ListViewIconSize, |
526 | PM_IconViewIconSize, |
527 | PM_SmallIconSize, |
528 | PM_LargeIconSize, |
529 | |
530 | PM_FocusFrameVMargin, |
531 | PM_FocusFrameHMargin, |
532 | |
533 | PM_ToolTipLabelFrameWidth, |
534 | PM_CheckBoxLabelSpacing, |
535 | PM_TabBarIconSize, |
536 | PM_SizeGripSize, |
537 | PM_DockWidgetTitleMargin, |
538 | PM_MessageBoxIconSize, |
539 | PM_ButtonIconSize, |
540 | |
541 | PM_DockWidgetTitleBarButtonMargin, |
542 | |
543 | PM_RadioButtonLabelSpacing, |
544 | PM_LayoutLeftMargin, |
545 | PM_LayoutTopMargin, |
546 | PM_LayoutRightMargin, |
547 | PM_LayoutBottomMargin, |
548 | PM_LayoutHorizontalSpacing, |
549 | PM_LayoutVerticalSpacing, |
550 | PM_TabBar_ScrollButtonOverlap, |
551 | |
552 | PM_TextCursorWidth, |
553 | |
554 | PM_TabCloseIndicatorWidth, |
555 | PM_TabCloseIndicatorHeight, |
556 | |
557 | PM_ScrollView_ScrollBarSpacing, |
558 | PM_ScrollView_ScrollBarOverlap, |
559 | , |
560 | PM_TreeViewIndentation, |
561 | |
562 | , |
563 | , |
564 | |
565 | PM_TitleBarButtonIconSize, |
566 | PM_TitleBarButtonSize, |
567 | |
568 | // do not add any values below/greater than this |
569 | PM_CustomBase = 0xf0000000 |
570 | }; |
571 | Q_ENUM(PixelMetric) |
572 | |
573 | virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr, |
574 | const QWidget *widget = nullptr) const = 0; |
575 | |
576 | enum ContentsType { |
577 | CT_PushButton, |
578 | CT_CheckBox, |
579 | CT_RadioButton, |
580 | CT_ToolButton, |
581 | CT_ComboBox, |
582 | CT_Splitter, |
583 | CT_ProgressBar, |
584 | , |
585 | , |
586 | , |
587 | , |
588 | CT_TabBarTab, |
589 | CT_Slider, |
590 | CT_ScrollBar, |
591 | CT_LineEdit, |
592 | CT_SpinBox, |
593 | CT_SizeGrip, |
594 | CT_TabWidget, |
595 | CT_DialogButtons, |
596 | , |
597 | CT_GroupBox, |
598 | CT_MdiControls, |
599 | CT_ItemViewItem, |
600 | // do not add any values below/greater than this |
601 | CT_CustomBase = 0xf0000000 |
602 | }; |
603 | Q_ENUM(ContentsType) |
604 | |
605 | virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, |
606 | const QSize &contentsSize, const QWidget *w = nullptr) const = 0; |
607 | |
608 | enum RequestSoftwareInputPanel { |
609 | RSIP_OnMouseClickAndAlreadyFocused, |
610 | RSIP_OnMouseClick |
611 | }; |
612 | Q_ENUM(RequestSoftwareInputPanel) |
613 | |
614 | enum StyleHint { |
615 | SH_EtchDisabledText, |
616 | SH_DitherDisabledText, |
617 | SH_ScrollBar_MiddleClickAbsolutePosition, |
618 | SH_ScrollBar_ScrollWhenPointerLeavesControl, |
619 | SH_TabBar_SelectMouseType, |
620 | SH_TabBar_Alignment, |
621 | , |
622 | SH_Slider_SnapToValue, |
623 | SH_Slider_SloppyKeyEvents, |
624 | SH_ProgressDialog_CenterCancelButton, |
625 | SH_ProgressDialog_TextLabelAlignment, |
626 | SH_PrintDialog_RightAlignButtons, |
627 | SH_MainWindow_SpaceBelowMenuBar, |
628 | SH_FontDialog_SelectAssociatedText, |
629 | SH_Menu_AllowActiveAndDisabled, |
630 | , |
631 | , |
632 | SH_ScrollView_FrameOnlyAroundContents, |
633 | , |
634 | SH_ComboBox_ListMouseTracking, |
635 | , |
636 | , |
637 | SH_ItemView_ChangeHighlightOnFocus, |
638 | SH_Widget_ShareActivation, |
639 | SH_Workspace_FillSpaceOnMaximize, |
640 | , |
641 | SH_TitleBar_NoBorder, |
642 | SH_Slider_StopMouseOverSlider, |
643 | SH_BlinkCursorWhenTextSelected, |
644 | SH_RichText_FullWidthSelection, |
645 | , |
646 | SH_GroupBox_TextLabelVerticalAlignment, |
647 | SH_GroupBox_TextLabelColor, |
648 | , |
649 | SH_Table_GridLineColor, |
650 | SH_LineEdit_PasswordCharacter, |
651 | SH_DialogButtons_DefaultButton, |
652 | SH_ToolBox_SelectedPageTitleBold, |
653 | SH_TabBar_PreferNoArrows, |
654 | SH_ScrollBar_LeftClickAbsolutePosition, |
655 | SH_ListViewExpand_SelectMouseType, |
656 | SH_UnderlineShortcut, |
657 | SH_SpinBox_AnimateButton, |
658 | SH_SpinBox_KeyPressAutoRepeatRate, |
659 | SH_SpinBox_ClickAutoRepeatRate, |
660 | , |
661 | SH_ToolTipLabel_Opacity, |
662 | , |
663 | SH_TitleBar_ModifyNotification, |
664 | SH_Button_FocusPolicy, |
665 | SH_MessageBox_UseBorderForButtonSpacing, |
666 | SH_TitleBar_AutoRaise, |
667 | , |
668 | SH_FocusFrame_Mask, |
669 | SH_RubberBand_Mask, |
670 | SH_WindowFrame_Mask, |
671 | SH_SpinControls_DisableOnBounds, |
672 | SH_Dial_BackgroundRole, |
673 | SH_ComboBox_LayoutDirection, |
674 | SH_ItemView_EllipsisLocation, |
675 | SH_ItemView_ShowDecorationSelected, |
676 | SH_ItemView_ActivateItemOnSingleClick, |
677 | , |
678 | SH_ScrollBar_RollBetweenButtons, |
679 | SH_Slider_AbsoluteSetButtons, |
680 | SH_Slider_PageSetButtons, |
681 | , |
682 | SH_TabBar_ElideMode, |
683 | SH_DialogButtonLayout, |
684 | , |
685 | SH_MessageBox_TextInteractionFlags, |
686 | SH_DialogButtonBox_ButtonsHaveIcons, |
687 | SH_MessageBox_CenterButtons, |
688 | , |
689 | SH_ItemView_MovementWithoutUpdatingSelection, |
690 | SH_ToolTip_Mask, |
691 | SH_FocusFrame_AboveWidget, |
692 | SH_TextControl_FocusIndicatorTextCharFormat, |
693 | SH_WizardStyle, |
694 | SH_ItemView_ArrowKeysNavigateIntoChildren, |
695 | , |
696 | , |
697 | , |
698 | SH_SpinBox_ClickAutoRepeatThreshold, |
699 | SH_ItemView_PaintAlternatingRowColorsForEmptyArea, |
700 | SH_FormLayoutWrapPolicy, |
701 | SH_TabWidget_DefaultTabPosition, |
702 | SH_ToolBar_Movable, |
703 | SH_FormLayoutFieldGrowthPolicy, |
704 | SH_FormLayoutFormAlignment, |
705 | SH_FormLayoutLabelAlignment, |
706 | SH_ItemView_DrawDelegateFrame, |
707 | SH_TabBar_CloseButtonPosition, |
708 | SH_DockWidget_ButtonsHaveFrame, |
709 | SH_ToolButtonStyle, |
710 | SH_RequestSoftwareInputPanel, |
711 | SH_ScrollBar_Transient, |
712 | , |
713 | SH_ToolTip_WakeUpDelay, |
714 | SH_ToolTip_FallAsleepDelay, |
715 | SH_Widget_Animate, |
716 | SH_Splitter_OpaqueResize, |
717 | // Whether we should use a native popup. |
718 | // Only supported for non-editable combo boxes on Mac OS X so far. |
719 | , |
720 | SH_LineEdit_PasswordMaskDelay, |
721 | SH_TabBar_ChangeCurrentDelay, |
722 | , |
723 | , |
724 | , |
725 | , |
726 | , |
727 | , |
728 | SH_ItemView_ScrollMode, |
729 | SH_TitleBar_ShowToolTipsOnButtons, |
730 | SH_Widget_Animation_Duration, |
731 | SH_ComboBox_AllowWheelScrolling, |
732 | SH_SpinBox_ButtonsInsideFrame, |
733 | SH_SpinBox_StepModifier, |
734 | // Add new style hint values here |
735 | |
736 | SH_CustomBase = 0xf0000000 |
737 | }; |
738 | Q_ENUM(StyleHint) |
739 | |
740 | virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = nullptr, |
741 | const QWidget *widget = nullptr, QStyleHintReturn* returnData = nullptr) const = 0; |
742 | |
743 | enum StandardPixmap { |
744 | , |
745 | SP_TitleBarMinButton, |
746 | SP_TitleBarMaxButton, |
747 | SP_TitleBarCloseButton, |
748 | SP_TitleBarNormalButton, |
749 | SP_TitleBarShadeButton, |
750 | SP_TitleBarUnshadeButton, |
751 | SP_TitleBarContextHelpButton, |
752 | SP_DockWidgetCloseButton, |
753 | SP_MessageBoxInformation, |
754 | SP_MessageBoxWarning, |
755 | SP_MessageBoxCritical, |
756 | SP_MessageBoxQuestion, |
757 | SP_DesktopIcon, |
758 | SP_TrashIcon, |
759 | SP_ComputerIcon, |
760 | SP_DriveFDIcon, |
761 | SP_DriveHDIcon, |
762 | SP_DriveCDIcon, |
763 | SP_DriveDVDIcon, |
764 | SP_DriveNetIcon, |
765 | SP_DirOpenIcon, |
766 | SP_DirClosedIcon, |
767 | SP_DirLinkIcon, |
768 | SP_DirLinkOpenIcon, |
769 | SP_FileIcon, |
770 | SP_FileLinkIcon, |
771 | SP_ToolBarHorizontalExtensionButton, |
772 | SP_ToolBarVerticalExtensionButton, |
773 | SP_FileDialogStart, |
774 | SP_FileDialogEnd, |
775 | SP_FileDialogToParent, |
776 | SP_FileDialogNewFolder, |
777 | SP_FileDialogDetailedView, |
778 | SP_FileDialogInfoView, |
779 | SP_FileDialogContentsView, |
780 | SP_FileDialogListView, |
781 | SP_FileDialogBack, |
782 | SP_DirIcon, |
783 | SP_DialogOkButton, |
784 | SP_DialogCancelButton, |
785 | SP_DialogHelpButton, |
786 | SP_DialogOpenButton, |
787 | SP_DialogSaveButton, |
788 | SP_DialogCloseButton, |
789 | SP_DialogApplyButton, |
790 | SP_DialogResetButton, |
791 | SP_DialogDiscardButton, |
792 | SP_DialogYesButton, |
793 | SP_DialogNoButton, |
794 | SP_ArrowUp, |
795 | SP_ArrowDown, |
796 | SP_ArrowLeft, |
797 | SP_ArrowRight, |
798 | SP_ArrowBack, |
799 | SP_ArrowForward, |
800 | SP_DirHomeIcon, |
801 | SP_CommandLink, |
802 | SP_VistaShield, |
803 | SP_BrowserReload, |
804 | SP_BrowserStop, |
805 | SP_MediaPlay, |
806 | SP_MediaStop, |
807 | SP_MediaPause, |
808 | SP_MediaSkipForward, |
809 | SP_MediaSkipBackward, |
810 | SP_MediaSeekForward, |
811 | SP_MediaSeekBackward, |
812 | SP_MediaVolume, |
813 | SP_MediaVolumeMuted, |
814 | SP_LineEditClearButton, |
815 | SP_DialogYesToAllButton, |
816 | SP_DialogNoToAllButton, |
817 | SP_DialogSaveAllButton, |
818 | SP_DialogAbortButton, |
819 | SP_DialogRetryButton, |
820 | SP_DialogIgnoreButton, |
821 | SP_RestoreDefaultsButton, |
822 | // do not add any values below/greater than this |
823 | SP_CustomBase = 0xf0000000 |
824 | }; |
825 | Q_ENUM(StandardPixmap) |
826 | |
827 | virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr, |
828 | const QWidget *widget = nullptr) const = 0; |
829 | |
830 | virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr, |
831 | const QWidget *widget = nullptr) const = 0; |
832 | |
833 | virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, |
834 | const QStyleOption *opt) const = 0; |
835 | |
836 | static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, |
837 | const QRect &logicalRect); |
838 | static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, |
839 | const QPoint &logicalPos); |
840 | static int sliderPositionFromValue(int min, int max, int val, int space, |
841 | bool upsideDown = false); |
842 | static int sliderValueFromPosition(int min, int max, int pos, int space, |
843 | bool upsideDown = false); |
844 | static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment); |
845 | static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, |
846 | const QSize &size, const QRect &rectangle); |
847 | |
848 | virtual int layoutSpacing(QSizePolicy::ControlType control1, |
849 | QSizePolicy::ControlType control2, Qt::Orientation orientation, |
850 | const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const = 0; |
851 | int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, |
852 | QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, |
853 | QStyleOption *option = nullptr, QWidget *widget = nullptr) const; |
854 | |
855 | const QStyle * proxy() const; |
856 | |
857 | private: |
858 | Q_DISABLE_COPY(QStyle) |
859 | friend class QWidget; |
860 | friend class QWidgetPrivate; |
861 | friend class QApplication; |
862 | friend class QProxyStyle; |
863 | friend class QProxyStylePrivate; |
864 | void setProxy(QStyle *style); |
865 | }; |
866 | |
867 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State) |
868 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls) |
869 | |
870 | QT_END_NAMESPACE |
871 | |
872 | #endif // QSTYLE_H |
873 | |