Qt 4.8
Public Functions | Properties | List of all members
QUIKitWindow Class Reference

#include <quikitwindow.h>

Inheritance diagram for QUIKitWindow:
QPlatformWindow

Public Functions

UIWindow * ensureNativeWindow ()
 
QPlatformGLContextglContext () const
 Reimplement to return the glContext associated with the window. More...
 
EAGLViewnativeView () const
 
UIWindow * nativeWindow () const
 
QUIKitScreenplatformScreen () const
 
 QUIKitWindow (QWidget *tlw)
 
void setGeometry (const QRect &rect)
 This function is called by Qt whenever a window is moved or the window is resized. More...
 
void updateGeometryAndOrientation ()
 
 ~QUIKitWindow ()
 
- Public Functions inherited from QPlatformWindow
virtual QRect geometry () const
 Returnes the current geometry of a window. More...
 
virtual void lower ()
 Reimplement to be able to let Qt lower windows to the bottom of the desktop. More...
 
 QPlatformWindow (QWidget *tlw)
 Constructs a platform window with the given top level widget. More...
 
virtual void raise ()
 Reimplement to be able to let Qt rais windows to the top of the desktop. More...
 
virtual void requestActivateWindow ()
 Reimplement to let Qt be able to request activation/focus for a window. More...
 
virtual void setOpacity (qreal level)
 Reimplement to be able to let Qt set the opacity level of a window. More...
 
virtual void setParent (const QPlatformWindow *window)
 This function is called to enable native child widgets in QPA. More...
 
virtual void setVisible (bool visible)
 Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false. More...
 
virtual Qt::WindowFlags setWindowFlags (Qt::WindowFlags flags)
 Requests setting the window flags of this surface to type. More...
 
virtual void setWindowTitle (const QString &title)
 Reimplement to set the window title to title. More...
 
QWidgetwidget () const
 Returnes the widget which belongs to the QPlatformWindow. More...
 
virtual Qt::WindowFlags windowFlags () const
 Returns the effective window flags for this surface. More...
 
virtual WId winId () const
 Reimplement in subclasses to return a handle to the native window. More...
 
virtual ~QPlatformWindow ()
 Virtual destructor does not delete its top level widget. More...
 

Properties

EAGLPlatformContextmContext
 
CGRect mFrame
 
QUIKitScreenmScreen
 
EAGLViewmView
 
UIWindow * mWindow
 

Additional Inherited Members

- Protected Variables inherited from QPlatformWindow
QScopedPointer< QPlatformWindowPrivated_ptr
 

Detailed Description

Definition at line 109 of file quikitwindow.h.

Constructors and Destructors

◆ QUIKitWindow()

QUIKitWindow::QUIKitWindow ( QWidget tlw)
explicit

Definition at line 339 of file quikitwindow.mm.

339  :
340  QPlatformWindow(tlw),
341  mWindow(nil),
342  mContext(0)
343 {
345  mView = [[EAGLView alloc] init];
346 }
EAGLPlatformContext * mContext
Definition: quikitwindow.h:131
QPlatformWindow(QWidget *tlw)
Constructs a platform window with the given top level widget.
UIWindow * mWindow
Definition: quikitwindow.h:128
static QPlatformScreen * platformScreenForWidget(const QWidget *widget)
EAGLView * mView
Definition: quikitwindow.h:130
QUIKitScreen * mScreen
Definition: quikitwindow.h:127

◆ ~QUIKitWindow()

QUIKitWindow::~QUIKitWindow ( )

Definition at line 348 of file quikitwindow.mm.

349 {
350  delete mContext; mContext = 0;
351  [mView release];
352  [mWindow release];
353 }
EAGLPlatformContext * mContext
Definition: quikitwindow.h:131

Functions

◆ ensureNativeWindow()

UIWindow * QUIKitWindow::ensureNativeWindow ( )

Definition at line 361 of file quikitwindow.mm.

362 {
363  if (!mWindow) {
364  mWindow = [[UIWindow alloc] init];
366  // window
367  mWindow.screen = mScreen->uiScreen();
368  // for some reason setting the screen resets frame.origin, so we need to set the frame afterwards
369  mWindow.frame = mFrame;
370 
371  // view
372  [mView deleteFramebuffer];
373  mView.frame = CGRectMake(0, 0, mWindow.bounds.size.width, mWindow.bounds.size.height); // fill
374  [mView setContentScaleFactor:[mWindow.screen scale]];
375  [mView setMultipleTouchEnabled:YES];
376  [mView setWindow:this];
377  [mWindow addSubview:mView];
378  [mWindow setNeedsDisplay];
379  [mWindow makeKeyAndVisible];
380  }
381  return mWindow;
382 }
UIWindow * mWindow
Definition: quikitwindow.h:128
void updateGeometryAndOrientation()
EAGLView * mView
Definition: quikitwindow.h:130
QUIKitScreen * mScreen
Definition: quikitwindow.h:127
UIScreen * uiScreen() const
Definition: quikitscreen.mm:85

◆ glContext()

QPlatformGLContext * QUIKitWindow::glContext ( ) const
virtual

Reimplement to return the glContext associated with the window.

Reimplemented from QPlatformWindow.

Definition at line 433 of file quikitwindow.mm.

434 {
435  if (!mContext) {
437  }
438  return mContext;
439 }
EAGLPlatformContext * mContext
Definition: quikitwindow.h:131
EAGLView * mView
Definition: quikitwindow.h:130

◆ nativeView()

EAGLView* QUIKitWindow::nativeView ( ) const
inline

Definition at line 116 of file quikitwindow.h.

Referenced by QUIKitSoftwareInputHandler::eventFilter().

122 { return mScreen; }
QUIKitScreen * mScreen
Definition: quikitwindow.h:127

◆ nativeWindow()

UIWindow* QUIKitWindow::nativeWindow ( ) const
inline

Definition at line 115 of file quikitwindow.h.

115 { return mView; }
EAGLView * mView
Definition: quikitwindow.h:130

◆ platformScreen()

QUIKitScreen* QUIKitWindow::platformScreen ( ) const
inline

Definition at line 123 of file quikitwindow.h.

Referenced by QUIKitScreen::updateInterfaceOrientation().

125 :
QUIKitScreen * mScreen
Definition: quikitwindow.h:127

◆ setGeometry()

void QUIKitWindow::setGeometry ( const QRect rect)
virtual

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

The resize can happen programatically(from ie. user application) or by the window manager. This means that there is no need to call this function specifically from the window manager callback, instead call QWindowSystemInterface::handleGeometryChange(QWidget *w, const QRect &newRect);

Reimplemented from QPlatformWindow.

Definition at line 355 of file quikitwindow.mm.

356 {
357  // Not supported. Only a single "full screen" window is supported
359 }
virtual void setGeometry(const QRect &rect)
This function is called by Qt whenever a window is moved or the window is resized.

◆ updateGeometryAndOrientation()

void QUIKitWindow::updateGeometryAndOrientation ( )

Definition at line 384 of file quikitwindow.mm.

Referenced by ensureNativeWindow(), and QUIKitScreen::updateInterfaceOrientation().

385 {
386  if (!mWindow)
387  return;
388  mFrame = [mScreen->uiScreen() applicationFrame];
389  CGRect screen = [mScreen->uiScreen() bounds];
390  QRect geom;
391  CGFloat angle = 0;
392  switch ([[UIApplication sharedApplication] statusBarOrientation]) {
393  case UIInterfaceOrientationPortrait:
394  geom = QRect(mFrame.origin.x, mFrame.origin.y, mFrame.size.width, mFrame.size.height);
395  break;
396  case UIInterfaceOrientationPortraitUpsideDown:
397  geom = QRect(screen.size.width - mFrame.origin.x - mFrame.size.width,
398  screen.size.height - mFrame.origin.y - mFrame.size.height,
399  mFrame.size.width,
400  mFrame.size.height);
401  angle = M_PI;
402  break;
403  case UIInterfaceOrientationLandscapeLeft:
404  geom = QRect(screen.size.height - mFrame.origin.y - mFrame.size.height,
405  mFrame.origin.x,
406  mFrame.size.height,
407  mFrame.size.width);
408  angle = -M_PI/2.;
409  break;
410  case UIInterfaceOrientationLandscapeRight:
411  geom = QRect(mFrame.origin.y,
412  screen.size.width - mFrame.origin.x - mFrame.size.width,
413  mFrame.size.height,
414  mFrame.size.width);
415  angle = +M_PI/2.;
416  break;
417  }
418 
419  CGFloat scale = [mScreen->uiScreen() scale];
420  geom = QRect(geom.x() * scale, geom.y() * scale,
421  geom.width() * scale, geom.height() * scale);
422 
423  if (angle != 0) {
424  [mView layer].transform = CATransform3DMakeRotation(angle, 0, 0, 1.);
425  } else {
426  [mView layer].transform = CATransform3DIdentity;
427  }
428  [mView setNeedsDisplay];
429  widget()->setGeometry(geom);
430  widget()->update();
431 }
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define M_PI
Definition: qmath.h:261
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
UIWindow * mWindow
Definition: quikitwindow.h:128
struct CGRect CGRect
qreal angle(const QPointF &p1, const QPointF &p2)
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.
float CGFloat

Properties

◆ mContext

EAGLPlatformContext* QUIKitWindow::mContext
mutableprivate

Definition at line 131 of file quikitwindow.h.

Referenced by glContext(), and ~QUIKitWindow().

◆ mFrame

CGRect QUIKitWindow::mFrame
private

Definition at line 129 of file quikitwindow.h.

Referenced by ensureNativeWindow(), and updateGeometryAndOrientation().

◆ mScreen

QUIKitScreen* QUIKitWindow::mScreen
private

Definition at line 127 of file quikitwindow.h.

Referenced by ensureNativeWindow(), QUIKitWindow(), and updateGeometryAndOrientation().

◆ mView

EAGLView* QUIKitWindow::mView
private

◆ mWindow

UIWindow* QUIKitWindow::mWindow
private

Definition at line 128 of file quikitwindow.h.

Referenced by ensureNativeWindow(), updateGeometryAndOrientation(), and ~QUIKitWindow().


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