Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsTextItem QPainter::begin: Paint device returned engine == 0, type: 2
Forum Updated to NodeBB v4.3 + New Features

QGraphicsTextItem QPainter::begin: Paint device returned engine == 0, type: 2

Scheduled Pinned Locked Moved General and Desktop
14 Posts 3 Posters 10.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lishen
    wrote on last edited by
    #2

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #3

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lishen
        wrote on last edited by
        #4

        i use win 7 x64 OS

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lishen
          wrote on last edited by
          #5

          use Qt 5.1.1 vc2010 openGl and try build project on Qt 5.1.1 vc 2012

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            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.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Lishen
              wrote on last edited by
              #7

              @#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&#40;&#41;;
              

              }@

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Lishen
                wrote on last edited by
                #8

                i checked the bug report system? nothing similar.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DBoosalis
                  wrote on last edited by
                  #9

                  Works fine on Ubuntu with Qt 5.2.1

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Lishen
                    wrote on last edited by
                    #10

                    currently i use Desktop Qt 5.2.1 MSVC2010 32bit OpenGL Win 7 x64, and it does not work

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      Lishen
                      wrote on last edited by
                      #11

                      bq. Works fine on Ubuntu with Qt 5.2.1 bq

                      you tried add multiple lines?

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        DBoosalis
                        wrote on last edited by
                        #12

                        You mean like this:
                        @QGraphicsTextItem* ti = new QGraphicsTextItem("text1\ntest2\ntest3");@

                        This does work, or do I not understand your question

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          Lishen
                          wrote on last edited by
                          #13

                          !http://i057.radikal.ru/1403/4d/502eb5d77412.png(artefact)!

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            Lishen
                            wrote on last edited by
                            #14

                            [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

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved