コード例 #1
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();
    }
}
コード例 #2
0
void LightFader::setSliderValue(int newValue)
{
    ui.faderStrength->setText(QString::number(newValue) + "%");

    int value = static_cast<int>(round(static_cast<double>(newValue) * 2.55));

    switch (m_operatingMode)
    {
        case SINGLE_CHANNEL:
            setValueInternal(value, 0);
            break;
        case EUROLITE_PMD_8:
            setValueInternal(value, 1);
            break;
    }
}
コード例 #3
0
void KexiBlobTableEdit::clear()
{
    setValueInternal(QByteArray(), true);
    signalEditRequested();
    //emit acceptRequested();
    repaintRelatedCell();
}
コード例 #4
0
void KexiBlobTableEdit::handleInsertFromFileAction(const KUrl& url)
{
    if (isReadOnly())
        return;

    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;
    }
    f.close();
// m_valueMimeType = KImageIO::mimeType( fileName );
    setValueInternal(ba, true);
    signalEditRequested();
    //emit acceptRequested();
}
コード例 #5
0
void KexiBlobTableEdit::handlePasteAction()
{
    if (isReadOnly())
        return;
    QPixmap pm(qApp->clipboard()->pixmap(QClipboard::Clipboard));
    QByteArray ba;
    QBuffer buffer(&ba);
    buffer.open(QIODevice::WriteOnly);
    if (pm.save(&buffer, "PNG")) {  // write pixmap into ba in PNG format
        setValueInternal(ba, true);
    } else {
        setValueInternal(QByteArray(), true);
    }
    signalEditRequested();
    //emit acceptRequested();
    repaintRelatedCell();
}
コード例 #6
0
void KSimBaseIntSpinBox::stepDown()
{
	KSimBaseInt newValue(value());
	int res;
	newValue = newValue.value() - lineStep(); // Base is not changed!

	res = setValueInternal(newValue);
	KSimSpinBox::setValue(res);
}
コード例 #7
0
void Parameter::setValue(var _value, bool silentSet, bool force)
{

	if (!force && checkValueIsTheSame(_value, value)) return;
	lastValue = var(value);
	setValueInternal(_value);

	if (_value != defaultValue) isOverriden = true;

	if (!silentSet) notifyValueChanged();
}
コード例 #8
0
void LightFader::setValue(int value, int channel)
{
    if (channel == 0 && m_operatingMode == SINGLE_CHANNEL)
    {
        ui.slider->setValue(static_cast<int>(static_cast<double>(value) / 2.55));
        return;
    }
    else if (channel == 1 && m_operatingMode == EUROLITE_PMD_8)
    {
        ui.slider->setValue(static_cast<int>(static_cast<double>(value) / 2.55));
        return;
    }

    setValueInternal(value, channel);
}
コード例 #9
0
void KSimBaseIntSpinBox::setValue(const KSimBaseInt & newValue)
{
	KSimBaseInt myNew(newValue);
//	KSIMDEBUG(QString::fromLatin1(">>> KSimBaseIntSpinBox::setValue() this=%1 newValue=%2").arg((unsigned int)this,0, 16).arg(newValue.text()));
	if (myNew != value())
	{
		int res = setValueInternal(myNew);
		KSimSpinBox::setValue(res);
	}
	else
	{
//		KSIMDEBUG("skipped");
	}
//	KSIMDEBUG("<<< KSimBaseIntSpinBox::setValue()");
}
コード例 #10
0
void KexiDataItemInterface::setValue(const QVariant& value, const QVariant& add,
                                     bool removeOld, const QVariant* visibleValue)
{
    d->disable_signalValueChanged = true; //to prevent emmiting valueChanged()
    if (dynamic_cast<QObject*>(this)) {
        /*kDebug() <<
            dynamic_cast<QObject*>(this)->metaObject()->className()
            << dynamic_cast<QWidget*>(this)->objectName()
            << "value=" << value << "add=" << add;*/
    }
    d->origValue = value;
    setValueInternal(add, removeOld);
    if (visibleValue)
        setVisibleValueInternal(*visibleValue);
    d->disable_signalValueChanged = false;
}
コード例 #11
0
int KSimBaseIntSpinBox::mapTextToValue(bool * ok)
{
	bool myOk;
	KSimBaseInt i = KSimBaseInt::convert(cleanText(), &myOk);

	if (!myOk)
	{
		i = value();
	}

	if (ok)
	{
		*ok = myOk;
	}

	return setValueInternal(i);
}
コード例 #12
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();
    }
}
コード例 #13
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();
    }
}
コード例 #14
0
void KSimBaseIntSpinBox::setMaxValue(int maxValue)
{
	m_p->setMax(maxValue);
	int res = setValueInternal(value());  // Setup arrow buttons
	KSimSpinBox::setValue(res);
}