Exemplo n.º 1
0
/** No descriptions */
void SliderSpin::slotValueChanged(int value)
{
  mpSpinBox->blockSignals(true);
  mpSpinBox->setValue(value);
  mpSpinBox->blockSignals(false);
  emit signalValueChanged(value);
}
Exemplo n.º 2
0
void KexiDBImageBox::handlePasteAction()
{
    if (isReadOnly() || (!designMode() && !hasFocus()))
        return;
    QPixmap pm(qApp->clipboard()->pixmap(QClipboard::Clipboard));
    if (dataSource().isEmpty()) {
        //static mode
        KexiBLOBBuffer::Handle h = KexiBLOBBuffer::self()->insertPixmap(pm);
        if (!h)
            return;
        setData(h);
    } else {
        //db-aware mode
        m_pixmap = pm;
        QByteArray ba;
        QBuffer buffer(&ba);
        buffer.open(IO_WriteOnly);
        if (m_pixmap.save(&buffer, "PNG")) {  // write pixmap into ba in PNG format
            setValueInternal(ba, true, false/* !loadPixmap */);
            m_currentScaledPixmap = QPixmap(); // clear cache
        } else {
            setValueInternal(QByteArray(), true);
        }
    }

    repaint();
    if (!dataSource().isEmpty()) {
//  emit pixmapChanged();
        signalValueChanged();
    }
}
Exemplo n.º 3
0
void KexiBoolTableEdit::clickedOnContents()
{
    const QVariant oldValue = m_currentValue;
    if (field()->isNotNull())
        m_currentValue = QVariant(!m_currentValue.toBool());
    else {
        // null allowed: use the cycle: true -> false -> null
        if (m_currentValue.isNull())
            m_currentValue = QVariant(true);
        else
            m_currentValue = m_currentValue.toBool() ? QVariant(false) : QVariant();
    }
    kDebug() << KexiDataItemInterface::originalValue() << m_currentValue;
    if (oldValue != m_currentValue) {
        signalValueChanged();
    }
}
Exemplo n.º 4
0
void KexiDBImageBox::handleInsertFromFileAction(const KUrl& url)
{
    if (!dataSource().isEmpty() && isReadOnly())
        return;

    if (dataSource().isEmpty()) {
        //static mode
        KexiBLOBBuffer::Handle h = KexiBLOBBuffer::self()->insertPixmap(url);
        if (!h)
            return;
        setData(h);
        repaint();
    } else {
        //db-aware
        QString fileName(url.isLocalFile() ? url.toLocalFile() : url.prettyUrl());

        //! @todo download the file if remote, then set fileName properly
        QFile f(fileName);
        if (!f.open(IO_ReadOnly)) {
            //! @todo err msg
            return;
        }
        QByteArray ba = f.readAll();
        if (f.error() != QFile::NoError) {
            //! @todo err msg
            f.close();
            return;
        }
        m_valueMimeType = KMimeType::findByUrl(fileName, 0, url.isLocalFile())->name();
        setValueInternal(ba, true);
    }

//! @todo emit signal for setting "dirty" flag within the design
    if (!dataSource().isEmpty()) {
        signalValueChanged();
    }
}
Exemplo n.º 5
0
void KexiDBImageBox::clear()
{
    if (dataSource().isEmpty()) {
        //static mode
        setData(KexiBLOBBuffer::Handle());
    } else {
        if (isReadOnly())
            return;
        //db-aware mode
        setValueInternal(QByteArray(), true);
        //m_pixmap = QPixmap();
    }

// m_originalFileName.clear();

    //! @todo emit signal for setting "dirty" flag within the design

// m_pixmap = QPixmap(); //will be loaded on demand
    repaint();
    if (!dataSource().isEmpty()) {
//  emit pixmapChanged();//valueChanged(data());
        signalValueChanged();
    }
}
Exemplo n.º 6
0
void KexiDBDatePicker::slotValueChanged()
{
    signalValueChanged();
}
Exemplo n.º 7
0
void KexiDBCheckBox::slotStateChanged(int)
{
    signalValueChanged();
}
Exemplo n.º 8
0
void MapBrowserWidget::slotMapChanged()
{
    if(!m_slotMapChanged_enabled)
        return;
    signalValueChanged();
}