source/MainGUI.cpp
/**
 * The slot which is emitted after the text of the titleLabel has changed.
 * Used to resize the text to fit into the label.
 */
The slot which is emitted after the text of the titleLabel has changed.
Used to resize the text to fit into the label.
The slot which is emitted after the text of the titleLabel has changed . Used to resize the text to fit into the label .
void MainGUI::onTitleLabelTextChanged ()
{
    QString text = widget.titleLabel->text();
    QFont font = widget.titleLabel->font();
    font.setPointSize(12);
    QFontMetrics *fm = new QFontMetrics(font);
    int width = widget.titleLabel->width();
    while (fm->boundingRect(text).width() >= width)
    {
        font.setPointSize(font.pointSize() - 1);
        fm = new QFontMetrics(font);
    }
    widget.titleLabel->setFont(font);
}
void MainGUI :: onTitleLabelTextChanged ( ) { QString text = widget . titleLabel -> text ( ) ; QFont font = widget . titleLabel -> font ( ) ; font . setPointSize ( 12 ) ; QFontMetrics * fm = new QFontMetrics ( font ) ; int width = widget . titleLabel -> width ( ) ; while ( fm -> boundingRect ( text ) . width ( ) >= width ) { font . setPointSize ( font . pointSize ( ) - 1 ) ; fm = new QFontMetrics ( font ) ; } widget . titleLabel -> setFont ( font ) ; }
The slot which is emitted after the text of the titleLabel has changed.
The slot which is emitted after the text of the titleLabel has changed .