void KexiBlobTableEdit::clear() { setValueInternal(QByteArray(), true); signalEditRequested(); //emit acceptRequested(); repaintRelatedCell(); }
void KexiBoolTableEdit::handleAction(const QString& actionName) { if (actionName == "edit_paste") { emit editRequested(); bool ok; const int value = qApp->clipboard()->text(QClipboard::Clipboard).toInt(&ok); if (ok) { m_currentValue = (value == 0) ? QVariant(false) : QVariant(true); } else { m_currentValue = field()->isNotNull() ? QVariant(0)/*0 instead of NULL - handle case when null is not allowed*/ : QVariant(); } repaintRelatedCell(); } else if (actionName == "edit_cut") { emit editRequested(); //! @todo handle defaultValue... m_currentValue = field()->isNotNull() ? QVariant(0)/*0 instead of NULL - handle case when null is not allowed*/ : QVariant(); handleCopyAction(KexiDataItemInterface::originalValue(), QVariant()); repaintRelatedCell(); } }
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(); }