mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Do not create label if string is empty.
Do not create a text label if the returned string is empty. Also, fixed a potential crash after not creating a label and adding it to the list of created labels. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fcc17c717d
commit
7a07665d89
1 changed files with 4 additions and 1 deletions
|
@ -121,12 +121,15 @@ void DiveCartesianAxis::updateTicks()
|
|||
DiveTextItem *label = NULL;
|
||||
|
||||
if (showText){
|
||||
QString text = textForValue(currValue);
|
||||
if(text.isEmpty())
|
||||
continue; // Do not create or do anything with an empty string.
|
||||
label = new DiveTextItem(this);
|
||||
label->setText(textForValue(currValue));
|
||||
label->setBrush(QBrush(textColor));
|
||||
label->setBrush(colorForValue(currValue));
|
||||
labels.push_back(label);
|
||||
}
|
||||
labels.push_back(label);
|
||||
if (orientation == RightToLeft || orientation == LeftToRight) {
|
||||
if(showText){
|
||||
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
|
||||
|
|
Loading…
Add table
Reference in a new issue