ICS

QicsTable Documentation Set

QicsNavigator Class Reference

Helper widget class that allows navigation through grid. QicsNavigator is helper widget class that allows navigation through grid. It is the subclass of QToolButton that placed in bottom rigth corner of table. Mouse press on it shows navigator frame where user can perform navigation. More...

#include <QicsNavigator.h>

Inherits QToolButton.

List of all members.

Public Slots

void navigate (const QRect &total, const QRect &view)
void resizeWindow (int w, int h)
void resizeWindow (const QSize &size)

Signals

void changed (const QRect &view)

Public Member Functions

 QicsNavigator (QWidget *parent)
 ~QicsNavigator ()
QicsNavigatorFramewindow () const

Protected Attributes

QicsNavigatorFramem_nav


Detailed Description

Helper widget class that allows navigation through grid. QicsNavigator is helper widget class that allows navigation through grid. It is the subclass of QToolButton that placed in bottom rigth corner of table. Mouse press on it shows navigator frame where user can perform navigation.

nav.png

Navigation through table grid using QicsNavigator

QicsNavigator can be used also as standalone widget inside your own application. You should install two signal handlers (for pressed and changed signals) in order to setup navigator and react to user's actions. See changed and navigate members.

Example

Creating navigator widget and installing signal handlers for user interaction.

    myNavButton = new QicsNavigator(this);          // create navigator object
    myNavButton->setFixedSize(18,18);               // set size of the button
    myNavButton->resizeWindow(100,100);             // set size of the windows
    
    connect(myNavButton, SIGNAL(pressed()), this, SLOT(showNavigator()));
    connect(myNavButton, SIGNAL(changed(const QRect&)), this, SLOT(navigate(const QRect&)));

Handling pressed signal should bring the navigation window up.

    void QicsTable::showNavigator()
    {
        // create a rect which fits currently visible part of the table
        QRect view(leftColumn(), topRow(), visibleColumns(), visibleRows());

        // show navigator window scaled to total table size (QicsTable::currentViewport()) with mapped visible region (view)
        myNavButton->navigate(currentViewport(), view);
    }

Handling changed signal should make visible selected part of the table.

    void QicsTable::navigate(const QRect &view)
    {
        // view is chosen by the user from navigator window - we should map it to the table
        // in order to make this region visible at the screen
        setLeftColumn(view.left());
        setTopRow(view.top());
    }

See also:
QicsTable::setNavigatorAllowed(), QicsTable::isNavigatorAllowed()


Constructor & Destructor Documentation

QicsNavigator::QicsNavigator ( QWidget *  parent  ) 

Constructor

QicsNavigator::~QicsNavigator (  ) 

Destructor


Member Function Documentation

QicsNavigatorFrame* QicsNavigator::window (  )  const [inline]

Returns navigator window. You can change its opacity, frame shape and other common QFrame's properties.

void QicsNavigator::changed ( const QRect &  view  )  [signal]

This signal is emitted when current region in the navigator window is changed by the user (i.e. via mouse).

In your own application, you should handle this signal in order to setup your widget to make the view region visible at the screen.

Parameters:
view Current region displayed in the navigator.

void QicsNavigator::navigate ( const QRect &  total,
const QRect &  view 
) [slot]

Setup navigator to treat total rect as the whole area and view rect as the current region (part which is visible on the screen).

Normally, it should be called every time when the navigator is about to be shown, to ensure that its window is updated accordingly to the last area/viewport changes. In your own application, you should create a slot which will perform this action and connect it with navigator's pressed signal.

Parameters:
total Widget's total area (in logical coordinates).
view Current region displayed in the navigator (in logical coordinates).

void QicsNavigator::resizeWindow ( int  w,
int  h 
) [slot]

Resizes navigator window to the given size.

Parameters:
w New width in pixels.
h New height in pixels.

void QicsNavigator::resizeWindow ( const QSize &  size  )  [slot]

Resizes navigator window to the given size (same as above).

Parameters:
size New size in pixels.


The documentation for this class was generated from the following file:

All trademarks and copyrights on this page are properties of their respective owners.
The rest is copyright ©1999-2006 Integrated Computer Solutions, Inc.