📄 qwidget_p.h
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the QtGui module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file. Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef QWIDGET_P_H#define QWIDGET_P_H//// W A R N I N G// -------------//// This file is not part of the Qt API. It exists for the convenience// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header// file may change from version to version without notice, or even be removed.//// We mean it.//#include "QtGui/qwidget.h"#include "private/qobject_p.h"#include "QtCore/qrect.h"#include "QtCore/qlocale.h"#include "QtGui/qregion.h"#include "QtGui/qsizepolicy.h"#include "QtGui/qstyle.h"#ifdef Q_WS_WIN#include "QtCore/qt_windows.h"#endif // Q_WS_WIN#ifdef Q_WS_X11#include "QtGui/qx11info_x11.h"#endif#if defined(Q_WS_QWS)#include "QtGui/qinputcontext.h"#include "QtGui/qscreen_qws.h"#endif#if defined(Q_WS_QWS) || defined(Q_WS_X11)//#define Q_WIDGET_USE_DIRTYLIST#endif#ifndef Q_WS_MAC#define Q_WIDGET_CACHE_OPAQUEREGIONS#endif//#define Q_WIN_USE_QT_UPDATE_EVENT//#define Q_RATE_LIMIT_PAINTING//#define Q_FLATTEN_EXPOSE// Extra QWidget data// - to minimize memory usage for members that are seldom used.// - top-level widgets have extra extra data to reduce cost further#if defined(Q_WS_QWS)class QWSManager;#endif#if defined(Q_WS_WIN)class QOleDropTarget;#endif#if defined(Q_WS_MAC)class QCoreGraphicsPaintEnginePrivate;#endifclass QPaintEngine;class QPixmap;class QWidgetBackingStore;class QStyle;struct QTLWExtra { QString caption; // widget caption QString iconText; // widget icon text QString role; // widget role QIcon *icon; // widget icon QPixmap *iconPixmap; short incw, inch; // size increments // frame strut, don't use these directly, use QWidgetPrivate::frameStrut() instead. QRect frameStrut; uint opacity : 8; uint posFromMove : 1;#ifndef Q_WS_MAC QWidgetBackingStore *backingStore;#endif#if defined(Q_WS_WIN) ulong savedFlags; // Save window flags while showing fullscreen#else Qt::WindowFlags savedFlags; // Save widget flags while showing fullscreen#endif short basew, baseh; // base sizes#if defined(Q_WS_X11) WId parentWinId; // parent window Id (valid after reparenting) uint embedded : 1; // window is embedded in another Qt application uint spont_unmapped: 1; // window was spontaneously unmapped uint dnd : 1; // DND properties installed uint validWMState : 1; // is WM_STATE valid? uint waitingForMapNotify : 1; // show() has been called, haven't got the MapNotify yet QPoint fullScreenOffset; QBitmap *iconMask;#endif#if defined(Q_WS_MAC) quint32 wattr; quint32 wclass; WindowGroupRef group; uint resizer : 4; uint isSetGeometry : 1; uint isMove : 1;#endif#if defined(Q_WS_QWS) && !defined (QT_NO_QWS_MANAGER) QWSManager *qwsManager;#endif#if defined Q_WS_QWS bool inPaintTransaction;#endif#if defined(Q_WS_WIN) HICON winIconBig; // internal big Windows icon HICON winIconSmall; // internal small Windows icon#endif QRect normalGeometry; // used by showMin/maximized/FullScreen QWindowSurface *windowSurface;};struct QWExtra { qint32 minw, minh; // minimum size qint32 maxw, maxh; // maximum size QPointer<QWidget> focus_proxy;#ifndef QT_NO_CURSOR QCursor *curs;#endif QTLWExtra *topextra; // only useful for TLWs#if defined(Q_WS_WIN) QOleDropTarget *dropTarget; // drop target#endif#if defined(Q_WS_X11) WId xDndProxy; // XDND forwarding to embedded windows#endif QRegion mask; // widget mask//bit flags at the end to improve packing#if defined(Q_WS_WIN) uint shown_mode : 8; // widget show mode#ifndef QT_NO_DIRECT3D uint had_paint_on_screen : 1; uint had_no_system_bg : 1; uint had_auto_fill_bg : 1;#endif#endif#if defined(Q_WS_X11) uint compress_events : 1;#endif uint explicitMinSize : 2; uint autoFillBackground : 1; QPointer<QStyle> style; QString styleSheet;};class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate{ Q_DECLARE_PUBLIC(QWidget)public: explicit QWidgetPrivate(int version = QObjectPrivateVersion); ~QWidgetPrivate(); QWExtra *extraData() const; QTLWExtra *topData() const; QTLWExtra *maybeTopData() const;#ifndef Q_WS_MAC QWidgetBackingStore *maybeBackingStore() const;#endif#ifdef Q_WS_QWS void setMaxWindowState_helper();#endif void init(QWidget *desktopWidget, Qt::WindowFlags f); void create_sys(WId window, bool initializeWindow, bool destroyOldWindow); void createRecursively(); void createWinId(WId id = 0); void createTLExtra(); void createExtra(); void deleteExtra(); void createSysExtra(); void deleteSysExtra(); void createTLSysExtra(); void deleteTLSysExtra(); void updateSystemBackground(); void propagatePaletteChange(); void setPalette_helper(const QPalette &); void resolvePalette();#ifdef Q_WS_WIN void setMask_sys(const QRegion &);#endif#ifdef Q_WS_MAC void macUpdateSizeAttribute(); void macUpdateHideOnSuspend(); void macUpdateOpaqueSizeGrip(); void macUpdateIgnoreMouseEvents(); void macUpdateMetalAttribute(); void macUpdateIsOpaque();#endif void raise_sys(); void lower_sys(); void stackUnder_sys(QWidget *); void setFocus_sys(); void setFont_helper(const QFont &); void resolveFont(); void setLayoutDirection_helper(Qt::LayoutDirection); void resolveLayoutDirection(); void setLocale_helper(const QLocale &l); void resolveLocale(); void setStyle_helper(QStyle *newStyle, bool propagate, bool metalHack = false); void inheritStyle(); bool isBackgroundInherited() const; void setUpdatesEnabled_helper(bool ); void paintBackground(QPainter *, const QRect &, bool asRoot = true) const; enum DrawWidgetFlags { DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08, DontSubtractOpaqueChildren = 0x10 }; void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags = DrawAsRoot | DrawRecursive);#ifdef Q_WS_MAC void render_helper(QWidget *widget, QPaintDevice *result, const QPoint &offset, const QRect &rect, QWidget::RenderFlags renderFlags);#endif QRect clipRect() const; QRegion clipRegion() const; void subtractOpaqueChildren(QRegion &rgn, const QRegion &clipRgn, const QPoint &offset, int startIdx = 0) const; void subtractOpaqueSiblings(QRegion &rgn, const QPoint &offset) const; void updateIsOpaque(); bool isOpaque() const; bool hasBackground() const;#ifdef Q_WIDGET_CACHE_OPAQUEREGIONS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -