Results 1 to 3 of 3

Thread: Mystic Problem (QGraphicsView + QGLWidget)

  1. #1
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default Mystic Problem (QGraphicsView + QGLWidget)

    Hey @all,

    have a problem where i'am confused. I have a QGraphicsScene Object where i draw my stuff. today i set the viewport of the QGraphicsView as follows:
    Qt Code:
    1. view = new QGraphicsView(scene);
    2. view->setViewport(new QGLWidget(new QGLContext(QGLFormat::defaultFormat())));
    To copy to clipboard, switch view to plain text mode 

    on my primary monitor (vga output) the background is white -> Correct
    but when i start my Application with the mouse cursor at my second monitor (digital output) the background is black

    Where can i handle that the background of the QGraphicsView is allways white?

    I hope somebody can help me.

    King Reagards
    NoRulez

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mystic Problem (QGraphicsView + QGLWidget)

    u can use drawBackground() to fill the background of the view with white color.

    But such prob shudnt be there, can u show us more what u are trying ??

    also are your variables properly initialised ? I once had a problem with graphics items where i had not initialised some member. On my pc it used to run correct, but on my collegue's some prob occured.

  3. #3
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default Re: Mystic Problem (QGraphicsView + QGLWidget)

    main.cpp:

    Qt Code:
    1. scene = new DiagramScene(itemMenu, this);
    2. QHBoxLayout *layout = new QHBoxLayout;
    3. view = new QGraphicsView(scene);
    4. QGLWidget *glwidget = new QGLWidget;
    5. view->setViewport(glwidget);
    6. view->show();
    To copy to clipboard, switch view to plain text mode 
    The drawing stuff is with QGraphicsPixmapItem and such things.

    Regards

    P.S.: I also noticed that in the company the background is white, but the images (QGraphicsPixmapItem) aren't shown
    Last edited by NoRulez; 28th April 2008 at 11:49.

Similar Threads

  1. Replies: 4
    Last Post: 7th May 2008, 01:01
  2. Problem determining size of QGraphicsView
    By Bocki in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2008, 15:54
  3. QGLWidget resize problem.
    By anderl in forum Qt Programming
    Replies: 2
    Last Post: 22nd January 2008, 09:57
  4. why linking problem with QGLWidget???
    By Shuchi Agrawal in forum Newbie
    Replies: 17
    Last Post: 16th March 2007, 11:45
  5. Problem combining QWorkspace & QGLWidget
    By Nb2Qt in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2006, 22:45

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.