Workstack widget. More...
#include <QtxWorkstack.h>
Public Types | |
enum | { SplitVertical = 0x01, SplitHorizontal = 0x02, Close = 0x04, Rename = 0x08, All } |
Workstack actions (context menu items) More... | |
enum | { VersionMarker = 0x01, SplitMarker = 0x02, AreaMarker = 0x04, WidgetMarker = 0x08 } |
enum | { Horizontal = 0x01, Visible = 0x02 } |
enum | SplitType { SplitStay, SplitAt, SplitMove } |
Workstack splitting type. More... | |
Public Slots | |
void | splitVertical () |
Split widgets vertically. More... | |
void | splitHorizontal () |
Split widgets horizontally. More... | |
Signals | |
void | windowActivated (QWidget *) |
Emitted when the workstack's child widget is activated. More... | |
Public Member Functions | |
QtxWorkstack (QWidget *=0) | |
Constructor. More... | |
virtual | ~QtxWorkstack () |
Destructor. More... | |
QWidgetList | windowList (QWidget *=0) const |
Get list of all widgets in all areas or in specified area which given widget belongs to. More... | |
QWidgetList | splitWindowList () const |
Get all child widgets in the active workarea. More... | |
QWidget * | activeWindow () const |
Get active widget. More... | |
void | setActiveWindow (QWidget *) |
Set active widget. More... | |
int | accel (const int) const |
Get the action's accelerator key-combination. More... | |
void | setAccel (const int, const int) |
Set accelerator key-combination for the action with specified id. More... | |
QIcon | icon (const int) const |
Get icon for the specified action. More... | |
void | setIcon (const int, const QIcon &) |
Set menu item icon for the specified action. More... | |
void | setMenuActions (const int) |
Set actions to be visible in the context popup menu. More... | |
int | menuActions () const |
Set actions to be visible in the context popup menu. More... | |
void | stack () |
Group all windows in one area. More... | |
void | split (const int) |
Split workstack. More... | |
bool | move (QWidget *wid, QWidget *wid_to, const bool before) |
Moves the first widget to the same area which the second widget belongs to. More... | |
QWidget * | addWindow (QWidget *, Qt::WindowFlags=0) |
Add child widget. More... | |
QByteArray | saveState (int) const |
Dump workstack configuration to the state description array. More... | |
bool | restoreState (const QByteArray &, int) |
Restore workstack configuration from the state description array. More... | |
void | setOpaqueResize (bool=true) |
Set resize mode of all splitters opaque or transparent. More... | |
bool | opaqueResize () const |
Get resize mode of all splitters: opaque (true ) or transparent (false ). More... | |
void | splittersVisible (QWidget *, bool=true) |
Show/hide splitters state and area. More... | |
void | Split (QWidget *wid, const Qt::Orientation o, const SplitType type) |
Split workarea of the given widget on two parts. More... | |
void | Attract (QWidget *wid1, QWidget *wid2, const bool all) |
Move widget(s) from the source workarea into the target workarea or reorder widgets inside one workarea. More... | |
void | SetRelativePosition (QWidget *wid, const Qt::Orientation o, const double pos) |
Set position of the widget relatively to the entire workstack. More... | |
void | SetRelativePositionInSplitter (QWidget *wid, const double pos) |
Set position of the widget relatively to its parent splitter. More... | |
void | updateState () |
Update internal state. More... | |
Protected Member Functions | |
virtual void | customEvent (QEvent *) |
Handle custom events. More... | |
QAction * | action (const int) const |
void | saveState (QDataStream &) const |
bool | restoreState (QDataStream &) |
Private Slots | |
void | onRename () |
Called when user activates "Rename" menu item. More... | |
void | onCloseWindow () |
Close active window. More... | |
void | onDestroyed (QObject *) |
Called when workarea is destroyed. More... | |
void | onWindowActivated (QWidget *) |
Called on window activating. More... | |
void | onContextMenuRequested (QWidget *, QPoint) |
Create and show popup menu for workarea. More... | |
void | onDeactivated (QtxWorkstackArea *) |
Called on window deactivating. More... | |
Private Member Functions | |
QSplitter * | splitter (QtxWorkstackArea *) const |
Get splitter corresponding to the workarea. More... | |
void | splitters (QSplitter *, QList< QSplitter * > &, const bool=false) const |
Get list of child splitters. More... | |
void | areas (QSplitter *, QList< QtxWorkstackArea * > &, const bool=false) const |
Get list of child workareas. More... | |
QSplitter * | wrapSplitter (QtxWorkstackArea *) |
Wrap area into the new splitter. More... | |
void | insertWidget (QWidget *, QWidget *, QWidget *) |
Reparent and add widget. More... | |
QtxWorkstackArea * | areaAt (const QPoint &) const |
Get workarea covering point. More... | |
QtxWorkstackArea * | wgArea (QWidget *) const |
Gets area containing given widget. More... | |
QtxWorkstackArea * | targetArea () |
Get target area (for which the current operation should be done). More... | |
QtxWorkstackArea * | activeArea () const |
Get active workarea. More... | |
QtxWorkstackArea * | currentArea () const |
Get current workarea. More... | |
void | setActiveArea (QtxWorkstackArea *) |
Set active workarea. More... | |
QtxWorkstackArea * | neighbourArea (QtxWorkstackArea *) const |
Get workarea which is nearest to area. More... | |
QtxWorkstackArea * | createArea (QWidget *) const |
Create new workarea. More... | |
void | updateState (QSplitter *) |
Update splitter state. More... | |
void | splitterVisible (QWidget *, QList< QSplitter * > &, QSplitter *, bool) |
Show/hide splitter state and area. More... | |
void | distributeSpace (QSplitter *) const |
Redistribute space among widgets equally. More... | |
int | setPosition (QWidget *wid, QSplitter *split, const Qt::Orientation o, const int need_pos, const int splitter_pos) |
Set position of the widget. More... | |
Private Attributes | |
QPointer< QWidget > | myWin |
active widget More... | |
QPointer< QtxWorkstackArea > | myArea |
active workarea More... | |
QtxWorkstackSplitter * | mySplit |
tol-level splitter More... | |
QPointer< QWidget > | myWorkWin |
widget where popup menu is invoked (used internally) More... | |
QPointer< QtxWorkstackArea > | myWorkArea |
workarea where popup menu is invoked (used internally) More... | |
QMap< int, QAction * > | myActionsMap |
actions map More... | |
Friends | |
class | QtxWorkstackArea |
class | QtxWorkstackDrag |
class | QtxWorkstackAction |
class | QtxWorkstackSplitter |
Organizes the child widgets in the tabbed space. Allows splitting the working area to arrange the child widgets in arbitrary way. Any widgets can be moved to another working area with drag-n-drop operation.
This widget can be used as workspace of the application main window, for example, as kind of implementation of multi-document interface.
anonymous enum |
QtxWorkstack::QtxWorkstack | ( | QWidget * | parent = 0 | ) |
parent | parent widget |
References Close, myActionsMap, mySplit, onCloseWindow(), onRename(), QtxWorkstackSplitter, Rename, SplitHorizontal, splitHorizontal(), SplitVertical, and splitVertical().
|
virtual |
int QtxWorkstack::accel | ( | const int | id | ) | const |
References myActionsMap.
|
private |
References myArea.
w | widget |
f | widget flags |
References QtxWorkstackArea::insertWidget(), and targetArea().
|
private |
|
private |
split | parent splitter |
areaList | list to be filled with child workareas |
rec | if true , perform recursive search of children |
Move wid2 in target workarea. Put it right after wid1. If all parameter is true
, all widgets from source workarea will be moved including wid2 and source workarea will be deleted then.
If wid1 and wid2 belongs to one workarea, widgets will be just reordered in that workarea.
wid1 | widget from target workarea |
wid2 | widget from source workarea |
all | if true , all widgets from source workarea will be moved into the target one, else only the wid2 will be moved |
References QtxWorkstackArea::activeWidget(), areas(), distributeSpace(), QtxWorkstackArea::insertWidget(), mySplit, QtxWorkstackArea::removeWidget(), QtxWorkstackArea::setActiveWidget(), splitter(), and QtxWorkstackArea::widgetList().
|
private |
parent | parent widget |
References onContextMenuRequested(), onDeactivated(), onDestroyed(), onWindowActivated(), and QtxWorkstackArea.
|
private |
Current workarea is that one which has input focus.
|
protectedvirtual |
e | custom event (not used) |
References updateState().
|
private |
split | splitter |
References Horizontal.
QIcon QtxWorkstack::icon | ( | const int | id | ) | const |
If id is invalid, null icon is returned.
id | menu action ID |
References myActionsMap.
wid | widget |
pWid | parent widget |
after | widget after which wid should be added |
int QtxWorkstack::menuActions | ( | ) | const |
Actions, which IDs are set in flags parameter, will be shown in the context popup menu. Other actions will not be shown.
flags | ORed together actions flags |
References Close, myActionsMap, Rename, SplitHorizontal, and SplitVertical.
wid | widget to be moved |
wid_to | widget specified the destination area |
before | specifies whether the first widget has to be moved before or after the second widget |
true
if operation is completed successfully, false
otherwise References QtxWorkstackArea::insertWidget(), QtxWorkstackArea::removeWidget(), wgArea(), and QtxWorkstackArea::widgetList().
|
private |
|
privateslot |
References activeWindow(), and myWorkWin.
|
privateslot |
w | workarea |
p | popup position |
References activeArea(), Close, myActionsMap, myWorkArea, myWorkWin, Rename, Qtx::simplifySeparators(), SplitHorizontal, SplitVertical, and QtxWorkstackArea::widgetList().
|
privateslot |
area | workarea being deactivated |
References QtxWorkstackArea::activeWidget(), areas(), myArea, mySplit, myWin, and neighbourArea().
|
privateslot |
Set input focus to the neighbour area.
obj | workarea being destroyed |
References myArea, and neighbourArea().
|
privateslot |
Changes widget title.
References myWorkWin.
|
privateslot |
area | workarea being activated (not used) |
References obj, and setActiveArea().
bool QtxWorkstack::opaqueResize | ( | ) | const |
References mySplit.
bool QtxWorkstack::restoreState | ( | const QByteArray & | state, |
int | version | ||
) |
|
protected |
QByteArray QtxWorkstack::saveState | ( | int | version | ) | const |
|
protected |
References mySplit, and QtxWorkstackSplitter::saveState().
id | action ID |
accel | action accelerator |
References myActionsMap.
|
private |
workarea |
References myArea, myWin, QtxWorkstackArea::updateActiveState(), and windowActivated().
void QtxWorkstack::setActiveWindow | ( | QWidget * | wid | ) |
wid | widget to activate |
References activeArea(), and QtxWorkstackArea::setActiveWidget().
id | menu action ID |
ico | new menu item icon |
References myActionsMap.
void QtxWorkstack::setMenuActions | ( | const int | flags | ) |
Actions, which IDs are set in flags parameter, will be shown in the context popup menu. Other actions will not be shown.
flags | ORed together actions flags |
References Close, myActionsMap, Rename, SplitHorizontal, and SplitVertical.
void QtxWorkstack::setOpaqueResize | ( | bool | opaque = true | ) |
opaque | opaque mode |
References mySplit, split(), and splitters().
|
private |
Called from SetRelativePosition() public method.
wid | widget to be moved |
split | currently processed splitter (goes from more common to more particular splitter in recursion calls) |
o | orientation of positioning |
need_pos | required position of the given widget in pixels (from top/left side of workstack area) |
splitter_pos | position of the splitter split (from top/left side of workstack area) |
References areas(), QtxWorkstackArea::contains(), Horizontal, isFound(), positionSimple(), and setSizes().
void QtxWorkstack::SetRelativePosition | ( | QWidget * | wid, |
const Qt::Orientation | o, | ||
const double | position | ||
) |
If o is Qt::Horizontal
, the horizontal position of wid will be changed. If o is Qt::Vertical
, the vertical position of wid will be changed.
wid | widget |
o | orientation of positioning (Qt::Horizontal or Qt::Vertical ) |
pos | position relatively to the workstack; value in range [0..1] |
References Horizontal, mySplit, and setPosition().
Orientation of positioning will correspond to the splitter orientation.
wid | widget |
pos | position relatively to the splitter; value in the range [0..1] |
References areas(), Horizontal, isFound(), mySplit, setSizes(), split(), and splitter().
void QtxWorkstack::split | ( | const int | o | ) |
Splitting is possible only if there are two or more widgets in the workarea. This function splits current workarea to two new ones.
o | splitting orientation (Qt::Orientation) |
References activeArea(), QtxWorkstackArea::activeWidget(), areas(), createArea(), distributeSpace(), QtxWorkstackArea::insertWidget(), myWorkArea, QtxWorkstackArea::removeWidget(), s, splitter(), splitters(), QtxWorkstackArea::widgetList(), and wrapSplitter().
void QtxWorkstack::Split | ( | QWidget * | wid, |
const Qt::Orientation | o, | ||
const SplitType | type | ||
) |
Splitting is possible only if there are two or more widgets in the workarea. This function splits current workarea to two new ones.
wid | widget belonging to the workstack |
o | splitting orientation type (Qt::Orientation) |
type | splitting type (QtxWorkstack::SplitType) |
References QtxWorkstackArea::activeWidget(), areas(), createArea(), distributeSpace(), insertWidget(), QtxWorkstackArea::insertWidget(), mySplit, QtxWorkstackArea::removeWidget(), s, SplitAt, SplitMove, SplitStay, splitter(), splitters(), QtxWorkstackArea::widgetList(), and wrapSplitter().
|
private |
|
private |
split | parent splitter |
splitList | list to be filled with child splitters |
rec | if true , perform recursive search of children |
void QtxWorkstack::splittersVisible | ( | QWidget * | wid, |
bool | visible = true |
||
) |
wid | widget (and parent area) will be shown/hidden |
visible | splitters |
References mySplit, and splitterVisible().
|
private |
wid | widget (and parent area) will be shown/hidden |
parent_list | parent splitters list |
split | splitter will be shown/hidden |
visible | splitter |
References areas(), QtxWorkstackArea::childList(), mySplit, QtxWorkstackArea::showTabBar(), splitter(), and splitters().
|
slot |
References Horizontal, and split().
QWidgetList QtxWorkstack::splitWindowList | ( | ) | const |
References myArea.
void QtxWorkstack::stack | ( | ) |
true
if operation is completed successfully, false
otherwise References QtxWorkstackArea::insertWidget(), QtxWorkstackArea::removeWidget(), wgArea(), and windowList().
|
private |
Returns active workarea or current area (if there is no active workarea). If there are no workareas, create new workarea and return it.
References activeArea(), areas(), createArea(), currentArea(), and mySplit.
void QtxWorkstack::updateState | ( | ) |
References mySplit.
|
private |
split | splitter to be updated |
References areas(), mySplit, splitters(), and updateState().
|
private |
|
signal |
w | widget being activated |
QWidgetList QtxWorkstack::windowList | ( | QWidget * | wid = 0 | ) | const |
|
private |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |