Kard Class Reference
#include <kard.h>
List of all members.
Detailed Description
This draws a card image. This is not particularly useful directly. Capable images are png and xpm.
- Author:
- John Schneiderman
Member Enumeration Documentation
These are the preferred sizes.
- Parameters:
-
| PREFERRED_WIDTH | is the preferred width of the card. |
| PREFERRED_HEIGHT | is the preferred height of the card. |
Constructor & Destructor Documentation
Kard::Kard |
( |
QWidget * |
parent = 0 |
) |
|
A constructor to create a plain card.
- Parameters:
-
| parent | is the parent of this widget. |
Kard::Kard |
( |
const Card & |
card, |
|
|
bool |
faceUp, |
|
|
QWidget * |
parent = 0 | |
|
) |
| | |
A constructor to create a specific card.
- Parameters:
-
| card | is the card the widget represents. |
| faceUp | is weather the widget should display the card face up or face down. True means face up. |
| parent | is the parent of this widget. |
Destructor for our object..
Member Function Documentation
const Card & Kard::card |
( |
|
) |
|
This gives what card is currently being displayed.
- Returns:
- the card displayed.
const QPixmap & Kard::cardBack |
( |
|
) |
const |
Gives the current image for the back of the card card.
- Returns:
- the card's back image.
const QPixmap & Kard::cardFront |
( |
|
) |
const |
Gives the current image for the front of the card.
- Returns:
- the card's front image.
void Kard::cardSelected |
( |
Kard & |
kard |
) |
[signal] |
This is the signal emitted when the card is selected by a double left click.
- Parameters:
-
- Note:
- The card will be set as selected when the signal is sent.
This flips the displayed images. Front to back, back to front.
bool Kard::isFaceUp |
( |
|
) |
const |
This determines if the card is facing up.
- Returns:
- true if it is facing up, false elsewise.
bool Kard::isSelected |
( |
|
) |
const |
This determines if a user has selected this card.
- Returns:
- true if the card has been selected, false elsewise.
void Kard::mouseDoubleClickEvent |
( |
QMouseEvent * |
event |
) |
[protected, virtual] |
This is how a user selects a card.
- Parameters:
-
| event | is the generating event. |
- Note:
- the meaning of each click is as follows:
Double clicking the left mouse button will select the card.
void Kard::mouseMoveEvent |
( |
QMouseEvent * |
event |
) |
[protected, virtual] |
This checks to see if we are trying to drag the Kard.
- Parameters:
-
| event | is the generating event. |
void Kard::mousePressEvent |
( |
QMouseEvent * |
event |
) |
[protected, virtual] |
This starts the dragging check for the card.
- Parameters:
-
| event | is the generating event. |
Kard & Kard::operator= |
( |
const Kard & |
kard |
) |
|
This will assign a Kard into *this.
- Parameters:
-
| kard | is the kard we want to assign into *this. |
- Returns:
- *this.
void Kard::paintEvent |
( |
QPaintEvent * |
event |
) |
[protected, virtual] |
This draws the card image.
- Parameters:
-
| event | is the source of the generating event. |
void Kard::setCard |
( |
const Card & |
card |
) |
|
This sets the card we want to be displayed. The image itself is pulled from the mime source in the binary.
- Parameters:
-
| card | is the card to display. |
- Exceptions:
-
void Kard::setCardBack |
( |
const QString & |
cardBackFilename |
) |
|
This will set the card's back image.
- Parameters:
-
| cardBackFilename | is the file-name to use for the image of the kard. |
- Exceptions:
-
void Kard::setCardBack |
( |
const QPixmap & |
cardBack |
) |
|
This will set the card's back image. Generally this will be some design pattern.
- Parameters:
-
| cardBack | is the image that the back of the card should have. |
- Exceptions:
-
void Kard::setCardFront |
( |
const QPixmap & |
cardFront |
) |
|
This will set the card's front image. Generally this will be the suit and rank of a card.
- Parameters:
-
| cardFront | is the image that the front of the card should have. |
- Exceptions:
-
void Kard::setCardPath |
( |
const QString & |
cardPath |
) |
|
This will set the card's front image.
- Parameters:
-
| cardPath | is the path to the directory that holds all the kard images. |
void Kard::setFaceUp |
( |
bool |
faceUp |
) |
|
This sets whether a card should be facing up.
- Parameters:
-
| faceUp | should be true if you wish for the front image to be displayed, false elsewise. |
void Kard::setSelected |
( |
bool |
select |
) |
|
This sets whether a card has been selected.
- Parameters:
-
| select | when true will select this kard, false will un-set our selection. |
- Note:
- if select is true then cardSelected signal will be emitted.
if the card had already been selected then nothing will happen.
QSize Kard::sizeHint |
( |
|
) |
const |
This gives the preferred size of the card.
- Returns:
- the size of the card.
Property Documentation
QPixmap Kard::m_cardBack [read, write] |
- Parameters:
-
| m_cardBack | is the image on the back of the card. |
QPixmap Kard::m_cardFront [read, write] |
- Parameters:
-
| m_cardFront | is the image on the front of the card. |
bool Kard::m_faceUp [read, write] |
- Parameters:
-
| m_faceUp | is true if we are displaying the front of the card and false if we're displaying the back of the card. |
bool Kard::m_selected [read, write] |
- Parameters:
-
| m_selected | is true if the card has been selected, false elsewise. |
The documentation for this class was generated from the following files:
- gamebase/widgets/kard.h
- gamebase/widgets/kard.cpp