Widget used as tab for toolbar containing buttons.
More...
#include <toolbartab.h>
|
| | ToolbarTab (QWidget *parent=0) |
| | Create widget. More...
|
| |
| QGroupBox * | addGroup (const char *name) |
| | Add new group. More...
|
| |
| void | addWidget (QGroupBox *groupBox, QWidget *widget, int x=0, int y=0, int w=0, int h=1) |
| | Add new widget. More...
|
| |
| QPushButton * | addButton (QGroupBox *groupBox, const char *buttonName, int x=0, int y=0, int w=1, int h=1) |
| | Create a new button and add it to the page. More...
|
| |
| QGroupBox * | groupByName (const char *groupName) |
| | Get existing group. More...
|
| |
| QPushButton * | buttonByText (QGroupBox *groupBox, const char *buttonText) |
| | Get existing button. More...
|
| |
| void | removeGroup (QGroupBox *group) |
| | Remove group. More...
|
| |
| void | removeButton (QPushButton *button) |
| | Remove button. More...
|
| |
Widget used as tab for toolbar containing buttons.
Definition at line 19 of file toolbartab.h.
| ToolbarTab::ToolbarTab |
( |
QWidget * |
parent = 0 | ) |
|
Create widget.
- Parameters
-
| parent | Pointer to parent widget |
Definition at line 4 of file toolbartab.cpp.
6 ui(
new Ui::ToolbarTab) {
9 if(
ui->container->layout() == 0) {
14 _layout =
dynamic_cast<QHBoxLayout*
>(
ui->container->layout());
17 throw "Wrong layout for ToolbarTab container";
| QPushButton * ToolbarTab::addButton |
( |
QGroupBox * |
groupBox, |
|
|
const char * |
buttonName, |
|
|
int |
x = 0, |
|
|
int |
y = 0, |
|
|
int |
w = 1, |
|
|
int |
h = 1 |
|
) |
| |
Create a new button and add it to the page.
- Parameters
-
| groupBox | Pointer to target group |
| buttonName | Name of the new button |
| x | Horizontal position |
| y | Vertical position |
| w | Width |
| h | Height |
Definition at line 31 of file toolbartab.cpp.
32 auto button =
new QPushButton(buttonName);
| QGroupBox * ToolbarTab::addGroup |
( |
const char * |
name | ) |
|
Add new group.
- Parameters
-
- Returns
- Pointer to created QGroupBox
Definition at line 22 of file toolbartab.cpp.
23 auto group =
new QGroupBox(tr(name));
24 group->setLayout(
new QGridLayout());
| void ToolbarTab::addWidget |
( |
QGroupBox * |
groupBox, |
|
|
QWidget * |
widget, |
|
|
int |
x = 0, |
|
|
int |
y = 0, |
|
|
int |
w = 0, |
|
|
int |
h = 1 |
|
) |
| |
Add new widget.
- Parameters
-
| groupBox | Pointer to target group |
| button | Pointer to existing QPushButton |
| x | Horizontal position |
| y | Vertical position |
| w | Width |
| h | Height |
Definition at line 39 of file toolbartab.cpp.
40 if(groupBox ==
nullptr) {
44 auto gridLayout =
dynamic_cast<QGridLayout*
>(groupBox->layout());
47 gridLayout->addWidget(widget, y, x, h, w);
50 groupBox->layout()->addWidget(widget);
| QPushButton * ToolbarTab::buttonByText |
( |
QGroupBox * |
groupBox, |
|
|
const char * |
buttonText |
|
) |
| |
Get existing button.
- Parameters
-
| groupBox | Group to search |
| buttonText | Button name |
- Returns
- Pointer to QPushButton
Definition at line 68 of file toolbartab.cpp.
69 auto nbButtons = groupBox->layout()->count();
71 for (
int i = 0; i < nbButtons; i++) {
72 auto button =
dynamic_cast<QPushButton*
>(groupBox->layout()->itemAt(i)->widget());
74 if(button && button->text() == buttonText) {
| QGroupBox * ToolbarTab::groupByName |
( |
const char * |
groupName | ) |
|
Get existing group.
- Parameters
-
- Returns
- Pointer to QGroupBox
Definition at line 54 of file toolbartab.cpp.
55 auto nbGroups =
_layout->count();
57 for (
int i = 0; i < nbGroups; i++) {
58 auto groupBox =
dynamic_cast<QGroupBox*
>(
_layout->itemAt(i)->widget());
60 if (groupBox && groupBox->title() == groupName) {
| void ToolbarTab::removeButton |
( |
QPushButton * |
button | ) |
|
Remove button.
- Parameters
-
| button | Pointer to QPushButton |
Definition at line 90 of file toolbartab.cpp.
91 if(button !=
nullptr) {
| void ToolbarTab::removeGroup |
( |
QGroupBox * |
group | ) |
|
Remove group.
- Parameters
-
| group | Pointer to QGroupBox |
Definition at line 82 of file toolbartab.cpp.
83 if(group ==
nullptr) {
| QHBoxLayout* ToolbarTab::_layout |
|
private |
| Ui::ToolbarTab* ToolbarTab::ui |
|
private |
The documentation for this class was generated from the following files: