QGraphicsTextItem QPainter::begin: Paint device returned engine == 0, type: 2
-
wrote on 1 Mar 2014, 20:49 last edited by
@
QGraphicsTextItem* item = new QGraphicsTextItem(this)
item ->setTextInteractionFlags(Qt::TextEditorInteraction);
item ->setCacheMode(ItemCoordinateCache);
@when i type on keyboard on item, i see this message:
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::translate: Painter not active
QPainter::setClipRegion: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::translate: Painter not active
QPainter::save: Painter not active
QPainter::setClipRect: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::restore: Unbalanced save/restore
QPainter::worldTransform: Painter not active
QPainter::worldTransform: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::drawRects: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::drawRects: Painter not active
QPainter::end: Painter not active, aborted
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::translate: Painter not active
QPainter::setClipRegion: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::translate: Painter not active
QPainter::save: Painter not active
QPainter::setClipRect: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::restore: Unbalanced save/restore
QPainter::worldTransform: Painter not active
QPainter::worldTransform: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::drawRects: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::drawRects: Painter not active
QPainter::end: Painter not active, abortedbut if cache mode is noCache all right.
what wrong? -
wrote on 3 Mar 2014, 12:19 last edited by
i set up QGraphicsView and QGraphicsScene, and added into QGraphicsScene some custom graphic items Inherited from QGraphicsObject and all of this works fine with caching and without.
item is child custom graphic object
if add item into scene directly and type in text item single line all ok, if 2 and more lines then error
-
Hi and welcome to devnet,
Which version of Qt on which OS are you using ?
Also, since you seem to reliably trigger this, did you took a look at the "bug report system":http://bugreports.qt-project.org ?
-
wrote on 4 Mar 2014, 04:30 last edited by
i use win 7 x64 OS
-
wrote on 4 Mar 2014, 04:36 last edited by
use Qt 5.1.1 vc2010 openGl and try build project on Qt 5.1.1 vc 2012
-
Did you check the bug report system ?
If there's nothing there, please prepare a minimal compilable example (which sometimes allows you to also find errors in your code) that reproduces the problem. Once it's done you should open a new bug report with it.
-
wrote on 4 Mar 2014, 11:56 last edited by
@#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsTextItem>
#include <QGraphicsView>
#include <QLayout>
#include <QMainWindow>int main(int argc, char argv[])
{
QApplication a(argc, argv);
QMainWindow window = new QMainWindow();
window->setFixedSize(200, 200);QGraphicsScene* scene = new QGraphicsScene(window->rect(), window); QGraphicsTextItem* ti = new QGraphicsTextItem("text"); ti->setTextInteractionFlags(Qt::TextEditorInteraction); ti->setCacheMode(QGraphicsObject::ItemCoordinateCache); ti->setPos(100, 100); QGraphicsView* view = new QGraphicsView(window); view->setScene(scene); scene->addItem(ti); window->layout()->addWidget(view); view->resize(window->size()); window->show(); return a.exec();
}@
-
wrote on 4 Mar 2014, 12:07 last edited by
i checked the bug report system? nothing similar.
-
wrote on 4 Mar 2014, 14:24 last edited by
Works fine on Ubuntu with Qt 5.2.1
-
wrote on 4 Mar 2014, 15:32 last edited by
currently i use Desktop Qt 5.2.1 MSVC2010 32bit OpenGL Win 7 x64, and it does not work
-
wrote on 4 Mar 2014, 15:40 last edited by
bq. Works fine on Ubuntu with Qt 5.2.1 bq
you tried add multiple lines?
-
wrote on 4 Mar 2014, 15:45 last edited by
You mean like this:
@QGraphicsTextItem* ti = new QGraphicsTextItem("text1\ntest2\ntest3");@This does work, or do I not understand your question
-
wrote on 4 Mar 2014, 15:47 last edited by
-
wrote on 4 Mar 2014, 15:50 last edited by
[quote author="DBoosalis" date="1393947922"]You mean like this:
@QGraphicsTextItem* ti = new QGraphicsTextItem("text1\ntest2\ntest3");@This does work, or do I not understand your question[/quote]
when typing on the keyboard in the text box
4/14