KGameCanvasText

Search for usage in LXR

KGameCanvasText Class Reference

#include <KGameCanvas>

Inheritance diagram for KGameCanvasText:

Public Types

enum  HPos { HStart, HLeft, HRight, HCenter }
 
enum  VPos { VBaseline, VTop, VBottom, VCenter }
 

Public Member Functions

 KGameCanvasText (const QString &text, const QColor &color, const QFont &font, HPos hp, VPos vp, KGameCanvasAbstract *canvas=nullptr)
 
 KGameCanvasText (KGameCanvasAbstract *canvas=nullptr)
 
QColor color () const
 
QFont font () const
 
HPos hPositioning () const
 
bool layered () const override
 
void paint (QPainter *p) override
 
QRect rect () const override
 
void setColor (const QColor &color)
 
void setFont (const QFont &font)
 
void setPositioning (HPos hp, VPos vp)
 
void setText (const QString &text)
 
QString text () const
 
VPos vPositioning () const
 
- Public Member Functions inherited from KGameCanvasItem
 KGameCanvasItem (KGameCanvasAbstract *canvas=nullptr)
 
QPoint absolutePosition () const
 
virtual void advance (int msecs)
 
bool animated () const
 
KGameCanvasAbstractcanvas () const
 
virtual void changed ()
 
void hide ()
 
void lower ()
 
void moveTo (const QPoint &newpos)
 
void moveTo (int x, int y)
 
int opacity () const
 
QPoint pos () const
 
void putInCanvas (KGameCanvasAbstract *canvas)
 
void raise ()
 
void setAnimated (bool a)
 
void setOpacity (int o)
 
void setVisible (bool v)
 
void show ()
 
void stackOver (KGameCanvasItem *ref)
 
void stackUnder (KGameCanvasItem *ref)
 
KGameCanvasWidgettopLevelCanvas () const
 
bool visible () const
 

Detailed Description

KGameCanvasText.

A KGameCanvasText is a text that can be put in the canvas.

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

Definition at line 526 of file kgamecanvas.h.

Member Enumeration Documentation

◆ HPos

Specifies the meaning of the x coordinate of the item.

It can refer to the start of the text, of the left, center, right of the bounding rectangle.

Definition at line 532 of file kgamecanvas.h.

◆ VPos

Specifies the meaning of the y coordinate of the item.

It can refer to the baseline of the text, of the top, center, bottom of the bounding rectangle.

Definition at line 537 of file kgamecanvas.h.

Constructor & Destructor Documentation

◆ KGameCanvasText() [1/2]

KGameCanvasText::KGameCanvasText ( const QString text,
const QColor color,
const QFont font,
HPos  hp,
VPos  vp,
KGameCanvasAbstract canvas = nullptr 
)

Constructor, specifying the text and the parameters to use.

Definition at line 837 of file kgamecanvas.cpp.

◆ KGameCanvasText() [2/2]

KGameCanvasText::KGameCanvasText ( KGameCanvasAbstract canvas = nullptr)
explicit

Constructor, creating with an empty text.

Definition at line 848 of file kgamecanvas.cpp.

Member Function Documentation

◆ color()

QColor KGameCanvasText::color ( ) const
inline

Returns the color.

Definition at line 569 of file kgamecanvas.h.

◆ font()

QFont KGameCanvasText::font ( ) const
inline

Returns the font.

Definition at line 578 of file kgamecanvas.h.

◆ hPositioning()

HPos KGameCanvasText::hPositioning ( ) const
inline

Returns the horizontal positioning style.

Definition at line 587 of file kgamecanvas.h.

◆ layered()

bool KGameCanvasText::layered ( ) const
inlineoverridevirtual

Override this function to specify if the painting operations will paint over each other.

If not, the item will be drawn more quickly when opacity is != 255, because it does not have to be painted onto a pixmap first. If you don't care about the item's opacity, don't care about this function as well.

Reimplemented from KGameCanvasItem.

Definition at line 603 of file kgamecanvas.h.

◆ paint()

void KGameCanvasText::paint ( QPainter p)
overridevirtual

Override this function to draw the item with the painter.

Implements KGameCanvasItem.

Definition at line 942 of file kgamecanvas.cpp.

◆ rect()

QRect KGameCanvasText::rect ( ) const
overridevirtual

Override this function to return the rect the item will be drawn into.

Implements KGameCanvasItem.

Definition at line 949 of file kgamecanvas.cpp.

◆ setColor()

void KGameCanvasText::setColor ( const QColor color)

Sets the color.

Definition at line 883 of file kgamecanvas.cpp.

◆ setFont()

void KGameCanvasText::setFont ( const QFont font)

Sets the font.

Definition at line 888 of file kgamecanvas.cpp.

◆ setPositioning()

void KGameCanvasText::setPositioning ( HPos  hp,
VPos  vp 
)

Sets the positioning style.

Definition at line 897 of file kgamecanvas.cpp.

◆ setText()

void KGameCanvasText::setText ( const QString text)

Sets the text.

Definition at line 872 of file kgamecanvas.cpp.

◆ text()

QString KGameCanvasText::text ( ) const
inline

Returns the text.

Definition at line 560 of file kgamecanvas.h.

◆ vPositioning()

VPos KGameCanvasText::vPositioning ( ) const
inline

Returns the vertical positioning style.

Definition at line 593 of file kgamecanvas.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 03:47:36 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.