BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Content Pane class. More...
Public Slots | |
void | headerClicked () |
Slot that is called when the header has been triggered. More... | |
Signals | |
void | clicked () |
Clicked signal is emitted when the header is clicked. More... | |
void | isActive () |
Signal will be emitted after the open animation finished. More... | |
void | isInactive () |
Signal will be emitted after the close animation finished. More... | |
Public Member Functions | |
ContentPane (QString header, QFrame *content, QWidget *parent=0) | |
ContentPane constructor. More... | |
ContentPane (QString header, QWidget *parent=0) | |
ContentPane constructor. More... | |
bool | getActive () |
Check if this Content pane is active. More... | |
uint | getAnimationDuration () |
Get the duration of the open, close animation. More... | |
int | getContainerFrameStyle () |
Get the container frame style. More... | |
QFrame * | getContentFrame () |
Get the content frame of the content pane. More... | |
QString | getHeader () |
Return the header of the content pane. More... | |
int | getHeaderFrameStyle () |
Get the header frame style. More... | |
QString | getHeaderHoverStylesheet () |
Get the mouse over header style sheet. More... | |
QString | getHeaderStylesheet () |
Get the current header style sheet. More... | |
QString | getHeaderTooltip () |
Get the header tooltip. More... | |
int | getMaximumHeight () |
Get the maximum height of the content pane container frame. More... | |
void | setAnimationDuration (uint duration) |
Set the duration for the open and close animation. More... | |
void | setContainerFrameStyle (int style) |
Set the container frame style. More... | |
void | setContentFrame (QFrame *content) |
Set the content frame. More... | |
void | setHeader (QString header) |
Set the header of the content pane. More... | |
void | setHeaderFrameStyle (int style) |
Set the header frame style. More... | |
void | setHeaderHoverStylesheet (QString stylesheet) |
Set a stylesheet for the header frame when the mouse hovers over it. More... | |
void | setHeaderStylesheet (QString stylesheet) |
Set a stylesheet for the header frame. More... | |
void | setHeaderTooltip (QString tooltip) |
Set header tooltip. More... | |
void | setMaximumHeight (int maxHeight) |
Set the maximum height of the content pane container. More... | |
Protected Member Functions | |
void | paintEvent (ATTR_UNUSED QPaintEvent *event) |
paintEvent Reimplement paintEvent to use stylesheets in derived Widgets More... | |
Private Slots | |
void | closeContentPane () |
Close the content pane. More... | |
void | openContentPane () |
Open the content pane. More... | |
Private Member Functions | |
void | initAnimations () |
void | initContainerContentFrame () |
void | initDefaults (QString header) |
void | initHeaderFrame (QString header) |
Private Attributes | |
bool | active |
std::unique_ptr< QPropertyAnimation > | closeAnimation |
QFrame * | container |
int | containerAnimationMaxHeight |
QFrame * | content |
int | contentPaneFrameStyle |
ClickableFrame * | header |
int | headerFrameStyle |
std::unique_ptr< QPropertyAnimation > | openAnimation |
Friends | |
class | AccordionWidget |
Content Pane class.
Content Panes are part of a QAccordion object. They represent a clickable Header and can be expanded or retracted.
When a ContentPane is created you have to provide a Header (ContentPane(QString, QWidget*)) and, if you want, a QFrame* (ContentPane(QString, QFrame*, QWidget*)) with the content that should be displayed when the ContentPane is expanded.
Managing the content is pretty straight forward use getContentFrame() and setContentFrame() to manage the content. You are absolutely free to do anything what you like with this QFrame. Just keep in mind there is a maximumHeight for the container in which the content frame is placed (currently 150). If your content exceeds this height you have to either increase it with setMaximumHeight() or add a QScrollArea to the content frame. You may use setContainerFrameStyle() to change the frame style of the container.
The Header can be changed after the creation of the ContentPane with setHeader(). Additionally you can set a tooltip, a standard stylesheet and a mouseover stylesheet, and the frame style.
The animation speed is influenceable setAnimationDuration().
Definition at line 75 of file ContentPane.h.
|
explicit |
ContentPane constructor.
header | The Header of the content pane |
parent | Parent widget or 0 |
Definition at line 35 of file ContentPane.cpp.
References content, header, and initDefaults().
|
explicit |
ContentPane constructor.
header | The Header of the content pane |
content | Content to display when expanded |
parent | Parent widget or 0 |
Definition at line 42 of file ContentPane.cpp.
References header, and initDefaults().
|
signal |
Clicked signal is emitted when the header is clicked.
Referenced by headerClicked(), AccordionWidget::internalAddContentPane(), and AccordionWidget::internalInsertContentPane().
|
privateslot |
Close the content pane.
This will close the content pane if it is currently open.
Definition at line 151 of file ContentPane.cpp.
References active, ClickableFrame_constants::CARRET_ICON_CLOSED, closeAnimation, getActive(), header, and ClickableFrame::setCaretPixmap().
Referenced by AccordionWidget::handleClickedSignal().
bool ContentPane::getActive | ( | ) |
Check if this Content pane is active.
Definition at line 48 of file ContentPane.cpp.
References active.
Referenced by closeContentPane(), AccordionWidget::handleClickedSignal(), openContentPane(), and setMaximumHeight().
uint ContentPane::getAnimationDuration | ( | ) |
Get the duration of the open, close animation.
int ContentPane::getContainerFrameStyle | ( | ) |
Get the container frame style.
Definition at line 137 of file ContentPane.cpp.
References container.
QFrame * ContentPane::getContentFrame | ( | ) |
Get the content frame of the content pane.
Use this method to get a pointer to a QFrame where you can place your content. The widget lifetime is managed by qAccordion.
Definition at line 53 of file ContentPane.cpp.
References content.
Referenced by MaskEditorPropertyPanel::setup_MaskProperties(), MaskEditorPropertyPanel::setup_MaskStack(), MaskEditorPropertyPanel::setup_PlotProperties(), and TestView::test_AccordionWidget().
QString ContentPane::getHeader | ( | ) |
Return the header of the content pane.
Definition at line 87 of file ContentPane.cpp.
References ClickableFrame::getHeader(), and header.
int ContentPane::getHeaderFrameStyle | ( | ) |
Get the header frame style.
Definition at line 127 of file ContentPane.cpp.
References header.
QString ContentPane::getHeaderHoverStylesheet | ( | ) |
Get the mouse over header style sheet.
Returns the mouse over header style sheet.
Definition at line 117 of file ContentPane.cpp.
References ClickableFrame::getHoverStylesheet(), and header.
QString ContentPane::getHeaderStylesheet | ( | ) |
Get the current header style sheet.
Get the css of the content pane header as QString.
Definition at line 107 of file ContentPane.cpp.
References ClickableFrame::getNormalStylesheet(), and header.
QString ContentPane::getHeaderTooltip | ( | ) |
Get the header tooltip.
Get the header tooltip as QString.
Definition at line 97 of file ContentPane.cpp.
References header.
int ContentPane::getMaximumHeight | ( | ) |
Get the maximum height of the content pane container frame.
Definition at line 67 of file ContentPane.cpp.
References container.
|
slot |
Slot that is called when the header has been triggered.
pos | Currently unused |
This slot is used to notify the ContentPane widget that the header has been triggered. You can use this slot yourself to open or close the ContentPane. Check the state of the pane before with getActive() as this slot might not do what you intended to do (for example you want to close the ContentPane. If it is already inactive and you call this slot without checking the state it will be opened).
Definition at line 230 of file ContentPane.cpp.
References clicked().
Referenced by MaskEditorPropertyPanel::MaskEditorPropertyPanel(), and initHeaderFrame().
|
private |
Definition at line 207 of file ContentPane.cpp.
References closeAnimation, container, containerAnimationMaxHeight, and openAnimation.
Referenced by initDefaults().
|
private |
Definition at line 189 of file ContentPane.cpp.
References container, content, and contentPaneFrameStyle.
Referenced by initDefaults().
|
private |
Definition at line 160 of file ContentPane.cpp.
References active, containerAnimationMaxHeight, contentPaneFrameStyle, header, headerFrameStyle, initAnimations(), initContainerContentFrame(), and initHeaderFrame().
Referenced by ContentPane().
|
private |
Definition at line 180 of file ContentPane.cpp.
References header, headerClicked(), headerFrameStyle, and ClickableFrame::singleClick().
Referenced by initDefaults().
|
signal |
Signal will be emitted after the open animation finished.
|
signal |
Signal will be emitted after the close animation finished.
|
privateslot |
Open the content pane.
This will open the content pane if it is currently closed.
Definition at line 142 of file ContentPane.cpp.
References active, ClickableFrame_constants::CARRET_ICON_OPENED, getActive(), header, openAnimation, and ClickableFrame::setCaretPixmap().
Referenced by AccordionWidget::handleClickedSignal().
|
protected |
paintEvent Reimplement paintEvent to use stylesheets in derived Widgets
event |
Definition at line 235 of file ContentPane.cpp.
void ContentPane::setAnimationDuration | ( | uint | duration | ) |
Set the duration for the open and close animation.
duration | Duration in milliseconds |
Set the duration of the QPropertyAnimation in milliseconds.
void ContentPane::setContainerFrameStyle | ( | int | style | ) |
Set the container frame style.
style |
Definition at line 132 of file ContentPane.cpp.
References container.
Referenced by MaskEditorPropertyPanel::setup_MaskProperties(), MaskEditorPropertyPanel::setup_MaskStack(), and MaskEditorPropertyPanel::setup_PlotProperties().
void ContentPane::setContentFrame | ( | QFrame * | content | ) |
Set the content frame.
content | QFrame* with your content |
Set / change the content frame of this content pane with content. The lifecycle
Definition at line 58 of file ContentPane.cpp.
void ContentPane::setHeader | ( | QString | header | ) |
Set the header of the content pane.
header |
Definition at line 82 of file ContentPane.cpp.
References header.
void ContentPane::setHeaderFrameStyle | ( | int | style | ) |
Set the header frame style.
style |
The style is the bitwise OR between a frame shape and a frame shadow style. See the Qt Documentation for additional details.
Definition at line 122 of file ContentPane.cpp.
References header.
void ContentPane::setHeaderHoverStylesheet | ( | QString | stylesheet | ) |
Set a stylesheet for the header frame when the mouse hovers over it.
stylesheet | CSS Style Sheet as string |
Set a stylesheet for the header for a special effect when the mouse hovers over it.
Definition at line 112 of file ContentPane.cpp.
References header, and ClickableFrame::setHoverStylesheet().
void ContentPane::setHeaderStylesheet | ( | QString | stylesheet | ) |
Set a stylesheet for the header frame.
stylesheet | CSS Style Sheet as string |
You can use Cascading Style Sheets as supported by Qt to style the header. This is the standard style sheet. You may also set a style for mouse over with setHeaderHoverStylesheet().
Definition at line 102 of file ContentPane.cpp.
References header, and ClickableFrame::setNormalStylesheet().
void ContentPane::setHeaderTooltip | ( | QString | tooltip | ) |
Set header tooltip.
tooltip | String to show as tooltip |
Set a string as header tooltip that will be shown when the mouse hovers over the header area.
Definition at line 92 of file ContentPane.cpp.
References header.
Referenced by MaskEditorPropertyPanel::setup_MaskProperties(), MaskEditorPropertyPanel::setup_MaskStack(), and MaskEditorPropertyPanel::setup_PlotProperties().
void ContentPane::setMaximumHeight | ( | int | maxHeight | ) |
Set the maximum height of the content pane container.
maxHeight |
Every content pane has a container frame that defines the visible maximum height. With this function you can change this setting.
Definition at line 72 of file ContentPane.cpp.
References closeAnimation, container, containerAnimationMaxHeight, getActive(), and openAnimation.
Referenced by MaskEditorPropertyPanel::setup_MaskProperties(), MaskEditorPropertyPanel::setup_MaskStack(), MaskEditorPropertyPanel::setup_PlotProperties(), and TestView::test_AccordionWidget().
|
friend |
Definition at line 281 of file ContentPane.h.
|
private |
Definition at line 291 of file ContentPane.h.
Referenced by closeContentPane(), getActive(), initDefaults(), and openContentPane().
|
private |
Definition at line 294 of file ContentPane.h.
Referenced by closeContentPane(), initAnimations(), and setMaximumHeight().
|
private |
Definition at line 285 of file ContentPane.h.
Referenced by getContainerFrameStyle(), getMaximumHeight(), initAnimations(), initContainerContentFrame(), setContainerFrameStyle(), setContentFrame(), and setMaximumHeight().
|
private |
Definition at line 289 of file ContentPane.h.
Referenced by initAnimations(), initDefaults(), and setMaximumHeight().
|
private |
Definition at line 283 of file ContentPane.h.
Referenced by ContentPane(), getContentFrame(), initContainerContentFrame(), and setContentFrame().
|
private |
Definition at line 288 of file ContentPane.h.
Referenced by initContainerContentFrame(), and initDefaults().
|
private |
Definition at line 284 of file ContentPane.h.
Referenced by ContentPane(), closeContentPane(), getHeader(), getHeaderFrameStyle(), getHeaderHoverStylesheet(), getHeaderStylesheet(), getHeaderTooltip(), initDefaults(), initHeaderFrame(), openContentPane(), setHeader(), setHeaderFrameStyle(), setHeaderHoverStylesheet(), setHeaderStylesheet(), and setHeaderTooltip().
|
private |
Definition at line 287 of file ContentPane.h.
Referenced by initDefaults(), and initHeaderFrame().
|
private |
Definition at line 293 of file ContentPane.h.
Referenced by initAnimations(), openContentPane(), and setMaximumHeight().