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(); } }
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; } }
void KexiBlobTableEdit::clear() { setValueInternal(QByteArray(), true); signalEditRequested(); //emit acceptRequested(); repaintRelatedCell(); }
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(); }
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(); }
void KSimBaseIntSpinBox::stepDown() { KSimBaseInt newValue(value()); int res; newValue = newValue.value() - lineStep(); // Base is not changed! res = setValueInternal(newValue); KSimSpinBox::setValue(res); }
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(); }
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); }
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()"); }
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; }
int KSimBaseIntSpinBox::mapTextToValue(bool * ok) { bool myOk; KSimBaseInt i = KSimBaseInt::convert(cleanText(), &myOk); if (!myOk) { i = value(); } if (ok) { *ok = myOk; } return setValueInternal(i); }
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(); } }
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(); } }
void KSimBaseIntSpinBox::setMaxValue(int maxValue) { m_p->setMax(maxValue); int res = setValueInternal(value()); // Setup arrow buttons KSimSpinBox::setValue(res); }