OpenWalnut
1.5.0dev
|
Special Label that can shrink and expand in a layout. More...
#include <WScaleLabel.h>
Public Member Functions | |
WScaleLabel (size_t length=WPREFERRED_LABEL_LENGTH, QWidget *parent=NULL) | |
Constructor. More... | |
WScaleLabel (const QString &text, size_t length=WPREFERRED_LABEL_LENGTH, QWidget *parent=NULL) | |
Constructor. More... | |
WScaleLabel (QWidget *parent) | |
Constructor. More... | |
WScaleLabel (const QString &text, QWidget *parent) | |
Constructor. More... | |
virtual QSize | sizeHint () const |
overwritten from QLabel, returning the widgets prefered size More... | |
virtual QSize | minimumSizeHint () const |
overwritten from QLabel, 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... | |
virtual size_t | calculateSize (size_t chars) const |
Calculate the size that is needed for the given number of chars. More... | |
Protected Member Functions | |
virtual void | resizeEvent (QResizeEvent *event) |
custom implementation of the resize event to fit the QString into the labels current size More... | |
Private Member Functions | |
void | construct () |
Deferred construction. More... | |
void | fitTextToSize () |
set the actual text which is shown on the QLabel 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 Label that can shrink and expand in a layout.
Definition at line 36 of file WScaleLabel.h.
WScaleLabel::WScaleLabel | ( | size_t | length = WPREFERRED_LABEL_LENGTH , |
QWidget * | parent = NULL |
||
) |
Constructor.
parent | the widgets parent |
length | the minimal number of characters visible. |
Definition at line 31 of file WScaleLabel.cpp.
References construct().
WScaleLabel::WScaleLabel | ( | const QString & | text, |
size_t | length = WPREFERRED_LABEL_LENGTH , |
||
QWidget * | parent = NULL |
||
) |
Constructor.
Creates the label with its original text
text | text of the label |
parent | the widgets parent |
length | the minimal number of characters visible. |
Definition at line 39 of file WScaleLabel.cpp.
References construct().
|
explicit |
Constructor.
parent | the widgets parent |
Definition at line 48 of file WScaleLabel.cpp.
References construct().
WScaleLabel::WScaleLabel | ( | const QString & | text, |
QWidget * | parent | ||
) |
Constructor.
Creates the label with its original text
text | text of the label |
parent | the widgets parent |
Definition at line 56 of file WScaleLabel.cpp.
References construct().
|
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 QLabel::setMargin().
margin | the margin to keep in mind for size calculations |
Definition at line 106 of file WScaleLabel.cpp.
References m_additionalWidth.
Referenced by WPropertyWidget::WPropertyWidget().
|
virtual |
Calculate the size that is needed for the given number of chars.
chars | number of chars |
Definition at line 88 of file WScaleLabel.cpp.
References m_additionalWidth, and m_orgText.
Referenced by minimumSizeHint(), sizeHint(), and WQtDockTitleWidget::updateLayouts().
|
private |
Deferred construction.
Definition at line 65 of file WScaleLabel.cpp.
References m_additionalWidth, m_minLength, and m_orgText.
Referenced by WScaleLabel().
|
private |
set the actual text which is shown on the QLabel
Definition at line 100 of file WScaleLabel.cpp.
References m_orgText.
Referenced by resizeEvent(), and setText().
|
virtual |
Get the current minimal number of characters.
Definition at line 117 of file WScaleLabel.cpp.
References m_minLength.
|
virtual |
overwritten from QLabel, returning the widgets prefered size
Definition at line 83 of file WScaleLabel.cpp.
References calculateSize(), and m_minLength.
|
protectedvirtual |
custom implementation of the resize event to fit the QString into the labels current size
event | resize event passed from the parent widgets event handling |
Definition at line 73 of file WScaleLabel.cpp.
References fitTextToSize().
|
virtual |
How many characters should be visible all the time?
chars | the number of chars |
Definition at line 111 of file WScaleLabel.cpp.
References m_minLength, m_orgText, and setText().
|
virtual |
reimplemented function to setText
text | text of the label |
Definition at line 93 of file WScaleLabel.cpp.
References fitTextToSize(), m_additionalWidth, m_minLength, and m_orgText.
Referenced by WQtDataModuleInput::onInputChangeGUI(), WPropertyColorWidget::setColor(), setMinimalLength(), WPropertyBoolWidget::update(), WPropertyDoubleWidget::update(), WPropertyFilenameWidget::update(), WPropertyIntervalWidget::update(), WPropertyIntWidget::update(), WPropertyMatrix4X4Widget::update(), WPropertyPositionWidget::update(), WPropertyStringWidget::update(), WPropertyTriggerWidget::update(), WPropertyWidget::WPropertyWidget(), WQtDataModuleInput::WQtDataModuleInput(), and WQtMessagePopup::WQtMessagePopup().
|
virtual |
overwritten from QLabel, returning the widgets prefered size
Definition at line 78 of file WScaleLabel.cpp.
References calculateSize(), and m_orgText.
|
private |
The additional width we need to reserver (like for margins).
Definition at line 150 of file WScaleLabel.h.
Referenced by addAdditionalWidth(), calculateSize(), construct(), and setText().
|
private |
Minimal character number.
Definition at line 155 of file WScaleLabel.h.
Referenced by construct(), getMinimalLength(), minimumSizeHint(), setMinimalLength(), and setText().
|
private |
QString to remember the original unshortend text of the widget.
Definition at line 145 of file WScaleLabel.h.
Referenced by calculateSize(), construct(), fitTextToSize(), setMinimalLength(), setText(), and sizeHint().