Represents standard numbering of grid cells.
More...
#include <qttools/core/grid_numbering.h>
|
static QVector< QVector< int > > | gridIndexes (const GridNumbering &gridNb, int rowCount, int colCount, int startIndex=0) |
| Computes all the indexes of a grid's cells. More...
|
|
Represents standard numbering of grid cells.
GridNumbering stores key information about numbering of grid cells :
- start corner (grid corner where the numbering starts, i.e. the firt cell)
- orientation (horizontal or vertical numbering)
- sweep mode (one-way or zig-zag numbering)
qtcore::GridNumbering::GridNumbering |
( |
| ) |
|
qtcore::GridNumbering::GridNumbering |
( |
Qt::Corner |
corner, |
|
|
Qt::Orientation |
orientation, |
|
|
SweepMode |
sweep |
|
) |
| |
QVector< QVector< int > > qtcore::GridNumbering::gridIndexes |
( |
const GridNumbering & |
gridNb, |
|
|
int |
rowCount, |
|
|
int |
colCount, |
|
|
int |
startIndex = 0 |
|
) |
| |
|
static |
Computes all the indexes of a grid's cells.
The result is an array of grid rows (each row being of the same size).
For example:
- GridNumbering(Qt::TopRightCorner, Qt::Vertical, GridNumbering::OneWay)
- rowCount = colCount = 4
- startIndex = 0
will output:
row[0] == { 12 8 4 0 }
row[1] == { 13 9 5 1 }
row[2] == { 14 10 6 2 }
row[3] == { 15 11 7 3 }
- Note
- Let N =
rowCount
and M = colCount
, complexity is O(NxM)
- Parameters
-
gridNb | How grid cells have to be numbered |
rowCount | Count of rows in the grid |
colCount | Count of columns in the grid |
startIndex | The first index to start from (usually 0 or 1) |
Qt::Orientation qtcore::GridNumbering::orientation |
( |
| ) |
const |
void qtcore::GridNumbering::setOrientation |
( |
Qt::Orientation |
orientation | ) |
|
void qtcore::GridNumbering::setStartCorner |
( |
Qt::Corner |
corner | ) |
|
void qtcore::GridNumbering::setSweepMode |
( |
SweepMode |
sweepMode | ) |
|
Qt::Corner qtcore::GridNumbering::startCorner |
( |
| ) |
const |
The documentation for this class was generated from the following files: