OpenWalnut
1.5.0dev
|
Special Button that can shrink and expand in a layout. More...
#include <WScaleToolButton.h>
Public Member Functions | |
WScaleToolButton (size_t length=WPREFERRED_LABEL_LENGTH, QWidget *parent=NULL) | |
Constructor. More... | |
WScaleToolButton (const QString &text, size_t length=WPREFERRED_LABEL_LENGTH, QWidget *parent=NULL) | |
Constructor. More... | |
virtual QSize | sizeHint () const |
overwritten from QToolButton, returning the widgets prefered size More... | |
virtual QSize | minimumSizeHint () const |
overwritten from QToolButton, returning the widgets prefered size More... | |
virtual void | setText (const QString &text) |
reimplemented function to setText More... | |
virtual void | addAdditionalWidth (int margin) |
Set this to reserve extra space for a margin. More... | |
virtual void | setMinimalLength (size_t chars) |
How many characters should be visible all the time? More... | |
virtual size_t | getMinimalLength () const |
Get the current minimal number of characters. More... | |
Protected Member Functions | |
virtual void | resizeEvent (QResizeEvent *event) |
custom implementation of the resize event to fit the QString into the butons current size More... | |
Private Member Functions | |
void | fitTextToSize () |
set the actual text which is shown on the QToolButton More... | |
Private Attributes | |
QString | m_orgText |
QString to remember the original unshortend text of the widget. More... | |
int | m_additionalWidth |
The additional width we need to reserver (like for margins). More... | |
size_t | m_minLength |
Minimal character number. More... | |
Special Button that can shrink and expand in a layout.
Definition at line 36 of file WScaleToolButton.h.
WScaleToolButton::WScaleToolButton | ( | size_t | length = WPREFERRED_LABEL_LENGTH , |
QWidget * | parent = NULL |
||
) |
Constructor.
parent | the widgets parent |
length | the minimal number of characters visible |
Definition at line 27 of file WScaleToolButton.cpp.
References m_additionalWidth, m_minLength, and m_orgText.
WScaleToolButton::WScaleToolButton | ( | const QString & | text, |
size_t | length = WPREFERRED_LABEL_LENGTH , |
||
QWidget * | parent = NULL |
||
) |
Constructor.
Creates the button with its original text
text | text of the button |
parent | the widgets parent |
length | the minimal number of characters |
Definition at line 36 of file WScaleToolButton.cpp.
References m_additionalWidth, m_minLength, m_orgText, and setText().
|
virtual |
Set this to reserve extra space for a margin.
This function does not set the margin. This is still your task, using stylesheets. You will not need this when using QToolButton::setMargin().
margin | the margin to keep in mind for size calculations |
Definition at line 90 of file WScaleToolButton.cpp.
References m_additionalWidth.
|
private |
set the actual text which is shown on the QToolButton
Definition at line 71 of file WScaleToolButton.cpp.
References m_orgText.
Referenced by resizeEvent(), and setText().
|
virtual |
Get the current minimal number of characters.
Definition at line 101 of file WScaleToolButton.cpp.
References m_minLength.
|
virtual |
overwritten from QToolButton, returning the widgets prefered size
Definition at line 58 of file WScaleToolButton.cpp.
References m_additionalWidth, m_minLength, and m_orgText.
|
protectedvirtual |
custom implementation of the resize event to fit the QString into the butons current size
event | resize event passed from the parent widgets event handling |
Definition at line 47 of file WScaleToolButton.cpp.
References fitTextToSize().
|
virtual |
How many characters should be visible all the time?
chars | the number of chars |
Definition at line 95 of file WScaleToolButton.cpp.
References m_minLength, m_orgText, and setText().
|
virtual |
reimplemented function to setText
text | text of the button |
Definition at line 64 of file WScaleToolButton.cpp.
References fitTextToSize(), m_additionalWidth, m_minLength, and m_orgText.
Referenced by WQtPropertyGroupWidget::createPropertyGroupBox(), setMinimalLength(), WPropertyTriggerWidget::WPropertyTriggerWidget(), and WScaleToolButton().
|
virtual |
overwritten from QToolButton, returning the widgets prefered size
Definition at line 52 of file WScaleToolButton.cpp.
References m_additionalWidth, and m_orgText.
|
private |
The additional width we need to reserver (like for margins).
Definition at line 121 of file WScaleToolButton.h.
Referenced by addAdditionalWidth(), minimumSizeHint(), setText(), sizeHint(), and WScaleToolButton().
|
private |
Minimal character number.
Definition at line 126 of file WScaleToolButton.h.
Referenced by getMinimalLength(), minimumSizeHint(), setMinimalLength(), setText(), and WScaleToolButton().
|
private |
QString to remember the original unshortend text of the widget.
Definition at line 116 of file WScaleToolButton.h.
Referenced by fitTextToSize(), minimumSizeHint(), setMinimalLength(), setText(), sizeHint(), and WScaleToolButton().