Commit 6d22c4db authored by Halla Rempt's avatar Halla Rempt

Use QObject* with QVariant, instead of void*

So we can use the safer qobject_cast
parent a1349f8d
......@@ -40,19 +40,8 @@ const Soprano::Model *KoDocumentRdfBase::model() const
void KoDocumentRdfBase::linkToResourceManager(KoDocumentResourceManager *rm)
{
QVariant variant;
variant.setValue<void*>(this);
variant.setValue<QObject*>(this);
rm->setResource(KoText::DocumentRdf, variant);
kDebug(30015) << "setrm, rm" << rm;
// // DEBUG
// {
// if (!rm->hasResource(KoText::DocumentRdf)) {
// kDebug(30015) << "can not read back!";
// }
// KoDocumentRdfBase* b = static_cast<KoDocumentRdfBase*>(rm->resource(KoText::DocumentRdf).value<void*>());
// kDebug(30015) << "read back" << b;
// }
}
void KoDocumentRdfBase::updateInlineRdfStatements(const QTextDocument *qdoc)
......
......@@ -1235,7 +1235,7 @@ bool KoTextEditor::paste(KoTextEditor *editor,
KoDocumentRdfBase *rdf = 0;
if (shapeController->resourceManager()->hasResource(KoText::DocumentRdf)) {
rdf = static_cast<KoDocumentRdfBase*>(shapeController->resourceManager()->resource(KoText::DocumentRdf).value<void*>());
rdf = qobject_cast<KoDocumentRdfBase*>(shapeController->resourceManager()->resource(KoText::DocumentRdf).value<QObject*>());
saveHelper.setRdfModel(rdf->model());
}
......
......@@ -81,7 +81,7 @@ ChangeTrackedDeleteCommand::ChangeTrackedDeleteCommand(DeleteMode mode,
m_removedElements()
{
setText(i18nc("(qtundo-format)", "Delete"));
m_rdf = static_cast<KoDocumentRdfBase*>(shapeController->resourceManager()->resource(KoText::DocumentRdf).value<void*>());
m_rdf = qobject_cast<KoDocumentRdfBase*>(shapeController->resourceManager()->resource(KoText::DocumentRdf).value<QObject*>());
}
void ChangeTrackedDeleteCommand::undo()
......
......@@ -55,7 +55,7 @@ TextPasteCommand::TextPasteCommand(const QMimeData *mimeData,
m_pasteAsText(pasteAsText),
m_first(true)
{
m_rdf = static_cast<KoDocumentRdfBase*>(shapeController->resourceManager()->resource(KoText::DocumentRdf).value<void*>());
m_rdf = qobject_cast<KoDocumentRdfBase*>(shapeController->resourceManager()->resource(KoText::DocumentRdf).value<QObject*>());
if (m_pasteAsText)
setText(i18nc("(qtundo-format)", "Paste As Text"));
......
......@@ -852,7 +852,7 @@ void TextTool::copy() const
rm = canvas()->shapeController()->resourceManager();
}
if (rm && rm->hasResource(KoText::DocumentRdf)) {
KoDocumentRdfBase *rdf = static_cast<KoDocumentRdfBase*>(rm->resource(KoText::DocumentRdf).value<void*>());
KoDocumentRdfBase *rdf = qobject_cast<KoDocumentRdfBase*>(rm->resource(KoText::DocumentRdf).value<QObject*>());
if (rdf) {
saveHelper.setRdfModel(rdf->model());
}
......@@ -917,7 +917,7 @@ void TextTool::mouseDoubleClickEvent(KoPointerEvent *event)
// When whift is pressed we behave as a single press
return mousePressEvent(event);
}
int pos = m_textEditor.data()->position();
m_textEditor.data()->select(QTextCursor::WordUnderCursor);
......@@ -936,7 +936,7 @@ void TextTool::mouseTripleClickEvent(KoPointerEvent *event)
// When whift is pressed we behave as a single press
return mousePressEvent(event);
}
int pos = m_textEditor.data()->position();
m_textEditor.data()->clearSelection();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment