bool CharTableModel::dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent) { if (action == Qt::IgnoreAction) return true; bool success = false; if (data->hasFormat("application/x-scribus-charpaltext")) { QByteArray textAndFont = data->data("application/x-scribus-charpaltext"); appendUnicode(QString::fromUtf8(textAndFont), 10); success = true; } else if (data->hasText()) { QChar textChar = data->text().at(0); appendUnicode(QString("%1").arg(textChar.unicode(), 10)); success = true; } return success; }
static const std::string getStringFromUnicode(const char unicode[4]) { std::stringstream ss; appendUnicode(unicode, ss); return ss.str(); };