Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QCocoaWindow Class Reference

#include <qcocoawindow.h>

+ Inheritance diagram for QCocoaWindow:
+ Collaboration diagram for QCocoaWindow:

Classes

struct  BorderRange
 

Public Types

enum  RecreationReason {
  RecreationNotNeeded = 0 , ParentChanged = 0x1 , MissingWindow = 0x2 , WindowModalityChanged = 0x4 ,
  ContentViewChanged = 0x10 , PanelChanged = 0x20
}
 
enum  HandleFlags { NoHandleFlags = 0 , HandleUnconditionally = 1 }
 

Public Member Functions

 QCocoaWindow (QWindow *tlw, WId nativeHandle=0)
 
 ~QCocoaWindow ()
 
void initialize () override
 Called as part of QWindow::create(), after constructing the window.
 
void setGeometry (const QRect &rect) override
 This function is called by Qt whenever a window is moved or resized using the QWindow API.
 
QRect geometry () const override
 Returns the current geometry of a window.
 
QRect normalGeometry () const override
 the geometry of the window as it will appear when shown as a normal (not maximized or full screen) top-level window.
 
void setCocoaGeometry (const QRect &rect)
 
QMargins safeAreaMargins () const override
 The safe area margins of a window represent the area that is safe to place content within, without intersecting areas of the screen where system UI is placed, or where a screen bezel may cover the content.
 
void setVisible (bool visible) override
 Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
 
void setWindowFlags (Qt::WindowFlags flags) override
 Requests setting the window flags of this surface to flags.
 
void setWindowState (Qt::WindowStates state) override
 Changes the state of the NSWindow, going in/out of minimize/zoomed/fullscreen.
 
void setWindowTitle (const QString &title) override
 Reimplement to set the window title to title.
 
void setWindowFilePath (const QString &filePath) override
 Reimplement to set the window file path to filePath.
 
void setWindowIcon (const QIcon &icon) override
 Reimplement to set the window icon to icon.
 
void setAlertState (bool enabled) override
 Reimplement this method to set whether the window demands attention (for example, by flashing the taskbar icon) depending on enabled.
 
bool isAlertState () const override
 Reimplement this method return whether the window is in an alert state.
 
void raise () override
 Reimplement to be able to let Qt raise windows to the top of the desktop.
 
void lower () override
 Reimplement to be able to let Qt lower windows to the bottom of the desktop.
 
bool isExposed () const override
 Returns if this window is exposed in the windowing system.
 
bool isEmbedded () const override
 Returns true if the window is a child of a non-Qt window.
 
bool isOpaque () const
 
void propagateSizeHints () override
 Reimplement to propagate the size hints of the QWindow.
 
void setOpacity (qreal level) override
 Reimplement to be able to let Qt set the opacity level of a window.
 
void setMask (const QRegion &region) override
 Reimplement to be able to let Qt set the mask of a window.
 
bool setKeyboardGrabEnabled (bool grab) override
 
bool setMouseGrabEnabled (bool grab) override
 
QMargins frameMargins () const override
 
QSurfaceFormat format () const override
 Returns the actual surface format of the window.
 
bool isForeignWindow () const override
 
void requestUpdate () override
 Requests an QEvent::UpdateRequest event.
 
bool updatesWithDisplayLink () const
 
void deliverUpdateRequest () override
 Delivers an QEvent::UpdateRequest event to the window.
 
void requestActivateWindow () override
 Reimplement to let Qt be able to request activation/focus for a window.
 
WId winId () const override
 Reimplement in subclasses to return a handle to the native window.
 
void setParent (const QPlatformWindow *window) override
 This function is called to enable native child window in QPA.
 
NSView * view () const
 
NSWindow * nativeWindow () const
 
void setEmbeddedInForeignView ()
 
 Q_NOTIFICATION_HANDLER (NSViewFrameDidChangeNotification) void viewDidChangeFrame()
 
 Q_NOTIFICATION_HANDLER (NSViewGlobalFrameDidChangeNotification) void viewDidChangeGlobalFrame()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidMoveNotification) void windowDidMove()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidResizeNotification) void windowDidResize()
 
 Q_NOTIFICATION_HANDLER (NSWindowWillStartLiveResizeNotification) void windowWillStartLiveResize()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidEndLiveResizeNotification) void windowDidEndLiveResize()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidBecomeKeyNotification) void windowDidBecomeKey()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidResignKeyNotification) void windowDidResignKey()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidMiniaturizeNotification) void windowDidMiniaturize()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidDeminiaturizeNotification) void windowDidDeminiaturize()
 
 Q_NOTIFICATION_HANDLER (NSWindowWillEnterFullScreenNotification) void windowWillEnterFullScreen()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidEnterFullScreenNotification) void windowDidEnterFullScreen()
 
 Q_NOTIFICATION_HANDLER (NSWindowWillExitFullScreenNotification) void windowWillExitFullScreen()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidExitFullScreenNotification) void windowDidExitFullScreen()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidOrderOnScreenAndFinishAnimatingNotification) void windowDidOrderOnScreen()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidOrderOffScreenNotification) void windowDidOrderOffScreen()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidChangeOcclusionStateNotification) void windowDidChangeOcclusionState()
 
 Q_NOTIFICATION_HANDLER (NSWindowDidChangeScreenNotification) void windowDidChangeScreen()
 
void windowWillZoom ()
 
bool windowShouldClose ()
 
bool windowIsPopupType (Qt::WindowType type=Qt::Widget) const
 
NSInteger windowLevel (Qt::WindowFlags flags)
 
NSUInteger windowStyleMask (Qt::WindowFlags flags)
 
void updateTitleBarButtons (Qt::WindowFlags flags)
 
bool isFixedSize () const
 
bool setWindowModified (bool modified) override
 Reimplement to be able to let Qt indicate that the window has been modified.
 
void setFrameStrutEventsEnabled (bool enabled) override
 Reimplement this method to set whether frame strut events should be sent to enabled.
 
bool frameStrutEventsEnabled () const override
 Reimplement this method to return whether frame strut events are enabled.
 
void setMenubar (QCocoaMenuBar *mb)
 
QCocoaMenuBarmenubar () const
 
void setWindowCursor (NSCursor *cursor)
 
void registerTouch (bool enable)
 
void registerContentBorderArea (quintptr identifier, int upper, int lower)
 
void setContentBorderAreaEnabled (quintptr identifier, bool enable)
 
void setContentBorderEnabled (bool enable) override
 
bool testContentBorderAreaPosition (int position) const
 
void applyContentBorderThickness (NSWindow *window=nullptr)
 
qreal devicePixelRatio () const override
 Reimplement this function in subclass to return the device pixel ratio for the window.
 
QWindowchildWindowAt (QPoint windowPoint)
 
bool shouldRefuseKeyWindowAndFirstResponder ()
 
bool windowEvent (QEvent *event) override
 Reimplement this method to be able to do any platform specific event handling.
 
QPoint bottomLeftClippedByNSWindowOffset () const override
 
void updateNormalGeometry ()
 
bool inLiveResize () const override
 
bool isContentView () const
 Checks if the window is the content view of its immediate NSWindow.
 
bool alwaysShowToolWindow () const
 
void handleGeometryChange ()
 
void handleWindowStateChanged (HandleFlags flags=NoHandleFlags)
 
void handleExposeEvent (const QRegion &region)
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 
- Public Member Functions inherited from QPlatformWindow
 QPlatformWindow (QWindow *window)
 Constructs a platform window with the given top level window.
 
 ~QPlatformWindow () override
 Virtual destructor does not delete its top level window.
 
QWindowwindow () const
 Returns the window which belongs to the QPlatformWindow.
 
QPlatformWindowparent () const
 Returns the parent platform window (or \nullptr if orphan).
 
QPlatformScreenscreen () const override
 Returns the platform screen handle corresponding to this platform window, or null if the window is not associated with a screen.
 
virtual QString windowTitle () const
 Reimplement to return the actual window title used in the underlying windowing system unless the title set for the QWindow which belongs to this QPlatformWindow (i.e.
 
virtual bool close ()
 Reimplement to let the platform handle non-spontaneous window close.
 
virtual bool isActive () const
 Returns true if the window should appear active from a style perspective.
 
virtual bool isAncestorOf (const QPlatformWindow *child) const
 Returns true if the window is an ancestor of the given child.
 
virtual QPoint mapToGlobal (const QPoint &pos) const
 Translates the window coordinate pos to global screen coordinates using native methods.
 
QPointF mapToGlobalF (const QPointF &pos) const
 
virtual QPoint mapFromGlobal (const QPoint &pos) const
 Translates the global screen coordinate pos to window coordinates using native methods.
 
QPointF mapFromGlobalF (const QPointF &pos) const
 
virtual void handleContentOrientationChange (Qt::ScreenOrientation orientation)
 Handle changes to the orientation of the platform window's contents.
 
virtual bool startSystemResize (Qt::Edges edges)
 Reimplement this method to start a system resize operation if the system supports it and return true to indicate success.
 
virtual void invalidateSurface ()
 Invalidates the window's surface by releasing its surface buffers.
 
bool hasPendingUpdateRequest () const
 Returns true if the window has a pending update request.
 
QSize windowMinimumSize () const
 Returns the QWindow minimum size.
 
QSize windowMaximumSize () const
 Returns the QWindow maximum size.
 
QSize windowBaseSize () const
 Returns the QWindow base size.
 
QSize windowSizeIncrement () const
 Returns the QWindow size increment.
 
QRect windowGeometry () const
 Returns the QWindow geometry.
 
QRect windowFrameGeometry () const
 Returns the QWindow frame geometry.
 
QRectF windowClosestAcceptableGeometry (const QRectF &nativeRect) const
 
- Public Member Functions inherited from QPlatformSurface
virtual ~QPlatformSurface ()
 
QSurfacesurface () const
 

Static Public Member Functions

static void closeAllPopups ()
 
static void setupPopupMonitor ()
 
static void removePopupMonitor ()
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Static Public Member Functions inherited from QPlatformWindow
static QRect initialGeometry (const QWindow *w, const QRect &initialGeometry, int defaultWidth, int defaultHeight, const QScreen **resultingScreenReturn=nullptr)
 Helper function to get initial geometry on windowing systems which do not do smart positioning and also do not provide a means of centering a transient window w.r.t.
 
static QRectF closestAcceptableGeometry (const QWindow *w, const QRectF &nativeRect)
 Returns the closest acceptable geometry for a given geometry before a resize/move event for platforms that support it, for example to implement heightForWidth().
 
- Static Public Member Functions inherited from QPlatformSurface
static bool isRasterSurface (QSurface *surface)
 

Public Attributes

NSView * m_view = nil
 
QCocoaNSWindow * m_nsWindow = nil
 
Qt::WindowStates m_lastReportedWindowState = Qt::WindowNoState
 
Qt::WindowModality m_windowModality = Qt::NonModal
 
bool m_initialized = false
 
bool m_inSetVisible = false
 
bool m_inSetGeometry = false
 
bool m_inSetStyleMask = false
 
bool m_inLiveResize = false
 
QCocoaMenuBarm_menubar = nullptr
 
bool m_frameStrutEventsEnabled = false
 
QRect m_exposedRect
 
QRect m_normalGeometry
 
int m_registerTouchCount = 0
 
bool m_resizableTransientParent = false
 
QMargins m_lastReportedSafeAreaMargins
 
NSInteger m_alertRequest = NoAlertRequest
 
bool m_drawContentBorderGradient = false
 
QHash< quintptr, BorderRangem_contentBorderAreas
 
QHash< quintptr, bool > m_enabledContentBorderAreas
 

Static Public Attributes

static QPointer< QCocoaWindows_windowUnderMouse
 
static const int NoAlertRequest = -1
 
static id s_globalMouseMonitor = 0
 
static id s_applicationActivationObserver = 0
 

Protected Member Functions

void recreateWindowIfNeeded ()
 Recreates (or removes) the NSWindow for this QWindow, if needed.
 
QCocoaNSWindow * createNSWindow (bool shouldBePanel)
 
Qt::WindowStates windowState () const
 
void applyWindowState (Qt::WindowStates newState)
 
void toggleMaximized ()
 
void toggleFullScreen ()
 
bool isTransitioningToFullScreen () const
 
bool startSystemMove () override
 Reimplement this method to start a system move operation if the system supports it and return true to indicate success.
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Member Functions inherited from QPlatformWindow
QPlatformScreenscreenForGeometry (const QRect &newGeometry) const
 Helper function for finding the new screen for newGeometry in response to a geometry changed event.
 

Friends

class QCocoaBackingStore
 
class QCocoaNativeInterface
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 
- Static Protected Member Functions inherited from QPlatformWindow
static QString formatWindowTitle (const QString &title, const QString &separator)
 Call this method to put together a window title composed of title separator the application display name.
 
static QSize constrainWindowSize (const QSize &size)
 Returns a size with both dimensions bounded to [0, QWINDOWSIZE_MAX].
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Attributes inherited from QPlatformWindow
QScopedPointer< QPlatformWindowPrivated_ptr
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

Definition at line 68 of file qcocoawindow.h.

Member Enumeration Documentation

◆ HandleFlags

Enumerator
NoHandleFlags 
HandleUnconditionally 

Definition at line 215 of file qcocoawindow.h.

◆ RecreationReason

Enumerator
RecreationNotNeeded 
ParentChanged 
MissingWindow 
WindowModalityChanged 
ContentViewChanged 
PanelChanged 

Definition at line 181 of file qcocoawindow.h.

Constructor & Destructor Documentation

◆ QCocoaWindow()

QCocoaWindow::QCocoaWindow ( QWindow * tlw,
WId nativeHandle = 0 )

Definition at line 102 of file qcocoawindow.mm.

◆ ~QCocoaWindow()

QCocoaWindow::~QCocoaWindow ( )

Definition at line 147 of file qcocoawindow.mm.

References isForeignWindow().

+ Here is the call graph for this function:

Member Function Documentation

◆ alwaysShowToolWindow()

bool QCocoaWindow::alwaysShowToolWindow ( ) const

Definition at line 1935 of file qcocoawindow.mm.

◆ applyContentBorderThickness()

void QCocoaWindow::applyContentBorderThickness ( NSWindow * window = nullptr)

Definition at line 2025 of file qcocoawindow.mm.

◆ applyWindowState()

void QCocoaWindow::applyWindowState ( Qt::WindowStates newState)
protected

Definition at line 763 of file qcocoawindow.mm.

◆ bottomLeftClippedByNSWindowOffset()

QPoint QCocoaWindow::bottomLeftClippedByNSWindowOffset ( ) const
override

Definition at line 2165 of file qcocoawindow.mm.

◆ childWindowAt()

QWindow * QCocoaWindow::childWindowAt ( QPoint windowPoint)

Definition at line 2106 of file qcocoawindow.mm.

◆ closeAllPopups()

void QCocoaWindow::closeAllPopups ( )
static

Definition at line 1740 of file qcocoawindow.mm.

◆ createNSWindow()

QCocoaNSWindow * QCocoaWindow::createNSWindow ( bool shouldBePanel)
protected

Definition at line 1806 of file qcocoawindow.mm.

◆ deliverUpdateRequest()

void QCocoaWindow::deliverUpdateRequest ( )
overridevirtual

Delivers an QEvent::UpdateRequest event to the window.

QPlatformWindow subclasses can re-implement this function to provide e.g. logging or tracing of the delivery, but should always call the base class function.

Reimplemented from QPlatformWindow.

Definition at line 1707 of file qcocoawindow.mm.

◆ devicePixelRatio()

qreal QCocoaWindow::devicePixelRatio ( ) const
overridevirtual

Reimplement this function in subclass to return the device pixel ratio for the window.

This is the ratio between physical pixels and device-independent pixels.

See also
QPlatformWindow::devicePixelRatio();

Reimplemented from QPlatformWindow.

Definition at line 2095 of file qcocoawindow.mm.

◆ format()

QSurfaceFormat QCocoaWindow::format ( ) const
overridevirtual

Returns the actual surface format of the window.

Reimplemented from QPlatformWindow.

Definition at line 189 of file qcocoawindow.mm.

◆ frameMargins()

QMargins QCocoaWindow::frameMargins ( ) const
overridevirtual

Reimplemented from QPlatformWindow.

Definition at line 2176 of file qcocoawindow.mm.

◆ frameStrutEventsEnabled()

bool QCocoaWindow::frameStrutEventsEnabled ( ) const
inlineoverridevirtual

Reimplement this method to return whether frame strut events are enabled.

Reimplemented from QPlatformWindow.

Definition at line 155 of file qcocoawindow.h.

References m_frameStrutEventsEnabled.

◆ geometry()

QRect QCocoaWindow::geometry ( ) const
overridevirtual

Returns the current geometry of a window.

Reimplemented from QPlatformWindow.

Definition at line 226 of file qcocoawindow.mm.

References isEmbedded().

+ Here is the call graph for this function:

◆ handleExposeEvent()

void QCocoaWindow::handleExposeEvent ( const QRegion & region)

Definition at line 1531 of file qcocoawindow.mm.

◆ handleGeometryChange()

void QCocoaWindow::handleGeometryChange ( )

Definition at line 1482 of file qcocoawindow.mm.

◆ handleWindowStateChanged()

void QCocoaWindow::handleWindowStateChanged ( HandleFlags flags = NoHandleFlags)

Definition at line 984 of file qcocoawindow.mm.

◆ initialize()

void QCocoaWindow::initialize ( )
overridevirtual

Called as part of QWindow::create(), after constructing the window.

Platforms should prefer to do initialization here instead of in the constructor, as the platform window object will be fully constructed, and associated to the corresponding QWindow, allowing synchronous event delivery.

Reimplemented from QPlatformWindow.

Definition at line 112 of file qcocoawindow.mm.

References isForeignWindow(), m_initialized, and recreateWindowIfNeeded().

+ Here is the call graph for this function:

◆ inLiveResize()

bool QCocoaWindow::inLiveResize ( ) const
override

Definition at line 1304 of file qcocoawindow.mm.

◆ isAlertState()

bool QCocoaWindow::isAlertState ( ) const
overridevirtual

Reimplement this method return whether the window is in an alert state.

See also
setAlertState()
Since
5.1

Reimplemented from QPlatformWindow.

Definition at line 1062 of file qcocoawindow.mm.

◆ isContentView()

bool QCocoaWindow::isContentView ( ) const

Checks if the window is the content view of its immediate NSWindow.

Being the content view of a NSWindow means the QWindow is the highest accessible NSView object in the window's view hierarchy.

This is the case if the QWindow is a top level window.

Definition at line 1580 of file qcocoawindow.mm.

◆ isEmbedded()

bool QCocoaWindow::isEmbedded ( ) const
overridevirtual

Returns true if the window is a child of a non-Qt window.

A embedded window has no parent platform window as reflected though parent(), but will have a native parent window.

Reimplemented from QPlatformWindow.

Definition at line 1109 of file qcocoawindow.mm.

Referenced by geometry().

+ Here is the caller graph for this function:

◆ isExposed()

bool QCocoaWindow::isExposed ( ) const
overridevirtual

Returns if this window is exposed in the windowing system.

An exposeEvent() is sent every time this value changes.

Reimplemented from QPlatformWindow.

Definition at line 1104 of file qcocoawindow.mm.

◆ isFixedSize()

bool QCocoaWindow::isFixedSize ( ) const

Definition at line 639 of file qcocoawindow.mm.

◆ isForeignWindow()

bool QCocoaWindow::isForeignWindow ( ) const
overridevirtual

Reimplemented from QPlatformWindow.

Definition at line 221 of file qcocoawindow.mm.

Referenced by ~QCocoaWindow(), and initialize().

+ Here is the caller graph for this function:

◆ isOpaque()

bool QCocoaWindow::isOpaque ( ) const

Definition at line 1125 of file qcocoawindow.mm.

◆ isTransitioningToFullScreen()

bool QCocoaWindow::isTransitioningToFullScreen ( ) const
protected

Definition at line 907 of file qcocoawindow.mm.

◆ lower()

void QCocoaWindow::lower ( )
overridevirtual

Reimplement to be able to let Qt lower windows to the bottom of the desktop.

Reimplemented from QPlatformWindow.

Definition at line 1092 of file qcocoawindow.mm.

◆ menubar()

QCocoaMenuBar * QCocoaWindow::menubar ( ) const

Definition at line 1954 of file qcocoawindow.mm.

Referenced by QCocoaMenuBar::updateMenuBarImmediately().

+ Here is the caller graph for this function:

◆ nativeWindow()

NSWindow * QCocoaWindow::nativeWindow ( ) const

Definition at line 1231 of file qcocoawindow.mm.

◆ normalGeometry()

QRect QCocoaWindow::normalGeometry ( ) const
overridevirtual

the geometry of the window as it will appear when shown as a normal (not maximized or full screen) top-level window.

For child windows this property always holds an empty rectangle.

See also
QWidget::normalGeometry()

Reimplemented from QPlatformWindow.

Definition at line 251 of file qcocoawindow.mm.

◆ propagateSizeHints()

void QCocoaWindow::propagateSizeHints ( )
overridevirtual

Reimplement to propagate the size hints of the QWindow.

The size hints include QWindow::minimumSize(), QWindow::maximumSize(), QWindow::sizeIncrement(), and QWindow::baseSize().

Reimplemented from QPlatformWindow.

Definition at line 1138 of file qcocoawindow.mm.

◆ Q_NOTIFICATION_HANDLER() [1/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSViewFrameDidChangeNotification )

◆ Q_NOTIFICATION_HANDLER() [2/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSViewGlobalFrameDidChangeNotification )

◆ Q_NOTIFICATION_HANDLER() [3/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidBecomeKeyNotification )

◆ Q_NOTIFICATION_HANDLER() [4/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidChangeOcclusionStateNotification )

◆ Q_NOTIFICATION_HANDLER() [5/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidChangeScreenNotification )

◆ Q_NOTIFICATION_HANDLER() [6/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidDeminiaturizeNotification )

◆ Q_NOTIFICATION_HANDLER() [7/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidEndLiveResizeNotification )

◆ Q_NOTIFICATION_HANDLER() [8/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidEnterFullScreenNotification )

◆ Q_NOTIFICATION_HANDLER() [9/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidExitFullScreenNotification )

◆ Q_NOTIFICATION_HANDLER() [10/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidMiniaturizeNotification )

◆ Q_NOTIFICATION_HANDLER() [11/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidMoveNotification )

◆ Q_NOTIFICATION_HANDLER() [12/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidOrderOffScreenNotification )

◆ Q_NOTIFICATION_HANDLER() [13/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidOrderOnScreenAndFinishAnimatingNotification )

◆ Q_NOTIFICATION_HANDLER() [14/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidResignKeyNotification )

◆ Q_NOTIFICATION_HANDLER() [15/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowDidResizeNotification )

◆ Q_NOTIFICATION_HANDLER() [16/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowWillEnterFullScreenNotification )

◆ Q_NOTIFICATION_HANDLER() [17/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowWillExitFullScreenNotification )

◆ Q_NOTIFICATION_HANDLER() [18/18]

QCocoaWindow::Q_NOTIFICATION_HANDLER ( NSWindowWillStartLiveResizeNotification )

◆ raise()

void QCocoaWindow::raise ( )
overridevirtual

Reimplement to be able to let Qt raise windows to the top of the desktop.

Reimplemented from QPlatformWindow.

Definition at line 1067 of file qcocoawindow.mm.

◆ recreateWindowIfNeeded()

void QCocoaWindow::recreateWindowIfNeeded ( )
protected

Recreates (or removes) the NSWindow for this QWindow, if needed.

A QWindow may need a corresponding NSWindow/NSPanel, depending on whether or not it's a top level or not, window flags, etc.

Definition at line 1591 of file qcocoawindow.mm.

Referenced by initialize().

+ Here is the caller graph for this function:

◆ registerContentBorderArea()

void QCocoaWindow::registerContentBorderArea ( quintptr identifier,
int upper,
int lower )

Definition at line 2007 of file qcocoawindow.mm.

◆ registerTouch()

void QCocoaWindow::registerTouch ( bool enable)

Definition at line 1998 of file qcocoawindow.mm.

◆ removePopupMonitor()

void QCocoaWindow::removePopupMonitor ( )
static

Definition at line 1747 of file qcocoawindow.mm.

◆ requestActivateWindow()

void QCocoaWindow::requestActivateWindow ( )
overridevirtual

Reimplement to let Qt be able to request activation/focus for a window.

Some window systems will probably not have callbacks for this functionality, and then calling QWindowSystemInterface::handleFocusWindowChanged(QWindow *w) would be sufficient.

If the window system has some event handling/callbacks then call QWindowSystemInterface::handleFocusWindowChanged(QWindow *w) when the window system gives the notification.

Default implementation calls QWindowSystem::handleFocusWindowChanged(QWindow *w)

Reimplemented from QPlatformWindow.

Definition at line 1730 of file qcocoawindow.mm.

◆ requestUpdate()

void QCocoaWindow::requestUpdate ( )
overridevirtual

Requests an QEvent::UpdateRequest event.

The event will be delivered to the QWindow.

QPlatformWindow subclasses can re-implement this function to provide display refresh synchronized updates. The event should be delivered using QPlatformWindow::deliverUpdateRequest() to not get out of sync with the internal state of QWindow.

The default implementation posts an UpdateRequest event to the window after an interval that is at most 5 ms. If the window's associated screen reports a \l{QPlatformScreen::refreshRate()}{refresh rate} higher than 60 Hz, the interval is scaled down to a valid smaller than 5. The additional time is there to give the event loop a bit of idle time to gather system events.

Reimplemented from QPlatformWindow.

Definition at line 1685 of file qcocoawindow.mm.

◆ safeAreaMargins()

QMargins QCocoaWindow::safeAreaMargins ( ) const
overridevirtual

The safe area margins of a window represent the area that is safe to place content within, without intersecting areas of the screen where system UI is placed, or where a screen bezel may cover the content.

Reimplemented from QPlatformWindow.

Definition at line 301 of file qcocoawindow.mm.

◆ setAlertState()

void QCocoaWindow::setAlertState ( bool enable)
overridevirtual

Reimplement this method to set whether the window demands attention (for example, by flashing the taskbar icon) depending on enabled.

See also
isAlertState()
Since
5.1

Reimplemented from QPlatformWindow.

Definition at line 1052 of file qcocoawindow.mm.

◆ setCocoaGeometry()

void QCocoaWindow::setCocoaGeometry ( const QRect & rect)

Definition at line 277 of file qcocoawindow.mm.

◆ setContentBorderAreaEnabled()

void QCocoaWindow::setContentBorderAreaEnabled ( quintptr identifier,
bool enable )

Definition at line 2013 of file qcocoawindow.mm.

◆ setContentBorderEnabled()

void QCocoaWindow::setContentBorderEnabled ( bool enable)
override

Definition at line 2019 of file qcocoawindow.mm.

◆ setEmbeddedInForeignView()

void QCocoaWindow::setEmbeddedInForeignView ( )

Definition at line 1236 of file qcocoawindow.mm.

◆ setFrameStrutEventsEnabled()

void QCocoaWindow::setFrameStrutEventsEnabled ( bool enabled)
overridevirtual

Reimplement this method to set whether frame strut events should be sent to enabled.

See also
frameStrutEventsEnabled

Reimplemented from QPlatformWindow.

Definition at line 2190 of file qcocoawindow.mm.

◆ setGeometry()

void QCocoaWindow::setGeometry ( const QRect & rect)
overridevirtual

This function is called by Qt whenever a window is moved or resized using the QWindow API.

Unless you also override QPlatformWindow::geometry(), you need to call the baseclass implementation of this function in any override of QPlatformWindow::setGeometry(), as QWindow::geometry() is expected to report back the set geometry until a confirmation (or rejection) of the new geometry comes back from the window manager and is reported via QWindowSystemInterface::handleGeometryChange().

Window move/resizes can also be triggered spontaneously by the window manager, or as a response to an earlier requested move/resize via the Qt APIs. There is no need to call this function from the window manager callback, instead call QWindowSystemInterface::handleGeometryChange().

The position(x, y) part of the rect might be inclusive or exclusive of the window frame as returned by frameMargins(). You can detect this in the plugin by checking qt_window_private(window())->positionPolicy.

Reimplemented from QPlatformWindow.

Definition at line 203 of file qcocoawindow.mm.

◆ setKeyboardGrabEnabled()

bool QCocoaWindow::setKeyboardGrabEnabled ( bool grab)
overridevirtual

Reimplemented from QPlatformWindow.

Definition at line 1201 of file qcocoawindow.mm.

◆ setMask()

void QCocoaWindow::setMask ( const QRegion & region)
overridevirtual

Reimplement to be able to let Qt set the mask of a window.

Reimplemented from QPlatformWindow.

Definition at line 1185 of file qcocoawindow.mm.

◆ setMenubar()

void QCocoaWindow::setMenubar ( QCocoaMenuBar * mb)

Definition at line 1949 of file qcocoawindow.mm.

◆ setMouseGrabEnabled()

bool QCocoaWindow::setMouseGrabEnabled ( bool grab)
overridevirtual

Reimplemented from QPlatformWindow.

Definition at line 1206 of file qcocoawindow.mm.

◆ setOpacity()

void QCocoaWindow::setOpacity ( qreal level)
overridevirtual

Reimplement to be able to let Qt set the opacity level of a window.

Reimplemented from QPlatformWindow.

Definition at line 1176 of file qcocoawindow.mm.

◆ setParent()

void QCocoaWindow::setParent ( const QPlatformWindow * parent)
overridevirtual

This function is called to enable native child window in QPA.

It is common not to support this feature in Window systems, but can be faked. When this function is called all geometry of this platform window will be relative to the parent.

Reimplemented from QPlatformWindow.

Definition at line 1216 of file qcocoawindow.mm.

◆ setupPopupMonitor()

void QCocoaWindow::setupPopupMonitor ( )
static

Definition at line 1759 of file qcocoawindow.mm.

◆ setVisible()

void QCocoaWindow::setVisible ( bool visible)
overridevirtual

Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.

The default implementation sends a synchronous expose event.

Reimplemented from QPlatformWindow.

Definition at line 368 of file qcocoawindow.mm.

◆ setWindowCursor()

void QCocoaWindow::setWindowCursor ( NSCursor * cursor)

Definition at line 1959 of file qcocoawindow.mm.

◆ setWindowFilePath()

void QCocoaWindow::setWindowFilePath ( const QString & title)
overridevirtual

Reimplement to set the window file path to filePath.

Reimplemented from QPlatformWindow.

Definition at line 1014 of file qcocoawindow.mm.

◆ setWindowFlags()

void QCocoaWindow::setWindowFlags ( Qt::WindowFlags flags)
overridevirtual

Requests setting the window flags of this surface to flags.

Reimplemented from QPlatformWindow.

Definition at line 692 of file qcocoawindow.mm.

◆ setWindowIcon()

void QCocoaWindow::setWindowIcon ( const QIcon & icon)
overridevirtual

Reimplement to set the window icon to icon.

Reimplemented from QPlatformWindow.

Definition at line 1030 of file qcocoawindow.mm.

◆ setWindowModified()

bool QCocoaWindow::setWindowModified ( bool modified)
overridevirtual

Reimplement to be able to let Qt indicate that the window has been modified.

Return true if the native window supports setting the modified flag, false otherwise.

Reimplemented from QPlatformWindow.

Definition at line 1940 of file qcocoawindow.mm.

◆ setWindowState()

void QCocoaWindow::setWindowState ( Qt::WindowStates state)
overridevirtual

Changes the state of the NSWindow, going in/out of minimize/zoomed/fullscreen.

When this is called from QWindow::setWindowState(), the QWindow state has not been updated yet, so window()->windowState() will reflect the previous state that was reported to QtGui.

Reimplemented from QPlatformWindow.

Definition at line 757 of file qcocoawindow.mm.

◆ setWindowTitle()

void QCocoaWindow::setWindowTitle ( const QString & title)
overridevirtual

Reimplement to set the window title to title.

The implementation might want to append the application display name to the window title, like Windows and Linux do.

\l QPlatformWindow::windowTitle() can be used to retrieve the actual window title.

See also
QGuiApplication::applicationDisplayName()
QPlatformWindow::windowTitle()

Reimplemented from QPlatformWindow.

Definition at line 1000 of file qcocoawindow.mm.

◆ shouldRefuseKeyWindowAndFirstResponder()

bool QCocoaWindow::shouldRefuseKeyWindowAndFirstResponder ( )

Definition at line 2118 of file qcocoawindow.mm.

◆ startSystemMove()

bool QCocoaWindow::startSystemMove ( )
overrideprotectedvirtual

Reimplement this method to start a system move operation if the system supports it and return true to indicate success.

The default implementation is empty and does nothing.

Since
5.15

Reimplemented from QPlatformWindow.

Definition at line 349 of file qcocoawindow.mm.

◆ testContentBorderAreaPosition()

bool QCocoaWindow::testContentBorderAreaPosition ( int position) const

Definition at line 2080 of file qcocoawindow.mm.

◆ toggleFullScreen()

void QCocoaWindow::toggleFullScreen ( )
protected

Definition at line 881 of file qcocoawindow.mm.

◆ toggleMaximized()

void QCocoaWindow::toggleMaximized ( )
protected

Definition at line 860 of file qcocoawindow.mm.

◆ updateNormalGeometry()

void QCocoaWindow::updateNormalGeometry ( )

Definition at line 266 of file qcocoawindow.mm.

◆ updatesWithDisplayLink()

bool QCocoaWindow::updatesWithDisplayLink ( ) const

Definition at line 1701 of file qcocoawindow.mm.

◆ updateTitleBarButtons()

void QCocoaWindow::updateTitleBarButtons ( Qt::WindowFlags flags)

Definition at line 645 of file qcocoawindow.mm.

◆ view()

NSView * QCocoaWindow::view ( ) const

Definition at line 1226 of file qcocoawindow.mm.

◆ windowEvent()

bool QCocoaWindow::windowEvent ( QEvent * event)
overridevirtual

Reimplement this method to be able to do any platform specific event handling.

All non-synthetic events for window() are passed to this function before being sent to QWindow::event().

Return true if the event should not be passed on to the QWindow.

Subclasses should always call the base class implementation.

Reimplemented from QPlatformWindow.

Definition at line 2151 of file qcocoawindow.mm.

◆ windowIsPopupType()

bool QCocoaWindow::windowIsPopupType ( Qt::WindowType type = Qt::Widget) const

Definition at line 1561 of file qcocoawindow.mm.

◆ windowLevel()

NSInteger QCocoaWindow::windowLevel ( Qt::WindowFlags flags)

Definition at line 531 of file qcocoawindow.mm.

◆ windowShouldClose()

bool QCocoaWindow::windowShouldClose ( )

Definition at line 1461 of file qcocoawindow.mm.

◆ windowState()

Qt::WindowStates QCocoaWindow::windowState ( ) const
protected

Definition at line 837 of file qcocoawindow.mm.

◆ windowStyleMask()

NSUInteger QCocoaWindow::windowStyleMask ( Qt::WindowFlags flags)

Definition at line 583 of file qcocoawindow.mm.

◆ windowWillZoom()

void QCocoaWindow::windowWillZoom ( )

Definition at line 876 of file qcocoawindow.mm.

◆ winId()

WId QCocoaWindow::winId ( ) const
overridevirtual

Reimplement in subclasses to return a handle to the native window.

Reimplemented from QPlatformWindow.

Definition at line 1211 of file qcocoawindow.mm.

Friends And Related Symbol Documentation

◆ QCocoaBackingStore

friend class QCocoaBackingStore
friend

Definition at line 208 of file qcocoawindow.h.

◆ QCocoaNativeInterface

friend class QCocoaNativeInterface
friend

Definition at line 209 of file qcocoawindow.h.

Member Data Documentation

◆ m_alertRequest

NSInteger QCocoaWindow::m_alertRequest = NoAlertRequest

Definition at line 253 of file qcocoawindow.h.

◆ m_contentBorderAreas

QHash<quintptr, BorderRange> QCocoaWindow::m_contentBorderAreas

Definition at line 266 of file qcocoawindow.h.

◆ m_drawContentBorderGradient

bool QCocoaWindow::m_drawContentBorderGradient = false

Definition at line 255 of file qcocoawindow.h.

◆ m_enabledContentBorderAreas

QHash<quintptr, bool> QCocoaWindow::m_enabledContentBorderAreas

Definition at line 267 of file qcocoawindow.h.

◆ m_exposedRect

QRect QCocoaWindow::m_exposedRect

Definition at line 245 of file qcocoawindow.h.

◆ m_frameStrutEventsEnabled

bool QCocoaWindow::m_frameStrutEventsEnabled = false

Definition at line 244 of file qcocoawindow.h.

Referenced by frameStrutEventsEnabled().

◆ m_initialized

bool QCocoaWindow::m_initialized = false

Definition at line 236 of file qcocoawindow.h.

Referenced by initialize().

◆ m_inLiveResize

bool QCocoaWindow::m_inLiveResize = false

Definition at line 240 of file qcocoawindow.h.

◆ m_inSetGeometry

bool QCocoaWindow::m_inSetGeometry = false

Definition at line 238 of file qcocoawindow.h.

◆ m_inSetStyleMask

bool QCocoaWindow::m_inSetStyleMask = false

Definition at line 239 of file qcocoawindow.h.

◆ m_inSetVisible

bool QCocoaWindow::m_inSetVisible = false

Definition at line 237 of file qcocoawindow.h.

◆ m_lastReportedSafeAreaMargins

QMargins QCocoaWindow::m_lastReportedSafeAreaMargins

Definition at line 250 of file qcocoawindow.h.

◆ m_lastReportedWindowState

Qt::WindowStates QCocoaWindow::m_lastReportedWindowState = Qt::WindowNoState

Definition at line 231 of file qcocoawindow.h.

◆ m_menubar

QCocoaMenuBar* QCocoaWindow::m_menubar = nullptr

Definition at line 242 of file qcocoawindow.h.

◆ m_normalGeometry

QRect QCocoaWindow::m_normalGeometry

Definition at line 246 of file qcocoawindow.h.

◆ m_nsWindow

QCocoaNSWindow* QCocoaWindow::m_nsWindow = nil

Definition at line 229 of file qcocoawindow.h.

◆ m_registerTouchCount

int QCocoaWindow::m_registerTouchCount = 0

Definition at line 247 of file qcocoawindow.h.

◆ m_resizableTransientParent

bool QCocoaWindow::m_resizableTransientParent = false

Definition at line 248 of file qcocoawindow.h.

◆ m_view

NSView* QCocoaWindow::m_view = nil

Definition at line 228 of file qcocoawindow.h.

◆ m_windowModality

Qt::WindowModality QCocoaWindow::m_windowModality = Qt::NonModal

Definition at line 232 of file qcocoawindow.h.

◆ NoAlertRequest

const int QCocoaWindow::NoAlertRequest = -1
static

Definition at line 252 of file qcocoawindow.h.

◆ s_applicationActivationObserver

id QCocoaWindow::s_applicationActivationObserver = 0
inlinestatic

Definition at line 270 of file qcocoawindow.h.

◆ s_globalMouseMonitor

id QCocoaWindow::s_globalMouseMonitor = 0
inlinestatic

Definition at line 269 of file qcocoawindow.h.

◆ s_windowUnderMouse

QPointer< QCocoaWindow > QCocoaWindow::s_windowUnderMouse
static

Definition at line 234 of file qcocoawindow.h.


The documentation for this class was generated from the following files: