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

#include <qxlibintegration.h>

Inheritance diagram for QXlibIntegration:
QPlatformIntegration

Public Functions

QPlatformClipboardclipboard () const
 Accessor for the platform integrations clipboard. More...
 
QPixmapDatacreatePixmapData (QPixmapData::PixelType type) const
 Factory function for QPixmapData. More...
 
QPlatformWindowcreatePlatformWindow (QWidget *widget, WId winId) const
 Factory function for QPlatformWindow. More...
 
QWindowSurfacecreateWindowSurface (QWidget *widget, WId winId) const
 Factory function for QWindowSurface. More...
 
QPlatformFontDatabasefontDatabase () const
 Accessor for the platform integrations fontdatabase. More...
 
QPixmap grabWindow (WId window, int x, int y, int width, int height) const
 This function is called when Qt needs to be able to grab the content of a window. More...
 
bool hasCapability (Capability cap) const
 
QPlatformNativeInterfacenativeInterface () const
 
 QXlibIntegration (bool useOpenGL=false)
 defined(QT_OPENGL_ES_2) More...
 
QList< QPlatformScreen * > screens () const
 Accessor function to a list of all the screens on the current system. More...
 
- Public Functions inherited from QPlatformIntegration
virtual QPlatformEventLoopIntegrationcreateEventLoopIntegration () const
 Factory function for the eventloop integration interface. More...
 
virtual bool isVirtualDesktop ()
 Returns if the current windowing system configuration defines all the screens to be one desktop(virtual desktop), or if each screen is a desktop of its own. More...
 
virtual void moveToScreen (QWidget *window, int screen)
 This function is called when a QWidget is displayed on screen, or the QWidget is to be displayed on a new screen. More...
 
virtual ~QPlatformIntegration ()
 

Private Functions

bool hasOpenGL () const
 

Properties

QPlatformClipboardmClipboard
 
QPlatformFontDatabasemFontDb
 
QPlatformNativeInterfacemNativeInterface
 
QXlibScreenmPrimaryScreen
 
QList< QPlatformScreen * > mScreens
 
bool mUseOpenGL
 

Additional Inherited Members

- Public Types inherited from QPlatformIntegration
enum  Capability { ThreadedPixmaps = 1, OpenGL = 2 }
 

Detailed Description

Definition at line 58 of file qxlibintegration.h.

Constructors and Destructors

◆ QXlibIntegration()

QXlibIntegration::QXlibIntegration ( bool  useOpenGL = false)

defined(QT_OPENGL_ES_2)

Definition at line 66 of file qxlibintegration.cpp.

67  : mUseOpenGL(useOpenGL)
69  , mClipboard(0)
71 {
74 }
QXlibScreen * mPrimaryScreen
QBasicUnixFontDatabase QGenericUnixFontDatabase
QPlatformFontDatabase * mFontDb
QPlatformClipboard * mClipboard
QPlatformNativeInterface * mNativeInterface
QList< QPlatformScreen * > mScreens
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507

Functions

◆ clipboard()

QPlatformClipboard * QXlibIntegration::clipboard ( ) const
virtual

Accessor for the platform integrations clipboard.

Default implementation returns a default QPlatformClipboard.

See also
QPlatformClipboard

Reimplemented from QPlatformIntegration.

Definition at line 134 of file qxlibintegration.cpp.

Referenced by screens().

135 {
136  //Use lazy init since clipboard needs QTestliteScreen
137  if (!mClipboard) {
138  QXlibIntegration *that = const_cast<QXlibIntegration *>(this);
140  }
141  return mClipboard;
142 }
QXlibScreen * mPrimaryScreen
QPlatformClipboard * mClipboard

◆ createPixmapData()

QPixmapData * QXlibIntegration::createPixmapData ( QPixmapData::PixelType  type) const
virtual

Factory function for QPixmapData.

PixelType can be either PixmapType or BitmapType.

See also
QPixmapData

Implements QPlatformIntegration.

Definition at line 85 of file qxlibintegration.cpp.

86 {
87 #ifndef QT_NO_OPENGL
88  if (mUseOpenGL)
89  return new QGLPixmapData(type);
90 #endif
91  return new QRasterPixmapData(type);
92 }
int type
Definition: qmetatype.cpp:239

◆ createPlatformWindow()

QPlatformWindow * QXlibIntegration::createPlatformWindow ( QWidget widget,
WId  winId 
) const
virtual

Factory function for QPlatformWindow.

The widget parameter is a pointer to the top level widget(tlw) which the QPlatformWindow is suppose to be created for. The WId handle is actually never used, but there for future reference. Its purpose is if it is going to be possible to create QPlatformWindows on existing WId.

All tlw has to have a QPlatformWindow, and it will be created when the QPlatformWindow is set to be visible for the first time. If the tlw's window flags are changed, or if the tlw's QPlatformWindowFormat is changed, then the tlw's QPlatformWindow is deleted and a new one is created.

See also
QPlatformWindow, QPlatformWindowFormat
createWindowSurface(QWidget *widget, WId winId) const

Implements QPlatformIntegration.

Definition at line 104 of file qxlibintegration.cpp.

105 {
106  return new QXlibWindow(widget);
107 }

◆ createWindowSurface()

QWindowSurface * QXlibIntegration::createWindowSurface ( QWidget widget,
WId  winId 
) const
virtual

Factory function for QWindowSurface.

The QWidget parameter is a pointer to the top level widget(tlw) the window surface is created for. A QPlatformWindow is always created before the QWindowSurface for tlw where the widget also requires a WindowSurface. It is possible to create top level QWidgets without a QWindowSurface by specifying QPlatformWindowFormat::setWindowSurface(false) for the tlw QPlatformWindowFormat.

See also
QWindowSurface
createPlatformWindow(QWidget *widget, WId winId = 0) const

Implements QPlatformIntegration.

Definition at line 94 of file qxlibintegration.cpp.

95 {
96 #ifndef QT_NO_OPENGL
97  if (mUseOpenGL)
98  return new QGLWindowSurface(widget);
99 #endif
100  return new QXlibWindowSurface(widget);
101 }

◆ fontDatabase()

QPlatformFontDatabase * QXlibIntegration::fontDatabase ( ) const
virtual

Accessor for the platform integrations fontdatabase.

Default implementation returns a default QPlatformFontDatabase.

See also
QPlatformFontDatabase

Reimplemented from QPlatformIntegration.

Definition at line 129 of file qxlibintegration.cpp.

Referenced by screens().

130 {
131  return mFontDb;
132 }
QPlatformFontDatabase * mFontDb

◆ grabWindow()

QPixmap QXlibIntegration::grabWindow ( WId  window,
int  x,
int  y,
int  width,
int  height 
) const
virtual

This function is called when Qt needs to be able to grab the content of a window.

Returnes the content of the window specified with the WId handle within the boundaries of QRect(x,y,width,height).

Reimplemented from QPlatformIntegration.

Definition at line 111 of file qxlibintegration.cpp.

112 {
113  QImage image;
115  if (widget) {
117  image = screen->grabWindow(window,x,y,width,height);
118  } else {
119  for (int i = 0; i < mScreens.size(); i++) {
120  QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]);
121  if (screen->rootWindow() == window) {
122  image = screen->grabWindow(window,x,y,width,height);
123  }
124  }
125  }
126  return QPixmap::fromImage(image);
127 }
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
Definition: qpixmap.cpp:2197
QPointer< QWidget > widget
Window rootWindow()
QImage grabWindow(Window window, int x, int y, int w, int h)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QList< QPlatformScreen * > mScreens
static QXlibScreen * testLiteScreenForWidget(QWidget *widget)
NSWindow * window
static QWidget * find(WId)
Returns a pointer to the widget with window identifer/handle id.
Definition: qwidget.cpp:2517
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ hasCapability()

bool QXlibIntegration::hasCapability ( QPlatformIntegration::Capability  cap) const
virtual

Reimplemented from QPlatformIntegration.

Definition at line 76 of file qxlibintegration.cpp.

77 {
78  switch (cap) {
79  case ThreadedPixmaps: return true;
80  case OpenGL: return hasOpenGL();
81  default: return QPlatformIntegration::hasCapability(cap);
82  }
83 }
virtual bool hasCapability(Capability cap) const
bool hasOpenGL() const

◆ hasOpenGL()

bool QXlibIntegration::hasOpenGL ( ) const
private

Definition at line 149 of file qxlibintegration.cpp.

Referenced by hasCapability(), and screens().

150 {
151 #if !defined(QT_NO_OPENGL)
152 #if !defined(QT_OPENGL_ES_2)
153  QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens.at(0));
154  return glXQueryExtension(screen->display()->nativeDisplay(), 0, 0) != 0;
155 #else
156  static bool eglHasbeenInitialized = false;
157  static bool wasEglInitialized = false;
158  if (!eglHasbeenInitialized) {
159  eglHasbeenInitialized = true;
160  QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens.at(0));
161  EGLint major, minor;
162  eglBindAPI(EGL_OPENGL_ES_API);
163  EGLDisplay disp = eglGetDisplay(screen->display()->nativeDisplay());
164  wasEglInitialized = eglInitialize(disp,&major,&minor);
165  screen->setEglDisplay(disp);
166  }
167  return wasEglInitialized;
168 #endif
169 #endif
170  return false;
171 }
Display * nativeDisplay() const
QList< QPlatformScreen * > mScreens
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QXlibDisplay * display() const

◆ nativeInterface()

QPlatformNativeInterface * QXlibIntegration::nativeInterface ( ) const
virtual

Reimplemented from QPlatformIntegration.

Definition at line 144 of file qxlibintegration.cpp.

Referenced by screens().

145 {
146  return mNativeInterface;
147 }
QPlatformNativeInterface * mNativeInterface

◆ screens()

QList<QPlatformScreen *> QXlibIntegration::screens ( ) const
inlinevirtual

Accessor function to a list of all the screens on the current system.

The screen with the index == 0 is the default/main screen.

Implements QPlatformIntegration.

Definition at line 70 of file qxlibintegration.h.

70 { return mScreens; }
QList< QPlatformScreen * > mScreens

Properties

◆ mClipboard

QPlatformClipboard* QXlibIntegration::mClipboard
private

Definition at line 84 of file qxlibintegration.h.

Referenced by clipboard().

◆ mFontDb

QPlatformFontDatabase* QXlibIntegration::mFontDb
private

Definition at line 83 of file qxlibintegration.h.

Referenced by fontDatabase().

◆ mNativeInterface

QPlatformNativeInterface* QXlibIntegration::mNativeInterface
private

Definition at line 85 of file qxlibintegration.h.

Referenced by nativeInterface().

◆ mPrimaryScreen

QXlibScreen* QXlibIntegration::mPrimaryScreen
private

Definition at line 81 of file qxlibintegration.h.

Referenced by clipboard(), and QXlibIntegration().

◆ mScreens

QList<QPlatformScreen *> QXlibIntegration::mScreens
private

Definition at line 82 of file qxlibintegration.h.

Referenced by grabWindow(), hasOpenGL(), QXlibIntegration(), and screens().

◆ mUseOpenGL

bool QXlibIntegration::mUseOpenGL
private

Definition at line 80 of file qxlibintegration.h.

Referenced by createPixmapData(), and createWindowSurface().


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