| Classes - Annotated - Tree - Functions - Home - Structure

# QTableSelection Class Reference
[ table module ]

The QTableSelection provides access to the selected area in a QTable. More...

`#include <qtable.h>`

List of all member functions.

## Public Members

- QTableSelection ()
- void init ( int row, int col )
- void expandTo ( int row, int col )
- bool operator== ( const QTableSelection & s ) const
- int topRow () const
- int bottomRow () const
- int leftCol () const
- int rightCol () const
- int anchorRow () const
- int anchorCol () const
- bool isActive () const

## Detailed Description

The QTableSelection provides access to the selected area in a QTable.

The selection is a rectangular set of cells. One of the rectangle's cells is called the anchor cell; that cell is the first selected. The init() function sets the anchor and sets the selection rectangle to just that cell; the expandTo() function expands the selection rectangle.

There are various access functions to get the area: anchorRow() and anchorCol() return the achor's position, and leftCol(), rightCol(), topRow() and bottomRow() return the rectangle's four edges. All four are in the selection.

A newly created QTableSelection is inactive -- isActive() returns FALSE. You must use init() and expandTo() to activate it.

See also QTable, QTable::addSelection() and QTable::selection().

## Member Function Documentation

### QTableSelection::QTableSelection ()

Creates an inactive selection. Use init() and expandTo() to activate it.

### int QTableSelection::anchorCol () const

Returns the anchor column of the selection.

### int QTableSelection::anchorRow () const

Returns the anchor row of the selection.

### int QTableSelection::bottomRow () const

Returns the bottom row of the selection.

### void QTableSelection::expandTo ( int row, int col )

Expands the selection to row, col. The new selection rectangle is the bounding rectangle of row, col and the old selection rectangle. After calling that function, the selections is active.

If you didn't call init() yet, this function does nothing.

See also init() and isActive().

### void QTableSelection::init ( int row, int col )

Sets the selection anchor to row row and column col and sets the selection to just that cell.

See also expandTo() and isActive().

### bool QTableSelection::isActive () const

Returns whether the selection is active or not. A selection is active after init() and expandTo() has beem called.

### int QTableSelection::leftCol () const

Returns the left column of the selection.

### bool QTableSelection::operator== ( const QTableSelection & s ) const

Returns TRUE if s includes the same cells as this selection, or else FALSE.

### int QTableSelection::rightCol () const

Returns the right column of the selection.

### int QTableSelection::topRow () const

Returns the top row of the selection.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.