BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
QAccordion base class. More...
Signals | |
void | numberOfContentPanesChanged (int number) |
Signals the new number of content panes. More... | |
Public Member Functions | |
AccordionWidget (QWidget *parent=0) | |
QAccordion constructor. More... | |
int | addContentPane (ContentPane *cpane) |
Add content pane. More... | |
int | addContentPane (QString header) |
Add a new content Pane. More... | |
int | addContentPane (QString header, QFrame *contentFrame) |
Add a new content Pane. More... | |
void | getActiveContentPaneIndex (std::vector< int > &indexVector) |
Get the index of the active ContentPane. More... | |
bool | getCollapsible () |
Get collapsible status. More... | |
ContentPane * | getContentPane (uint index) |
Get content pane. More... | |
int | getContentPaneIndex (ContentPane *contentPane) |
Get the index of a content pane. More... | |
int | getContentPaneIndex (QFrame *contentFrame) |
Get the index of a content pane. More... | |
int | getContentPaneIndex (QString header) |
Get the index of a content pane. More... | |
QString | getError () |
Get error string. More... | |
bool | getMultiActive () |
Check status of multiActive. More... | |
bool | insertContentPane (uint index, ContentPane *cpane) |
Insert content pane. More... | |
bool | insertContentPane (uint index, QString header) |
Insert content pane. More... | |
bool | insertContentPane (uint index, QString header, QFrame *contentFrame) |
Insert content pane. More... | |
bool | moveContentPane (uint currentIndex, uint newIndex) |
Move content pane. More... | |
int | numberOfContentPanes () |
Returns the number of content panes. More... | |
bool | removeContentPane (bool deleteObject, ContentPane *contentPane) |
Remove a content pane. More... | |
bool | removeContentPane (bool deleteObject, QFrame *contentframe) |
Remove a content pane. More... | |
bool | removeContentPane (bool deleteObject, QString header) |
Remove a content pane. More... | |
bool | removeContentPane (bool deleteObject, uint index) |
Remove a content pane. More... | |
void | setCollapsible (bool status) |
If collapsible is true you can close all ContentPanes. More... | |
void | setMultiActive (bool status) |
Allow multiple ContentPane to be open. More... | |
bool | swapContentPane (uint index, ContentPane *cpane) |
Swap the content pane. More... | |
Protected Member Functions | |
void | paintEvent (ATTR_UNUSED QPaintEvent *event) |
paintEvent Reimplement paintEvent to use stylesheets in derived Widgets More... | |
Private Slots | |
void | numberOfPanesChanged (int number) |
Private Member Functions | |
bool | checkIndexError (uint index, bool sizeIndexAllowed, const QString &errMessage) |
int | findContentPaneIndex (QString name="", QFrame *cframe=nullptr, ContentPane *cpane=nullptr) |
void | handleClickedSignal (ContentPane *cpane) |
int | internalAddContentPane (QString header, QFrame *cframe=nullptr, ContentPane *cpane=nullptr) |
bool | internalInsertContentPane (uint index, QString header, QFrame *contentFrame=nullptr, ContentPane *cpane=nullptr) |
bool | internalRemoveContentPane (bool deleteOject, int index=-1, QString name="", QFrame *contentFrame=nullptr, ContentPane *cpane=nullptr) |
Private Attributes | |
bool | collapsible |
std::vector< ContentPane * > | contentPanes |
QString | errorString |
bool | multiActive |
QSpacerItem * | spacer |
QAccordion base class.
This class is the basis of the qAccordion widget. If you want to add a accordion widget to your gui then you have to create an object of this class.
Managing content panes is simpel:
The signal numberOfContentPanesChanged() is emitted whenever the number of content panes changed.
In case of an error you may get a more detailed error description with getError().
Definition at line 77 of file AccordionWidget.h.
|
explicit |
QAccordion constructor.
parent | Optionally provide a parent widget |
Definition at line 35 of file AccordionWidget.cpp.
References collapsible, multiActive, numberOfContentPanesChanged(), numberOfPanesChanged(), and spacer.
int AccordionWidget::addContentPane | ( | ContentPane * | cpane | ) |
Add content pane.
cpane | New content pane to add |
This is an overloaded method of addContentPane(QString), that allows you to provide your own content pane.
Definition at line 73 of file AccordionWidget.cpp.
References internalAddContentPane().
int AccordionWidget::addContentPane | ( | QString | header | ) |
Add a new content Pane.
header | Header of the content pane |
Use this method to add a new content pane with the Header header. The method will return the index of the new content pane, or -1 if the pane was not added because header already exists.
Definition at line 63 of file AccordionWidget.cpp.
References internalAddContentPane().
Referenced by MaskEditorPropertyPanel::setup_MaskProperties(), MaskEditorPropertyPanel::setup_MaskStack(), MaskEditorPropertyPanel::setup_PlotProperties(), and TestView::test_AccordionWidget().
int AccordionWidget::addContentPane | ( | QString | header, |
QFrame * | contentFrame | ||
) |
Add a new content Pane.
header | Header of the content pane |
contentFrame | The content of the pane |
This is an overloaded method of addContentPane(QString), that allows you to provide your own content frame.
Definition at line 68 of file AccordionWidget.cpp.
References internalAddContentPane().
|
private |
Definition at line 356 of file AccordionWidget.cpp.
References errorString, and numberOfContentPanes().
Referenced by internalInsertContentPane(), internalRemoveContentPane(), moveContentPane(), and swapContentPane().
|
private |
Definition at line 323 of file AccordionWidget.cpp.
References contentPanes, and RealSpace::Particles::name().
Referenced by getContentPaneIndex(), internalAddContentPane(), internalInsertContentPane(), internalRemoveContentPane(), and swapContentPane().
void AccordionWidget::getActiveContentPaneIndex | ( | std::vector< int > & | indexVector | ) |
Get the index of the active ContentPane.
This method will fill a vector with the index of all active ContentPanes. The vector will be empty if no ContentPane is active
Definition at line 192 of file AccordionWidget.cpp.
References contentPanes.
Referenced by handleClickedSignal().
bool AccordionWidget::getCollapsible | ( | ) |
Get collapsible status.
Definition at line 219 of file AccordionWidget.cpp.
References collapsible.
ContentPane * AccordionWidget::getContentPane | ( | uint | index | ) |
Get content pane.
index | Index of the content pane |
Get a content pane (QFrame*) with index. This method will return a nullptr if the content pane does not exist.
Definition at line 166 of file AccordionWidget.cpp.
References contentPanes, and errorString.
Referenced by MaskEditorPropertyPanel::MaskEditorPropertyPanel(), MaskEditorPropertyPanel::setup_MaskProperties(), MaskEditorPropertyPanel::setup_MaskStack(), MaskEditorPropertyPanel::setup_PlotProperties(), and TestView::test_AccordionWidget().
int AccordionWidget::getContentPaneIndex | ( | ContentPane * | contentPane | ) |
Get the index of a content pane.
contentPane | ContentPane* |
This is an overloaded function of getContentPaneIndex(QString)
Definition at line 187 of file AccordionWidget.cpp.
References findContentPaneIndex().
int AccordionWidget::getContentPaneIndex | ( | QFrame * | contentFrame | ) |
Get the index of a content pane.
contentFrame | Content Frame |
This is an overloaded function of getContentPaneIndex(QString)
Definition at line 182 of file AccordionWidget.cpp.
References findContentPaneIndex().
int AccordionWidget::getContentPaneIndex | ( | QString | header | ) |
Get the index of a content pane.
header | Header of the Content Pane |
Get the index of a ContentPane with header. This method will return -1 if a ContentPane with this header does not exist.
Definition at line 177 of file AccordionWidget.cpp.
References findContentPaneIndex().
QString AccordionWidget::getError | ( | ) |
Get error string.
Call this method after a function call failed for a detailed error description.
Definition at line 224 of file AccordionWidget.cpp.
References errorString.
bool AccordionWidget::getMultiActive | ( | ) |
Check status of multiActive.
Definition at line 209 of file AccordionWidget.cpp.
References multiActive.
Referenced by handleClickedSignal().
|
private |
Definition at line 381 of file AccordionWidget.cpp.
References ContentPane::closeContentPane(), collapsible, contentPanes, ContentPane::getActive(), getActiveContentPaneIndex(), getMultiActive(), multiActive, and ContentPane::openContentPane().
Referenced by internalAddContentPane(), and internalInsertContentPane().
bool AccordionWidget::insertContentPane | ( | uint | index, |
ContentPane * | cpane | ||
) |
Insert content pane.
index | Index of the content pane |
cpane | Content Pane to insert |
This is an overloaded method of insertContentPane(uint, QString). Use this method when you already created a content pane that you want to insert.
Definition at line 88 of file AccordionWidget.cpp.
References internalInsertContentPane().
bool AccordionWidget::insertContentPane | ( | uint | index, |
QString | header | ||
) |
Insert content pane.
index | Index of the content pane |
header | Header of the content pane |
You can use this method to insert a new content pane at given index with header defining the Header. An empty content pane will be created that you can get with getContentPane().
Returns true if the insert was successfull.
Definition at line 78 of file AccordionWidget.cpp.
References internalInsertContentPane().
bool AccordionWidget::insertContentPane | ( | uint | index, |
QString | header, | ||
QFrame * | contentFrame | ||
) |
Insert content pane.
index | Index of the content pane |
header | Header of the content pane |
contentFrame | Content frame of the content pane |
This is an overloaded method of insertContentPane(uint, QString). Use this method when you already created a content frame that you want to insert.
Definition at line 83 of file AccordionWidget.cpp.
References internalInsertContentPane().
|
private |
Definition at line 229 of file AccordionWidget.cpp.
References ContentPane::clicked(), contentPanes, errorString, findContentPaneIndex(), handleClickedSignal(), numberOfContentPanes(), and numberOfContentPanesChanged().
Referenced by addContentPane().
|
private |
Definition at line 255 of file AccordionWidget.cpp.
References checkIndexError(), ContentPane::clicked(), contentPanes, findContentPaneIndex(), handleClickedSignal(), numberOfContentPanes(), and numberOfContentPanesChanged().
Referenced by insertContentPane().
|
private |
Definition at line 289 of file AccordionWidget.cpp.
References checkIndexError(), contentPanes, errorString, findContentPaneIndex(), RealSpace::Particles::name(), numberOfContentPanes(), and numberOfContentPanesChanged().
Referenced by removeContentPane().
bool AccordionWidget::moveContentPane | ( | uint | currentIndex, |
uint | newIndex | ||
) |
Move content pane.
currentIndex | The current index of the content pane. |
newIndex | The new index of the current pane |
Moves a content from currentIndex to newIndex. Returns true if the content pane was moved, false otherwise.
Definition at line 140 of file AccordionWidget.cpp.
References checkIndexError(), and contentPanes.
int AccordionWidget::numberOfContentPanes | ( | ) |
Returns the number of content panes.
Definition at line 58 of file AccordionWidget.cpp.
References contentPanes.
Referenced by checkIndexError(), internalAddContentPane(), internalInsertContentPane(), and internalRemoveContentPane().
|
signal |
Signals the new number of content panes.
number | Number of content panes |
Signal will be emitted if the number of content panes changes
Referenced by AccordionWidget(), internalAddContentPane(), internalInsertContentPane(), and internalRemoveContentPane().
|
privateslot |
Definition at line 417 of file AccordionWidget.cpp.
References collapsible, and contentPanes.
Referenced by AccordionWidget().
|
protected |
paintEvent Reimplement paintEvent to use stylesheets in derived Widgets
event |
Definition at line 426 of file AccordionWidget.cpp.
bool AccordionWidget::removeContentPane | ( | bool | deleteObject, |
ContentPane * | contentPane | ||
) |
Remove a content pane.
deleteObject | Delete the object and free memory |
contentPane | The content pane to remove |
This is an overloaded method of removeContentPane(bool, uint).
Definition at line 135 of file AccordionWidget.cpp.
References internalRemoveContentPane().
bool AccordionWidget::removeContentPane | ( | bool | deleteObject, |
QFrame * | contentframe | ||
) |
Remove a content pane.
deleteObject | Delete the object and free memory |
contentframe | Content frame of the content pane |
This is an overloaded method of removeContentPane(bool, uint).
Definition at line 130 of file AccordionWidget.cpp.
References internalRemoveContentPane().
bool AccordionWidget::removeContentPane | ( | bool | deleteObject, |
QString | header | ||
) |
Remove a content pane.
deleteObject | Delete the object and free memory |
header | Header of the content pane |
This is an overloaded method of removeContentPane(bool, uint).
Definition at line 125 of file AccordionWidget.cpp.
References internalRemoveContentPane().
bool AccordionWidget::removeContentPane | ( | bool | deleteObject, |
uint | index | ||
) |
Remove a content pane.
deleteObject | Delete the object and free memory |
index | Index of the content pane |
Remove a content pane at index. If deleteObject is true the object will be deleted. Otherwise it is up to the user to free the allocated memory.
Returns true if the pane was removed and false otherwise.
Definition at line 120 of file AccordionWidget.cpp.
References internalRemoveContentPane().
void AccordionWidget::setCollapsible | ( | bool | status | ) |
If collapsible is true you can close all ContentPanes.
status |
With the collapsible option you can control if one content pane has to be open and can't be closed.
Definition at line 214 of file AccordionWidget.cpp.
References collapsible.
void AccordionWidget::setMultiActive | ( | bool | status | ) |
Allow multiple ContentPane to be open.
status |
This option allows you to open several ContentPane at the same time.
Definition at line 204 of file AccordionWidget.cpp.
References multiActive.
Referenced by TestView::test_AccordionWidget().
bool AccordionWidget::swapContentPane | ( | uint | index, |
ContentPane * | cpane | ||
) |
Swap the content pane.
index | Index of the content pane to swap |
cpane | New content pane |
With this method you can replace an existing content pane at index with a new one cpane.
Returns true if the swap was successfull.
The old content pane will be deleted.
Definition at line 93 of file AccordionWidget.cpp.
References checkIndexError(), contentPanes, errorString, and findContentPaneIndex().
|
private |
Definition at line 357 of file AccordionWidget.h.
Referenced by AccordionWidget(), getCollapsible(), handleClickedSignal(), numberOfPanesChanged(), and setCollapsible().
|
private |
Definition at line 350 of file AccordionWidget.h.
Referenced by findContentPaneIndex(), getActiveContentPaneIndex(), getContentPane(), handleClickedSignal(), internalAddContentPane(), internalInsertContentPane(), internalRemoveContentPane(), moveContentPane(), numberOfContentPanes(), numberOfPanesChanged(), and swapContentPane().
|
private |
Definition at line 354 of file AccordionWidget.h.
Referenced by checkIndexError(), getContentPane(), getError(), internalAddContentPane(), internalRemoveContentPane(), and swapContentPane().
|
private |
Definition at line 356 of file AccordionWidget.h.
Referenced by AccordionWidget(), getMultiActive(), handleClickedSignal(), and setMultiActive().
|
private |
Definition at line 352 of file AccordionWidget.h.
Referenced by AccordionWidget().