Results 1 to 2 of 2

Thread: 2D Game

  1. #1
    Join Date
    Oct 2009
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4

    Default Re: 2D Game

    I am going to program easy game in Qt, which 2D widgets I should use to display game? I've tried GraphicsView, but that's really awful for me....unexpected behavior around painting onto the screen such as added scrollbars in my main window to see full GraphicsView ?! But the size is the same as main window! It's too strange.

    Added after 40 minutes:

    I am quiet angry myself, it's terrible to work with GraphicsView and other GraphicsXYZ classes, awful! I don't understand how it can works!

    Added after 1 8 minutes:

    I have a lot of questions:
    1. I have an inherited class QGraphicsView and implemented paintEvent, why does debugger write: QPainter::begin: Paint device returned engine == 0, type: 1 ??
    This is whole code:
    Qt Code:
    1. void GraphicsView::paintEvent(QPaintEvent *)
    2. {
    3. QPainter painter(this);
    4. painter.setBrush(QBrush(QColor(255,127,0)));
    5. painter.drawRect(this->sceneRect());
    6. }
    To copy to clipboard, switch view to plain text mode 
    And I am not drawing outside from paintEvent method.
    2. Why I have scollbars in my GraphicsView window ? How to remove them?

    It's amazingly silly...
    Last edited by Peppy; 30th April 2011 at 23:10.

  2. #2
    Join Date
    Jul 2009
    Enschede, Netherlands
    Thanked 69 Times in 67 Posts
    Qt products
    Unix/X11 Windows

    Default Re: 2D Game

    Do your painting in graphics scene and graphics items. Leave QGraphicsView as it is. It is specifically designed to be painted on by qgraphicsscene. Read more on Graphics/View.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

Similar Threads

  1. game on qt
    By bibhukalyana in forum Qt Programming
    Replies: 6
    Last Post: 27th March 2011, 22:56
  2. Coding a game with Qt
    By seltra in forum Qt Programming
    Replies: 5
    Last Post: 5th October 2010, 20:49
  3. Replies: 1
    Last Post: 22nd May 2010, 07:38
  4. IQ Game
    By qtgears in forum Qt-based Software
    Replies: 0
    Last Post: 6th October 2009, 08:24
  5. Just for fun game
    By vermarajeev in forum Qt-based Software
    Replies: 6
    Last Post: 13th December 2007, 21:52


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.