All pastes #914221 Raw Edit

Stuff

public text v1 · immutable
·published 2008-02-22 18:43 UTC
rendered paste body
Relevent debug output:

plasma(25000) AbstractTaskItem::setText: settings text to:  "#ubuntu-us-ny - Ko?"  which is:  19  characters long
plasma(25000) AbstractTaskItem::setText: Setting minimum size to:  QSizeF(37, 19)
plasma(25000) AbstractTaskItem::setText: Size is now:  QSizeF(211.467, 30)
plasma(25000) AbstractTaskItem::setText: settings text to:  "#kde-cafe - Konver?"  which is:  19  characters long
plasma(25000) AbstractTaskItem::setText: Setting minimum size to:  QSizeF(37, 19)
plasma(25000) AbstractTaskItem::setText: Size is now:  QSizeF(235.25, 30)
plasma(25000) AbstractTaskItem::setText: settings text to:  "Ubuntu IRC - Konve?"  which is:  19  characters long
plasma(25000) AbstractTaskItem::setText: Setting minimum size to:  QSizeF(35, 19)
plasma(25000) AbstractTaskItem::setText: Size is now:  QSizeF(256.231, 30)
plasma(25000) AbstractTaskItem::setText: settings text to:  "#kubuntu - Konver?"  which is:  18  characters long
plasma(25000) AbstractTaskItem::setText: Setting minimum size to:  QSizeF(37, 19)
plasma(25000) AbstractTaskItem::setText: Size is now:  QSizeF(275.032, 30)
plasma(25000) AbstractTaskItem::setText: settings text to:  "#amarok.dev - Kon?"  which is:  18  characters long
plasma(25000) AbstractTaskItem::setText: Setting minimum size to:  QSizeF(37, 19)
plasma(25000) AbstractTaskItem::setText: Size is now:  QSizeF(292.071, 30)


Relevant Functions:

void WindowTaskItem::setText(const QString &text)
{
    QFontMetrics fm(KGlobalSettings::taskbarFont());
    TaskGroupItem *parent = dynamic_cast<TaskGroupItem*>(parentLayoutItem());
    Q_ASSERT(parent);
//     kDebug() << "Task Group Size: " << parent->size().width();
    QString shownText = fm.elidedText(text, Qt::ElideRight, parent->size().width() / qBound(1,parent->tasks().count(),1000));
    AbstractTaskItem::setText(shownText);
}


void AbstractTaskItem::setText(const QString &text)
{
    if (_text == text) {
        return;
    }
    kDebug() << "settings text to: " << text << " which is: " << text.length() << " characters long";

    _text = text;

    //let some place for at least the icon and the first character
    QFontMetrics fm(KGlobalSettings::taskbarFont());
    QSizeF minSize = QSizeF(fm.height() + fm.charWidth(text,0) + IconTextSpacing + 2, fm.height());
    kDebug() << "Setting minimum size to: " << minSize;
    setMinimumSize(minSize);

    TaskGroupItem *group = qobject_cast<TaskGroupItem*>(parent());
    if (group) {
        group->queueGeometryUpdate();
    } else {
        updateGeometry();
    }
    kDebug() << "Size is now: " << size();
}