Exemple #1
0
void KNumInput::layout(bool deep)
{
    int w1 = d->column1Width;
    int w2 = d->column2Width;

    // label sizeHint
    d->labelSize = (d->label ? d->label->sizeHint() : QSize(0, 0));

    if (d->label && (d->labelAlignment & Qt::AlignVCenter)) {
        d->column1Width = d->labelSize.width() + 4;
    } else {
        d->column1Width = 0;
    }

    // slider sizeHint
    d->sliderSize = (d->slider ? d->slider->sizeHint() : QSize(0, 0));

    doLayout();

    if (!deep) {
        d->column1Width = w1;
        d->column2Width = w2;
        return;
    }

    w2 = d->column2Width;

    KNumInput* p = d->previousNumInput;
    while (p) {
        p->doLayout();
        w1 = qMax(w1, p->d->column1Width);
        w2 = qMax(w2, p->d->column2Width);
        p = p->d->previousNumInput;
    }

    p = d->nextNumInput;
    while (p) {
        p->doLayout();
        w1 = qMax(w1, p->d->column1Width);
        w2 = qMax(w2, p->d->column2Width);
        p = p->d->nextNumInput;
    }

    p = this;
    while (p) {
        p->d->column1Width = w1;
        p->d->column2Width = w2;
        p = p->d->previousNumInput;
    }

    p = d->nextNumInput;
    while (p) {
        p->d->column1Width = w1;
        p->d->column2Width = w2;
        p = p->d->nextNumInput;
    }

//    kDebug() << "w1 " << w1 << " w2 " << w2;
}
Exemple #2
0
void KNumInput::layout(bool deep)
{
    int w1 = m_colw1;
    int w2 = m_colw2;

    // label sizeHint
    m_sizeLabel = (m_label ? m_label->sizeHint() : QSize(0,0));

    if(m_label && (m_alignment & AlignVCenter))
        m_colw1 = m_sizeLabel.width() + 4;
    else
        m_colw1 = 0;

    // slider sizeHint
    m_sizeSlider = (m_slider ? m_slider->sizeHint() : QSize(0, 0));

    doLayout();

    if(!deep) {
        m_colw1 = w1;
        m_colw2 = w2;
        return;
    }

    KNumInput* p = this;
    while(p) {
        p->doLayout();
        w1 = QMAX(w1, p->m_colw1);
        w2 = QMAX(w2, p->m_colw2);
        p = p->m_prev;
    }

    p = m_next;
    while(p) {
        p->doLayout();
        w1 = QMAX(w1, p->m_colw1);
        w2 = QMAX(w2, p->m_colw2);
        p = p->m_next;
    }

    p = this;
    while(p) {
        p->m_colw1 = w1;
        p->m_colw2 = w2;
        p = p->m_prev;
    }

    p = m_next;
    while(p) {
        p->m_colw1 = w1;
        p->m_colw2 = w2;
        p = p->m_next;
    }

//    kdDebug() << "w1 " << w1 << " w2 " << w2 << endl;
}