#include <QicsNavigator.h>
Inherits QToolButton.
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 () | |
| QicsNavigatorFrame * | window () const |
Protected Attributes | |
| QicsNavigatorFrame * | m_nav |
Navigation through table grid using QicsNavigator
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()); }
| QicsNavigator::QicsNavigator | ( | QWidget * | parent | ) |
Constructor
| QicsNavigator::~QicsNavigator | ( | ) |
Destructor
| 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.
| 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.
| 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.
| 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).
| size | New size in pixels. |