• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

libkdegames/libkdegamesprivate

Public Member Functions | List of all members
KGameCanvasAdapter Class Referenceabstract

#include <KGameCanvas>

Inheritance diagram for KGameCanvasAdapter:
Inheritance graph
[legend]

Public Member Functions

 KGameCanvasAdapter ()
 
virtual QPoint canvasPosition () const
 
virtual void render (QPainter *p)
 
virtual class KGameCanvasWidget * topLevelCanvas ()
 
virtual void updateParent (const QRect &rect)=0
 
- Public Member Functions inherited from KGameCanvasAbstract
 KGameCanvasAbstract ()
 
virtual ~KGameCanvasAbstract ()
 
KGameCanvasItem * itemAt (const QPoint &pos) const
 
KGameCanvasItem * itemAt (int x, int y) const
 
const QList< KGameCanvasItem * > * items () const
 
QList< KGameCanvasItem * > itemsAt (const QPoint &pos) const
 
QList< KGameCanvasItem * > itemsAt (int x, int y) const
 

Additional Inherited Members

- Protected Attributes inherited from KGameCanvasAbstract
QList< KGameCanvasItem * > m_animated_items
 
QList< KGameCanvasItem * > m_items
 

Detailed Description

A generic adapter for KGameCanvas.

KGameCanvasAdapter can be used to draw content managed by KGameCanvas inside systems which do not use KGameCanvas internally for their rendering.

For example, suppose you have a widget CustomDisplay which paints itself with direct QPainter calls in its paintEvent, and you want to add a complex element to its rendering, which is best implemented via the KGameCanvas abstractions. What you can do is to create a KGameCanvasAdapter subclass, use it just like a KGameCanvasGroup, then call its render member function to have a QPainter object draw it.

A KGameCanvas adapter notifies its parent using the pure virtual function updateParent, which is called when the adapter content is invalidated.

Todo:
Support animations
Deprecated:
For new applications, use Qt's Graphics View framework or Qt Quick.

Definition at line 636 of file kgamecanvas.h.

Constructor & Destructor Documentation

KGameCanvasAdapter::KGameCanvasAdapter ( )

Constructor.

Definition at line 976 of file kgamecanvas.cpp.

Member Function Documentation

virtual QPoint KGameCanvasAdapter::canvasPosition ( ) const
inlinevirtual

The absolute position of the rendered content is not well defined for KGameCanvasAdapter.

We assume that the adapter will be rendered at (0,0), and leave it to the user to perform the necessary adjustments, which will depend on the chosen rendering method.

Returns
The point (0, 0).

Implements KGameCanvasAbstract.

Definition at line 667 of file kgamecanvas.h.

void KGameCanvasAdapter::render ( QPainter *  p)
virtual

Draw the items of the adapter using the specified painter.

Parameters
pThe QPainter object to be used for rendering.

Definition at line 994 of file kgamecanvas.cpp.

virtual class KGameCanvasWidget* KGameCanvasAdapter::topLevelCanvas ( )
inlinevirtual

An adapter is not associated to any canvas, so this function simply returns 0.

Implements KGameCanvasAbstract.

Definition at line 656 of file kgamecanvas.h.

virtual void KGameCanvasAdapter::updateParent ( const QRect &  rect)
pure virtual

Notify the parent that the adapter content inside rect needs to be redrawn.

rect The bounding rectangle of the region that needs repainting.


The documentation for this class was generated from the following files:
  • kgamecanvas.h
  • kgamecanvas.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames/libkdegamesprivate

Skip menu "libkdegames/libkdegamesprivate"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal