×

Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    1

    Question Setting size of QGraphicsScene-emulator problem or something is wrong in 6-line code?

    I want to create scrollable graphics, not so large, as fullscreen ( N900, Qt Creator 1.3.83). After looking in animated tiles sample, I wrote the code below:

    QGraphicsScene scene(0,0,400,400); //Smaller size
    scene.setBackgroundBrush(Qt::blue); //for the first attempt
    QGraphicsView *view = new QGraphicsView (&scene);
    view->setCacheMode(QGraphicsView::CacheBackground);
    view->show();
    return a.exec();

    In Maemo emulator (once more, Qt Creator 1.3.83 ) it shows blue fullscreen, not 400x400 area.
    When I'm setting 900x900 size during my attempts - scrollbars are visible. This means, that parameters are exactly passing inside constructor and accepted OK.

    I made a try to set

    view->resize(400,400);

    same thing (full blue screen, not area). Emulator, or something is forgotten|not known by me - any advice? (Maybe, I set wrong color, as in BSOD? )
    P.S. How window title area with clock etc. may be hidden?

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Setting size of QGraphicsScene-emulator problem or something is wrong in 6-line c

    Most of the bugs occupy only one line.
    Code:
    #include <QtGui>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QGraphicsScene scene;
        scene.setBackgroundBrush(Qt::blue);
    
        QGraphicsView view(&scene);
        view.setCacheMode(QGraphicsView::CacheBackground);
        view.setMaximumSize(400, 400);
    
        QMainWindow win;
        win.setCentralWidget(&view);
        win.show();
    
        return app.exec();
    }

  3. #3
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Setting size of QGraphicsScene-emulator problem or something is wrong in 6-line c

    Quote Originally Posted by dAlexis_II View Post
    How window title area with clock etc. may be hidden?
    They are not visible if window is in fullscreen mode.

Similar Threads

  1. Replies: 106
    Last Post: 2009-05-11, 05:53
  2. HELP! Handling Call!!
    By joseph.m in forum Symbian
    Replies: 14
    Last Post: 2009-03-09, 09:00
  3. carbide and v2.0 SDK's helloworldbasic?
    By pollyp in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2007-10-02, 00:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×