Class representing a panel of actions similar to Windows Vista/7 control panel items. More...
#include <actionbox.h>
Public Member Functions | |
ActionBox (const QPixmap &icon, const QString &headerText, QWidget *parent=nullptr) | |
Constructor. More... | |
ActionBox (const QString &headerText, QWidget *parent=nullptr) | |
Constructor. More... | |
ActionBox (QWidget *parent=nullptr) | |
Constructor. More... | |
void | addLayout (QLayout *l) |
Adds layout l to the default layout. More... | |
void | addWidget (QWidget *w, QLayout *l=nullptr) |
Adds widget w to the layout. More... | |
QLayout * | createHBoxLayout () |
Creates empty horizontal layout. More... | |
ActionLabel * | createItem (const QPixmap &icon, const QString &text, QLayout *l=nullptr) |
Adds an action with icon and text to the ActionBox and returns action item. More... | |
ActionLabel * | createItem (const QString &text=QString(), QLayout *l=nullptr) |
Adds an action with text to the ActionBox and returns action item. More... | |
ActionLabel * | createItem (QAction *action, QLayout *l=nullptr) |
Creates action item from the action and returns it. More... | |
QList< ActionLabel * > | createItems (QList< QAction * > actions) |
Creates action items from the actions list and returns the list of action items. More... | |
QSpacerItem * | createSpacer (QLayout *l=nullptr) |
Adds a spacer and returns spacer item. More... | |
ActionLabel * | header () const |
Returns header item of the ActionBox. More... | |
QPixmap | icon () const |
Returns icon of the ActionBox. More... | |
QLayout * | itemLayout () const |
Returns default layout used for actions (typically it's QVBoxLayout). More... | |
virtual QSize | minimumSizeHint () const |
void | setIcon (const QPixmap &icon) |
Sets icon of the ActionBox to icon. More... | |
Protected Member Functions | |
void | init () |
Protected Attributes | |
QVBoxLayout * | dataLayout |
ActionLabel * | headerLabel |
QLabel * | iconLabel |
Properties | |
ActionLabel | header |
QPixmap | icon |
Class representing a panel of actions similar to Windows Vista/7 control panel items.
ActionBox normally consists of an icon, clickable header and a list of actions. Every action can have own icon as well, provide tooltips and status tips, be clickable and checkable etc. i.e. behave like a normal ActionLabel.
ActionBox objects are easily customizable via CSS technology - you can get different look just by writing corresponding style sheet.
Usage of ActionBox in the application
createItem() also allows to create an ActionLabel from already existing QAction:
Customization of ActionBox via CSS
ActionBox items can be easily customized using CSS mechanism. Just create a new style and apply it to the ActionBox with setStyleSheet().
See the following example of the complete ActionBox customization. Note that QSint--ActionBox is used as a main class name. Headers are ActionLabels with property class='header'. Actions are ActionLabels with property class='action'.
|
explicit |
Constructor.
References headerLabel, and init().
|
explicit |
Constructor.
References headerLabel, icon, init(), and setIcon().
void QSint::ActionBox::addLayout | ( | QLayout * | l | ) |
Adds layout l to the default layout.
References dataLayout.
Adds widget w to the layout.
By default, widget is added to the default vertical layout. You can add widget to the specified layout passing it as l parameter.
References createSpacer(), and dataLayout.
QLayout * QSint::ActionBox::createHBoxLayout | ( | ) |
Creates empty horizontal layout.
Use this function to arrange action items into a row.
References createSpacer(), and dataLayout.
Referenced by createItems().
ActionLabel * QSint::ActionBox::createItem | ( | const QPixmap & | icon, |
const QString & | text, | ||
QLayout * | l = nullptr |
||
) |
Adds an action with icon and text to the ActionBox and returns action item.
This function acts just like previous one. See the description above.
References createItem(), and icon.
ActionLabel * QSint::ActionBox::createItem | ( | const QString & | text = QString() , |
QLayout * | l = nullptr |
||
) |
Adds an action with text to the ActionBox and returns action item.
References createSpacer(), and dataLayout.
ActionLabel * QSint::ActionBox::createItem | ( | QAction * | action, |
QLayout * | l = nullptr |
||
) |
Creates action item from the action and returns it.
By default, action is added to the default vertical layout, i.e. subsequent calls of this function will create several actions arranged vertically, one below another.
You can add action to the specified layout passing it as l parameter. This allows to do custom actions arrangements, i.e. horizontal etc.
References createItem().
Referenced by Gui::TaskView::TaskGroup::actionEvent(), createItem(), createItems(), and init().
QList< ActionLabel * > QSint::ActionBox::createItems | ( | QList< QAction * > | actions | ) |
Creates action items from the actions list and returns the list of action items.
References createHBoxLayout(), and createItem().
QSpacerItem * QSint::ActionBox::createSpacer | ( | QLayout * | l = nullptr | ) |
Adds a spacer and returns spacer item.
By default, a spacer is added to the default vertical layout. You can add a spacer to the specified layout passing it as l parameter.
References dataLayout.
Referenced by addWidget(), createHBoxLayout(), and createItem().
ActionLabel * QSint::ActionBox::header | ( | ) | const |
Returns header item of the ActionBox.
QPixmap QSint::ActionBox::icon | ( | ) | const |
Returns icon of the ActionBox.
References iconLabel.
Referenced by addonmanager_macro.Macro::clean_icon(), addonmanager_macro.Macro::fill_details_from_wiki(), PathScripts.PathIconViewProvider.ViewProvider::getIcon(), PathScripts.PathOpGui.TaskPanelPage::getIcon(), addonmanager_macro.Macro::install(), addonmanager_macro.Macro::parse_wiki_page_for_icon(), and addonmanager_macro.Macro::remove().
|
protected |
References QSint::ActionBoxStyle, createItem(), dataLayout, headerLabel, and iconLabel.
Referenced by ActionBox(), and DocumentObject.DocumentObject::onChanged().
QLayout * QSint::ActionBox::itemLayout | ( | ) | const |
Returns default layout used for actions (typically it's QVBoxLayout).
|
virtual |
void QSint::ActionBox::setIcon | ( | const QPixmap & | icon | ) |
|
protected |
Referenced by addLayout(), addWidget(), createHBoxLayout(), createItem(), createSpacer(), and init().
|
protected |
Referenced by ActionBox(), and init().
|
read |
|
readwrite |
Referenced by ActionBox(), addonmanager_macro.Macro::clean_icon(), createItem(), addonmanager_macro.Macro::fill_details_from_wiki(), PathScripts.PathIconViewProvider.ViewProvider::getIcon(), PathScripts.PathOpGui.TaskPanelPage::getIcon(), addonmanager_macro.Macro::install(), addonmanager_macro.Macro::parse_wiki_page_for_icon(), addonmanager_macro.Macro::remove(), and setIcon().