Qt 4.8
Functions | Variables
qwidget_qpa.cpp File Reference
#include "QtGui/qwidget.h"
#include "QtGui/qevent.h"
#include "QtGui/qapplication.h"
#include "QtGui/private/qbackingstore_p.h"
#include "QtGui/private/qwidget_p.h"
#include "QtGui/private/qgraphicssystem_p.h"
#include "QtGui/private/qapplication_p.h"
#include "QtGui/qdesktopwidget.h"
#include "QtGui/qplatformwindow_qpa.h"
#include "QtGui/qplatformglcontext_qpa.h"
#include <QtGui/QPlatformCursor>

Go to the source code of this file.

Functions

static Qt::WindowStates effectiveState (Qt::WindowStates state)
 
void q_createNativeChildrenAndSetParent (QPlatformWindow *parentWindow, const QWidget *parentWidget)
 
void qt_qpa_set_cursor (QWidget *w, bool force)
 

Variables

static QWidgetkeyboardGrb = 0
 
QWidgetqt_mouseGrb = 0
 
QWidgetqt_pressGrab = 0
 

Function Documentation

◆ effectiveState()

static Qt::WindowStates effectiveState ( Qt::WindowStates  state)
static

Definition at line 468 of file qwidget_qpa.cpp.

469  {
470  if (state & Qt::WindowMinimized)
471  return Qt::WindowMinimized;
472  else if (state & Qt::WindowFullScreen)
473  return Qt::WindowFullScreen;
474  else if (state & Qt::WindowMaximized)
475  return Qt::WindowMaximized;
476  return Qt::WindowNoState;
477  }

◆ q_createNativeChildrenAndSetParent()

void q_createNativeChildrenAndSetParent ( QPlatformWindow parentWindow,
const QWidget parentWidget 
)

Definition at line 57 of file qwidget_qpa.cpp.

58 {
59  QObjectList children = parentWidget->children();
60  for (int i = 0; i < children.size(); i++) {
61  if (children.at(i)->isWidgetType()) {
62  const QWidget *childWidget = qobject_cast<const QWidget *>(children.at(i));
63  if (childWidget) { // should not be necessary
64  if (childWidget->testAttribute(Qt::WA_NativeWindow)) {
65  if (!childWidget->platformWindow())
66  childWidget->winId();
67  }
68  if (childWidget->platformWindow()) {
69  childWidget->platformWindow()->setParent(parentWindow);
70  } else {
71  q_createNativeChildrenAndSetParent(parentWindow,childWidget);
72  }
73  }
74  }
75  }
76 
77 }
void q_createNativeChildrenAndSetParent(QPlatformWindow *parentWindow, const QWidget *parentWidget)
Definition: qwidget_qpa.cpp:57
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
T * qobject_cast(QObject *object)
Definition: qobject.h:375
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
Definition: qobject.h:146
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557

◆ qt_qpa_set_cursor()

void qt_qpa_set_cursor ( QWidget w,
bool  force 
)

Definition at line 872 of file qwidget_qpa.cpp.

Referenced by QApplicationPrivate::dispatchEnterLeave(), and q_createNativeChildrenAndSetParent().

873 {
874  static QCursor arrowCursor(Qt::ArrowCursor);
875  static QPointer<QWidget> lastUnderMouse = 0;
876 
877  QCursor * override = QApplication::overrideCursor();
878 
879  if (override && w != 0)
880  return;
881 
882  QWidget *cursorWidget;
883  QCursor cursorCursor;
884 
885  do {
886  if (w == 0) {
887  if (override) {
888  cursorCursor = *override;
889  cursorWidget = QApplication::topLevelAt(QCursor::pos());
890  break;
891  }
893  if (w == 0) // clear the override cursor while over empty space
894  w = QApplication::desktop();
895  } else if (force) {
896  lastUnderMouse = w;
897  } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse
898  && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) {
899  w = lastUnderMouse;
900  }
901  if (w == QApplication::desktop() && !override) {
902  cursorCursor = arrowCursor;
903  cursorWidget = w;
904  break;
905  }
906 
908  if (!curWin && w && w->internalWinId())
909  return;
910  QWidget* cW = w && !w->internalWinId() ? w : curWin;
911 
912  if (!cW || cW->window() != w->window() ||
913  !cW->isVisible() || !cW->underMouse() || override)
914  return;
915 
916  cursorCursor = w->cursor();
917  cursorWidget = w;
918  } while (0);
920  if (cursor)
921  cursor.data()->changeCursor(&cursorCursor, cursorWidget);
922 }
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
WId effectiveWinId() const
Returns the effective window system identifier of the widget, i.
Definition: qwidget.cpp:2654
bool isVisible() const
Definition: qwidget.h:1005
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or 0 if no application wi...
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool underMouse() const
Returns true if the widget is under the mouse cursor; otherwise returns false.
Definition: qwidget.h:996
T * data() const
static HWND curWin
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
static QCursor * overrideCursor()
Strips out vertical alignment flags and transforms an alignment align of Qt::AlignLeft into Qt::Align...
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
virtual void changeCursor(QCursor *widgetCursor, QWidget *widget)=0
This method is called by Qt whenever the cursor graphic should be changed.
QCursor cursor
the cursor shape for this widget
Definition: qwidget.h:183
static QWidget * topLevelAt(const QPoint &p)
Returns the top-level widget at the given point; returns 0 if there is no such widget.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
static QList< QWeakPointer< QPlatformCursor > > getInstances()
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
Definition: qcursor_mac.mm:310
The QWeakPointer class holds a weak reference to a shared pointer.

Variable Documentation

◆ keyboardGrb

QWidget* keyboardGrb = 0
static

Definition at line 312 of file qwidget_qpa.cpp.

◆ qt_mouseGrb

QWidget* qt_mouseGrb = 0

Definition at line 311 of file qwidget_qpa.cpp.

Referenced by isServerProcess().

◆ qt_pressGrab

QWidget* qt_pressGrab = 0

Definition at line 310 of file qwidget_qpa.cpp.

Referenced by isServerProcess().