#include <QicsSelection.h>
Public Member Functions | |
| QicsSelection () | |
| QicsSelection (int anchor_row, int anchor_col, int end_row, int end_col, bool select_state=true) | |
| QicsSelection (int anchor_row, int anchor_col, int start_row, int start_col, int end_row, int end_col, bool select_state=true) | |
| QicsSelection (const QicsSelection &sel) | |
| void | setSelected (bool set) |
| bool | selected (void) const |
| void | invalidate () |
| bool | isValid (void) const |
| void | setAnchorRow (int anchor_row) |
| void | setAnchorColumn (int anchor_col) |
| void | setAnchorCell (int anchor_row, int anchor_col) |
| void | setStartRow (int start_row) |
| void | setStartColumn (int start_col) |
| void | setStartCell (int start_row, int start_col) |
| void | setEndRow (int end_row) |
| void | setEndColumn (int end_col) |
| void | setEndCell (int end_row, int end_col) |
| int | anchorRow (void) const |
| int | anchorColumn (void) const |
| QicsICell | anchorCell (void) const |
| int | startRow (void) const |
| int | startColumn (void) const |
| QicsICell | startCell (void) const |
| int | endRow (void) const |
| int | endColumn (void) const |
| QicsICell | endCell (void) const |
| int | topRow (void) const |
| int | leftColumn (void) const |
| QicsICell | topLeftCell (void) const |
| int | bottomRow (void) const |
| int | rightColumn (void) const |
| QicsICell | bottomRightCell (void) const |
| int | numColumns (void) const |
| int | numRows (void) const |
| void | setEntireRow (int row) |
| bool | isEntireRow () const |
| void | setEntireColumn (int col) |
| bool | isEntireColumn () const |
| bool | intersects (const QicsSelection &sel) |
| bool | contains (int row, int col) const |
| QicsSelection | operator & (const QicsSelection &sel) |
| QicsSelection | intersect (const QicsSelection &sel) |
| QicsSelection | operator| (const QicsSelection &sel) |
| QicsSelection & | operator|= (const QicsSelection &sel) |
| QicsRegion | toRegion () const |
Protected Attributes | |
| bool | mySelectState |
| int | myAnchorRow |
| int | myAnchorCol |
| int | myStartRow |
| int | myStartCol |
| int | myEndRow |
| int | myEndCol |
Related Functions | |
| (Note that these are not member functions.) | |
| QICS_EXPORT bool | operator== (const QicsSelection &r1, const QicsSelection &r2) |
| QICS_EXPORT bool | operator!= (const QicsSelection &r1, const QicsSelection &r2) |
QicsSelection represents a single, contiguous selection in the QicsTable widget. A QicsSelection consists of an anchor cell, where the selection begins, and an end cell, where the cell ends. The end cell indices are not necessarily greater than the anchor cell (i.e. it is valid for the anchor cell to be (5,5) and the end cell to be (0,0)).
If an entire row is selected, leftColumn() will be set to 0, and rightColumn() will be set to QicsLAST_COLUMN. Similarly, if and entire column is selected, topRow() will be set to 0, and bottomRow() will be set to QicsLAST_ROW.
This class is used by QicsTable to define table selections. A complete table selection consists of a list of selection objects (QicsSelectionList).
In some cases, a QicsSelection object may represent an "unselection". This can occur if a user control-clicks in an already selected cell. If this happens, this type of selection is indicated by the selected() property returning false.
| QicsSelection::QicsSelection | ( | ) |
Constructor that creates an empty selection
| QicsSelection::QicsSelection | ( | int | anchor_row, | |
| int | anchor_col, | |||
| int | end_row, | |||
| int | end_col, | |||
| bool | select_state = true | |||
| ) |
Constructs a selection from (anchor_row, anchor_col ) to (end_row, end_col ). If select_state is false, this "selection" represents an action by the user that has caused these cells to be unselected.
| QicsSelection::QicsSelection | ( | int | anchor_row, | |
| int | anchor_col, | |||
| int | start_row, | |||
| int | start_col, | |||
| int | end_row, | |||
| int | end_col, | |||
| bool | select_state = true | |||
| ) |
Constructs a selection from (start_row, start_col) to (end_row, end_col) with anchor in (anchor_row, anchor_col). If select_state is false, this "selection" represents an action by the user that has caused these cells to be unselected.
| QicsSelection::QicsSelection | ( | const QicsSelection & | sel | ) |
Constructs for the class
| void QicsSelection::setSelected | ( | bool | set | ) | [inline] |
Sets whether the cells in this selection have been selected or unselected.
| bool QicsSelection::selected | ( | void | ) | const [inline] |
Returns whether the cells in this selection have been selected or unselected.
| void QicsSelection::invalidate | ( | ) |
| bool QicsSelection::isValid | ( | void | ) | const |
Returns true if the selection is valid, or false if it is not valid.
| void QicsSelection::setAnchorRow | ( | int | anchor_row | ) |
Sets the row index of the anchor cell in the selection.
| void QicsSelection::setAnchorColumn | ( | int | anchor_col | ) |
Sets the column index of the anchor cell in the selection.
| void QicsSelection::setAnchorCell | ( | int | anchor_row, | |
| int | anchor_col | |||
| ) |
Sets the row and column indices of the anchor cell in the selection.
| void QicsSelection::setStartRow | ( | int | start_row | ) |
Sets the row index of the end cell in the selection.
| void QicsSelection::setStartColumn | ( | int | start_col | ) |
Sets the column index of the end cell in the selection.
| void QicsSelection::setStartCell | ( | int | start_row, | |
| int | start_col | |||
| ) |
Sets the row and column indices of the end cell in the selection.
| void QicsSelection::setEndRow | ( | int | end_row | ) |
Sets the row index of the end cell in the selection.
| void QicsSelection::setEndColumn | ( | int | end_col | ) |
Sets the column index of the end cell in the selection.
| void QicsSelection::setEndCell | ( | int | end_row, | |
| int | end_col | |||
| ) |
Sets the row and column indices of the end cell in the selection.
| int QicsSelection::anchorRow | ( | void | ) | const [inline] |
Returns the row index of the anchor cell in the selection.
| int QicsSelection::anchorColumn | ( | void | ) | const [inline] |
Returns the column index of the anchor cell in the selection.
| QicsICell QicsSelection::anchorCell | ( | void | ) | const [inline] |
Returns the anchor cell in the selection.
| int QicsSelection::startRow | ( | void | ) | const [inline] |
Returns the row index of the start cell in the selection.
| int QicsSelection::startColumn | ( | void | ) | const [inline] |
Returns the column index of the start cell in the selection.
| QicsICell QicsSelection::startCell | ( | void | ) | const [inline] |
Returns the start cell in the selection.
| int QicsSelection::endRow | ( | void | ) | const [inline] |
Returns the row index of the end cell in the selection.
| int QicsSelection::endColumn | ( | void | ) | const [inline] |
Returns the column index of the end cell in the selection.
| QicsICell QicsSelection::endCell | ( | void | ) | const [inline] |
Returns the end cell in the selection.
| int QicsSelection::topRow | ( | void | ) | const [inline] |
Returns the lesser of the row indices of the anchor and end cells.
| int QicsSelection::leftColumn | ( | void | ) | const [inline] |
Returns the lesser of the column indices of the anchor and end cells.
| QicsICell QicsSelection::topLeftCell | ( | void | ) | const [inline] |
Returns the top left cell in the selection.
| int QicsSelection::bottomRow | ( | void | ) | const [inline] |
Returns the greater of the row indices of the anchor and end cells.
| int QicsSelection::rightColumn | ( | void | ) | const [inline] |
Returns the greater of the column indices of the anchor and end cells.
| QicsICell QicsSelection::bottomRightCell | ( | void | ) | const [inline] |
Returns the bottom right cell in the selection.
| int QicsSelection::numColumns | ( | void | ) | const [inline] |
Returns the width of the selection (in columns).
| int QicsSelection::numRows | ( | void | ) | const [inline] |
Returns the height of the selection (in rows).
| void QicsSelection::setEntireRow | ( | int | row | ) |
Sets the value of this selection to all of row row.
| bool QicsSelection::isEntireRow | ( | ) | const [inline] |
Returns true if this selection covers entire row.
| void QicsSelection::setEntireColumn | ( | int | col | ) |
Sets the value of this selection to all of column col.
| bool QicsSelection::isEntireColumn | ( | ) | const [inline] |
Returns true if this selection covers entire column.
| bool QicsSelection::intersects | ( | const QicsSelection & | sel | ) |
Returns true if sel intersects with this selection (i.e. there at least one cell that is contained in both selections), or false otherwise.
| bool QicsSelection::contains | ( | int | row, | |
| int | col | |||
| ) | const [inline] |
Returns true if selection contains row and col inside.
| QicsSelection QicsSelection::operator & | ( | const QicsSelection & | sel | ) |
Returns the intersection of this selection and sel.
| QicsSelection QicsSelection::intersect | ( | const QicsSelection & | sel | ) |
Returns the intersection of this selection and sel.
| QicsSelection QicsSelection::operator| | ( | const QicsSelection & | sel | ) |
Returns the union of this selection and sel.
| QicsSelection& QicsSelection::operator|= | ( | const QicsSelection & | sel | ) | [inline] |
Returns the union of this selection and sel.
| QicsRegion QicsSelection::toRegion | ( | ) | const [inline] |
Returns the region covered by this selection.
| QICS_EXPORT bool operator== | ( | const QicsSelection & | r1, | |
| const QicsSelection & | r2 | |||
| ) | [friend] |
Returns true if the two selections are identical, or false otherwise.
| QICS_EXPORT bool operator!= | ( | const QicsSelection & | r1, | |
| const QicsSelection & | r2 | |||
| ) | [friend] |
Returns true if the two selections are not identical, or false otherwise.