PDA

View Full Version : Does not work margin setting for title, class QwtTextLabel



atrofimov
9th July 2015, 18:48
The default value is 0.
For example change the value to 6 by call
QwtPlot::titleLabel()->setMargin(6)
there is such an effect (see screenshot)

Uwe
12th July 2015, 18:06
Indeed the margin is ignored in QwtPlotLayout leading to this effect. I would even say, that the whole QwtTextLabel::setMargin method is somehow obsolete as we have QWidget::setContentsMargins() since Qt4. But this is just a side note as using the contents margins is broken as well.

I added the following bug reports:

- https://sourceforge.net/p/qwt/bugs/243
- https://sourceforge.net/p/qwt/bugs/242

Uwe

atrofimov
13th July 2015, 11:03
Uwe,

This is a bug in the qt?
I tried to set the margin for the QLabel in the Qt Designer, it works.

Maybe the following functions are not implemented correctly?

class QwtTextLabel:
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
virtual int heightForWidth( int ) const;

Uwe
13th July 2015, 11:33
This is a bug in the qt?
No this is a Qwt bug - that's why it has been added to the Qwt bug tracker.

Uwe

atrofimov
13th July 2015, 13:24
It may be necessary to add functions
void QwtPlot::setTitleLabel(QwtTextLabel *label)
void QwtPlot::setFooterLabel(QwtTextLabel *label)
???

To create a class based on QwtTextLabel.