Unsolved Position of images of QImages in QTextDocument.
-
How can i find the position of images in QTextDocument?
-
Hi
You would loop over the QTextBlock and find image ones.
Im not sure it has a x,y if that is what you are looking for.void MainWindow::ImageInfo() { QTextBlock bl = ui->textarea->document()->begin(); while (bl.isValid()) { QTextBlock::iterator it; for (it = bl.begin(); !(it.atEnd()); ++it) { QTextFragment currentFragment = it.fragment(); if (currentFragment.isValid()) { if (currentFragment.charFormat().isImageFormat()) { QTextImageFormat imgFmt = currentFragment.charFormat().toImageFormat(); QString image_name = imgFmt.name(); qDebug() << "Image " << image_name; } // if image } } bl = bl.next(); } }
Credits to some russian site. :)