[kde-edu]: Problem with QVariant on Rocs project (help request)

Tomaz Canabrava tumaix at gmail.com
Wed Aug 13 18:52:48 CEST 2008

I'v spend all morning working on Rocs trying to implement a multi-document
panel interface,
almost everything is good, but this little piece of code here is somewhat
my head hurts, anybody can show some light on this, pretty please, with
sugar on top?

void FileArea::createNewScript(){
   KTextEditor::Editor *e = _mainWindow->editor();
   KTextEditor::Document* d = e -> createDocument(0);
   addScript(d->documentName(), d);

void FileArea::addScript(const QString& name, KTextEditor::Document* data){
   QTreeWidgetItem *scriptItem = new QTreeWidgetItem(_scriptFolder);
   scriptItem->setIcon(0, KIcon("file-new"));
   scriptItem->setText(0, name);
   scriptItem->setData(0, ScriptRole, data);

void MainWindow::changeActiveScript(QTreeWidgetItem *item){
  KTextEditor::Document *d = item->data(0, FileArea::ScriptRole));
  _scriptingArea->setDocument( d );


cannot convert 'QVariant' to 'KTextEditor::Document*' in initialization
the line   KTextEditor::Document *d = item->data(0,
FileArea::ScriptRole)); gives me a QVariant,
I'v tried to qobject_cast<KTextEditor*>(item->data(0,
FileArea::ScriptRole)); but also without luck.

Anybody can give-me some light? i'm stuck here almost all morning.

Um Computador sem Windows é como um Navio sem dançarinas de Can-Can
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-edu/attachments/20080813/a64c0dbf/attachment.html 

More information about the kde-edu mailing list