Results 1 to 3 of 3

Thread: Graphicsview??

  1. #1
    Join Date
    Jul 2009
    Posts
    8
    Platforms
    Windows

    Default Graphicsview??

    Well, i try to use an graphicsview.
    It's located in an dialog form (createt with the designer from qt creator IDE) and called "test".

    In the constructor of the form (after m_ui->setupUi(this) i tried this, to write anything on the gv.

    Qt Code:
    1. scene.addText("GraphicsView rotated clockwise");
    2.  
    3. m_ui->test->setScene(&scene);
    4. m_ui->test->rotate(90); // the text is rendered with a 90 degree clockwise rotation
    5. m_ui->test->show();
    To copy to clipboard, switch view to plain text mode 

    But it has no effect. The graphicsview is still empty.
    What am I doing wrong?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Graphicsview??

    You are creating a local object of type QGraphicsScene that gets destroyed once you leave the constructor so you see nothing. Create the scene on heap instead of the stack.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2009
    Posts
    8
    Platforms
    Windows

    Default Re: Graphicsview??

    thanks, that was the problem..

    Qt Code:
    1. QGraphicsScene *graphicsScene = new QGraphicsScene(this);
    To copy to clipboard, switch view to plain text mode 

    now works fine...

    Thank you

Similar Threads

  1. Adding events to GraphicsView
    By mkarakaplan in forum Qt Programming
    Replies: 6
    Last Post: 4th May 2009, 00:26
  2. No text antialiasing with OpenGL graphicsview
    By pherthyl in forum Qt Programming
    Replies: 3
    Last Post: 13th March 2009, 22:47
  3. Newbie: Circuits and GraphicsView
    By RY in forum Newbie
    Replies: 10
    Last Post: 1st October 2008, 05:12
  4. GraphicsView performance
    By nileshsince1980 in forum Qt Programming
    Replies: 2
    Last Post: 19th September 2007, 12:19
  5. QT GraphicsView Help
    By mistertoony in forum Qt Programming
    Replies: 15
    Last Post: 15th February 2007, 04:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.