Results 1 to 20 of 20

Thread: Add Static area to QGraphicsView

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Add Static area to QGraphicsView

    This is the MainWindow class header.
    Well, I can agree that this could be a part of MainWindow class header

    There should be nothing wrong in your code, my quick test looks very similar and works:
    Qt Code:
    1. // test.h
    2. #include <QtGui>
    3.  
    4. class MainW : public QMainWindow{
    5. Q_OBJECT
    6.  
    7. QGraphicsView * view;
    8.  
    9. public:
    10. explicit MainW( QWidget * parent = NULL );
    11. public slots:
    12. void warning( int value ){
    13. this->setWindowTitle(QString::number(value));
    14. }
    15. };
    16.  
    17. // test.cpp
    18. #include "test.h"
    19.  
    20. MainW::MainW( QWidget * parent ) : QMainWindow(parent){
    21. view = new QGraphicsView(this);
    22. QGraphicsScene * scene = new QGraphicsScene(this);
    23. scene->setSceneRect(0,0,1000,1000);
    24. view->setScene(scene);
    25. this->setCentralWidget(view);
    26. connect( view->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(warning(int)) );
    27. }
    28.  
    29. int main(int argc, char *argv[]){
    30. QApplication a(argc, argv);
    31. MainW m;
    32. m.show();
    33. return a.exec();
    34. }
    To copy to clipboard, switch view to plain text mode 

    Try to make a clean build ( make clean, qmake, make ). If this doesn't help, post full code (if you can).

  2. The following user says thank you to stampede for this useful post:

    dubstar_04 (14th April 2011)

  3. #2
    Join Date
    Feb 2010
    Posts
    27
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Add Static area to QGraphicsView

    stampede,

    I just made a new project and copied your example and i get the same error.

    if i edit out the connect line it builds and runs as expected?

    am using QT 4.7 on a mac.

    any further suggestions?

    Thanks,

    Dubstar_04
    Last edited by dubstar_04; 13th April 2011 at 19:11.

  4. #3
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Add Static area to QGraphicsView

    That's really weird, I'm sorry but I can't help you more, because my experience with mac == 0
    I see that you have Unix and Windows in your profile info, does all of this works on those systems, can you check that ?

  5. #4
    Join Date
    Feb 2010
    Posts
    27
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Add Static area to QGraphicsView

    i am just uninstalling all the Qt stuff off my mac as i have loads of different versions. I will try and build it again once i have reinstalled everything.

    I will try the linux and windows machines if that doesnt work.

    Thanks for all your help.

    update:
    Reinstalled qt on mac. same error.
    it wouldnt build on linux either. same issue.
    Last edited by dubstar_04; 13th April 2011 at 19:12.

Similar Threads

  1. Replies: 8
    Last Post: 5th April 2011, 10:19
  2. static sight on QGraphicsView
    By thgis in forum Qt Programming
    Replies: 0
    Last Post: 7th October 2010, 08:55
  3. Replies: 1
    Last Post: 9th December 2009, 08:44
  4. Putting static controls on top of QGraphicsView
    By durbrak in forum Qt Programming
    Replies: 3
    Last Post: 10th September 2007, 12:51
  5. Replies: 4
    Last Post: 14th February 2006, 21:35

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.