Cube Class Reference

[krubik Index] [krubik Heirarchy]


3D Model of the Rubik's Cube More...

#include <cube.h>

Inherits: QWidget

Public Members

Public Slots

Protected Members

Signals


Detailed Description

This is the class Cube. It's a 3D model of the Rubik's Cube. It allows twising and turning of the model and also provides functions for saving and loading a cube, showing statistics, cleaning and srambling the cube etc.


Cube( QWidget *parent=0, const char *name=0 )

The constructor method for class Cube

Parameters:
name Name for QWidget
parent Parent widget, used for QWidget
See Also:
Cube

~Cube()

The destrucor method for class KFortune

void newCube()

Starts with a new cube. This means resetting the viewpoint and then calling clean

void clean()

Cleans the cube.

void scramble()

Scrambles the cube.

void dumpData()

Used for debugging

void save()

Save the cube to a file

void load()

Load a cube from a file

void setColor( QColor color, int slot, bool redraw=TRUE)

Sets the colors from the cube.

Parameters:
slot The part of the cube of which the color must be set
redraw repaints the cube if true
color The color to be set

void setShading( int level )

Sets the shading level

Parameters:
level Use values between 0 and 10, -1 means no shading

void resetColors(bool redraw=TRUE)

Restore the cube-colors to some default value

Parameters:
redraw repaints the cube if true

const QColor getColorList( int i ) const

Get's a color item from the color-list.

const QColor getColor( int i ) const

...

void resizeEvent( QResizeEvent * )

Only calls the function resizeEvent()

See Also:
resizeEvent

void resizeEvent()

Handels all the resizing of the main window of KRubik

void mousePressEvent( QMouseEvent * )

Handles a mousePressEvent from the user.

void mouseReleaseEvent( QMouseEvent * )

Handels mouseReleaseEvent.

void paintEvent( QPaintEvent *)

Repaints the cube.

void initData()

Used internally to set up some data.

void createColor( int slot, int red, int green, int blue )

Recreate the specified color. Used by @see #setShading and @see #setColor

void colorTwist(int sideNum, int quads, bool redraw=TRUE )

Turns one side of the cube

Parameters:
redraw repaints the cube if true
sideNum Number of the side to turn
quads Number of turns

void cutUpCube()

Splits the cube into 2 parts for twising. The data for the two sub-cubes are stored in topBlocks/botBlocks and topCorners/botCorners

void fixBlock(Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector beye, Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector beX, Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector beY, Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector.html">Vector **bcorners, const int *bblocks, const int mode)

Used by paintEvent to draw subcubes.

void stateChange()

This signal is emitted whenever the state of the cube is changed. To be more specific :

 The singal is emitted when :

- the number of moves is changed - the cube is cleaned or a new cube is created - the cube is scrambled

The signal is not emitted when :

- the time has changed


  • Author: Pieter Eendebak <pte@ddsw.nl>
  • Version: 0.91
  • Documentation generated by root@localhost.localdomain on Sat Jun 27 15:21:54 MET DST 1998
Kdoc