I'm trying to get my hands dirty on some Rosegarden code and have been
looking at a minor issue in the TimeWidget. Specifically, the
Millisecond spinbox doesn't handle keyboard input correctly -- if I
type in "451", I get "340" in the text box; if I type "650, I get
"539". None of the other spinbox widgets have this behavior, and I'm
not sure why this one is doing it. The only thing I can think of is
that it's tied to a realtime calculation and it's getting adjusted
inaccurately.

Here's the relevant code in TimeWidget.cpp:

--- init code --

label = new QLabel(tr("msec:"));
    label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    layout->addWidget(label, 2, 2);

    if (editable) {
        m_msecLabel = 0;
        m_msec = new QSpinBox;
        m_msec->setMinimum(0);
        m_msec->setSingleStep(10);
        connect(m_msec, SIGNAL(valueChanged(int)),
                this, SLOT(slotSecOrMSecChanged(int)));
        layout->addWidget(m_msec, 2, 3);
    } else {
        m_msec = 0;
        m_msecLabel = new LineEdit;
        m_msecLabel->setReadOnly(true);
        layout->addWidget(m_msecLabel, 2, 3);
    }

-- slotSecOrMSecChanged --

void
TimeWidget::slotSecOrMSecChanged(int)
{
    int sec = m_sec->value();
    int msec = m_msec->value();

    slotSetRealTime(RealTime(sec, msec * 1000000));
}

-- populate --

 if (m_msec) {
            m_msec->setMinimum(0);
            m_msec->setMaximum(999);
            m_msec->setValue(rt.msec());
        } else {
            m_msecLabel->setText(QString("%1").arg(rt.msec()));
        }


-- 
Brett W. McCoy -- http://www.electricminstrel.com
------------------------------------------------------------------------
"In the rhythm of music a secret is hidden; If I were to divulge it,
it would overturn the world."
    -- Jelaleddin Rumi

------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to