Results 1 to 6 of 6

Thread: QT4 scope problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question QT4 scope problem

    This is a very newbie question
    It' a basic problem of scope between objects.
    In attachment the full example code.

    I have the main object (qt4testMainWindow : public QMainWindow) and I have a secondary object (qt4testData: public QObject) created by the first one.

    The main object build a UI of QMainWindow type; the second handle data but have to comunicate with the main object: it must call a main object's method.

    So I've created the new secondary object passing it the reference to the main UI (see "main_window.cpp" file at line 30).
    It's all ok if I have to change a UI value (see "qt4test_data.cpp" at line 30) from inside the secondary object.

    My problem is: how can I invoke "qt4testMainWindow::changeVar" method from the
    secondary object?
    I tried the method you can see in "qt4test_data.cpp" at line 32 without success:

    Qt Code:
    1. main_ui->changeVar ( 20 );
    To copy to clipboard, switch view to plain text mode 

    but I have a compiler error:

    Qt Code:
    1. qt4test_data.cpp: In member function ‘void qt4testData::init()’:
    2. qt4test_data.cpp:32: error: base operand of ‘->’ has non-pointer type ‘Ui::MainWindow’
    To copy to clipboard, switch view to plain text mode 

    Any help?
    Thanks,
    the_bis
    Attached Files Attached Files

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.