Version: 9.15.0
QtxInfoPanel Class Reference

Info panel which allows presenting welcome, useful hints and other information dynamically, e.g. in the dock panel of main application's window. More...

#include <QtxInfoPanel.h>

Inheritance diagram for QtxInfoPanel:
Inheritance graph

Classes

class  Container
 Container to store widgets within info panel. More...
 
class  Title
 Info panel's title widget. More...
 

Public Member Functions

 QtxInfoPanel (QWidget *=0)
 Create panel. More...
 
 ~QtxInfoPanel ()
 Destructor. More...
 
void setTitle (const QString &)
 Set panel's title. More...
 
int addLabel (const QString &, const int=-1)
 Add left-aligned text label to the given group. More...
 
int addLabel (const QString &, Qt::Alignment, const int=-1)
 Add text label to the given group. More...
 
int addAction (QAction *, const int=-1)
 Add action button to the given group. More...
 
int addGroup (const QString &, const int=-1)
 Add (sub-)group to the given group. More...
 
void remove (const int)
 Remove given item from panel. More...
 
void clear (const int=-1)
 Clear contents of panel of group. More...
 
void setVisible (const int, bool)
 Change item's visibility. More...
 
void setEnabled (const int, bool)
 Enable / disable item. More...
 

Private Member Functions

int generateId () const
 Generate new unique identifier. More...
 
QWidgetfind (const int) const
 Find widget that represents given item. More...
 

Private Attributes

Titletitle
 
Containercontainer
 

Detailed Description

Info panel which allows presenting welcome, useful hints and other information dynamically, e.g. in the dock panel of main application's window.

The Info panel normally has a title (aimed to shortly present the current application's context) and a set of buttons and text labels combined into the groups (which may be nested).

Buttons normally represent some quick actions which are applicable in the current context. Text labels can be used to show additional information like hints, proposed actions, etc.

To set the title to the panel, use method setTitle(). Text label can be added to the panel with addLabel() method, action (button) is added via addAction() method.

By default, items are added to the top level, untitled group. Additionally, panel allows arranging items into groups; new group can be added with the addGroup() method.

Each of addAction(), addLabel(), addGroup() methods return item's unique identifier. This identifier can be used, for instance, to enable/disable item with setEnabled() method, hide/show with setVisible() method, remove from panel with remove() method. The same action can be added to the panel several times, e.g. to the different groups - the corresponding buttons will have different unique ids.

To remove all contents of panel, use clear() method.

Constructor & Destructor Documentation

◆ QtxInfoPanel()

QtxInfoPanel::QtxInfoPanel ( QWidget parent = 0)

Create panel.

Parameters
parentParent widget.

References container, setTitle(), and title.

◆ ~QtxInfoPanel()

QtxInfoPanel::~QtxInfoPanel ( )

Destructor.

Member Function Documentation

◆ addAction()

int QtxInfoPanel::addAction ( QAction action,
const int  groupId = -1 
)

Add action button to the given group.

Parameters
actionAction being added (note: parent is not changed).
groupIdGroup's identifier. Value -1 (default) is used to add button to the top-level (untitled) group.
Returns
Button's unique identifier.

References QtxInfoPanel::Container::addAction(), find(), and generateId().

◆ addGroup()

int QtxInfoPanel::addGroup ( const QString &  text,
const int  groupId = -1 
)

Add (sub-)group to the given group.

Parameters
textGroup's title.
groupIdParent group's identifier. Value -1 (default) is used to add (sub-)group to the top-level (untitled) group (i.e. panel itself).
Returns
Group's unique identifier.

References QtxInfoPanel::Container::addGroup(), find(), and generateId().

◆ addLabel() [1/2]

int QtxInfoPanel::addLabel ( const QString &  text,
const int  groupId = -1 
)

Add left-aligned text label to the given group.

Parameters
textLabel's text.
groupIdGroup's identifier. Value -1 (default) is used to add label to the top-level (untitled) group.
Returns
Label's unique identifier.

◆ addLabel() [2/2]

int QtxInfoPanel::addLabel ( const QString &  text,
Qt::Alignment  alignment,
const int  groupId = -1 
)

Add text label to the given group.

Parameters
textLabel's text.
alignmentLabel's alignment.
groupIdGroup's identifier. Value -1 (default) is used to add label to the top-level (untitled) group.
Returns
Label's unique identifier.

References QtxInfoPanel::Container::addLabel(), find(), and generateId().

◆ clear()

void QtxInfoPanel::clear ( const int  groupId = -1)

Clear contents of panel of group.

Parameters
groupIdGroup's identifier. Value -1 (default) is used to clear all contents of panel.

References QtxInfoPanel::Container::clear(), and find().

◆ find()

QWidget * QtxInfoPanel::find ( const int  id) const
private

Find widget that represents given item.

Parameters
idItem's (label's, button's, group's) identifier.
Returns
Item's widget (0 if not found).

References container, and QtxInfoPanel::Container::find().

◆ generateId()

int QtxInfoPanel::generateId ( ) const
private

Generate new unique identifier.

Returns
Unique identifier.

◆ remove()

void QtxInfoPanel::remove ( const int  id)

Remove given item from panel.

Note
If a group is removed, all its contents (recursively) is removed as well.
Parameters
idItem's (label's, button's, group's) identifier.

References find(), and QtxInfoPanel::Container::remove().

◆ setEnabled()

void QtxInfoPanel::setEnabled ( const int  id,
bool  enabled 
)

Enable / disable item.

Parameters
idItem's (label's, button's, group's) identifier.
enabledtrue to enable item, false to disable it.

References find().

◆ setTitle()

void QtxInfoPanel::setTitle ( const QString &  text)

Set panel's title.

Parameters
textTitle text (empty string removes title).

References title.

◆ setVisible()

void QtxInfoPanel::setVisible ( const int  id,
bool  visible 
)

Change item's visibility.

Parameters
idItem's (label's, button's, group's) identifier.
visibletrue to show item, false to hide it.

References find().

Member Data Documentation

◆ container

Container* QtxInfoPanel::container
private

◆ title

Title* QtxInfoPanel::title
private

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