Results 1 to 14 of 14

Thread: how connect in qt4....

  1. #1
    Join Date
    Feb 2006
    Posts
    16
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default how connect in qt4....

    Hi,
    I was working with qt3 and it was so easy to me ( i am not a c++ programmer ) to write the code. I have one main screen, and a secondary. To call the second screen from the main in designer, i just press the menu "edit", "slots", "new function" and then write the code. I don't know how is in the new qt4, could somebody explain me a little?

    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how connect in qt4....

    Try reading FAQ

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....


  4. #4
    Join Date
    Feb 2006
    Posts
    16
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    Well, i saw Qt Designer documentation....even i try the example with this erros:
    ain.cpp: In function ‘int main(int, char**)’:
    main.cpp:8: error: ‘imagedialog’ is not a member of ‘Ui’
    main.cpp:8: error: expected `;' before ‘ui’
    main.cpp:9: error: ‘ui’ was not declared in this scope
    make: *** [main.o] Error 1

    I did copy exactly the first example......

    That's the reason i am posting this question.

    Thanks

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    Quote Originally Posted by otortos
    main.cpp:8: error: ‘imagedialog’ is not a member of ‘Ui’
    Shouldn't it be "ImageDialog"? In C++ identifiers are case sensitive.

  6. #6
    Join Date
    Feb 2006
    Posts
    16
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    I did in both ways, ImageDialog and imagedialog....same error

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    Then check what is the value of your form's objectName property.

  8. #8
    Join Date
    Feb 2006
    Posts
    16
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    the name is the same: imagedialog

    my files: imagedialog.ui, main.cpp

    then i use qmake -project....then qmake and make.

    the code of main.cpp is a copy of documentation.
    Last edited by otortos; 9th March 2006 at 18:20.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    Do you have #include "ui_imagedialog.h" at the top of main.cpp?

  10. #10
    Join Date
    Feb 2006
    Posts
    16
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    Yes, i repeat...is a copy of the documentation....the first two lines are:

    #include "ui_imagedialog.h"
    #include <QApplication>

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    Could you post the sources and .ui file as an attachment?

  12. #12
    Join Date
    Feb 2006
    Posts
    16
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    Yes, thanks for your help.....
    Attached Files Attached Files

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    I've fixed the main.cpp file --- class name must match the one from .ui file. If you create a template based on QMainWindow, you must use QMainWindow in your code.

    I've also attached a simple example how to use .ui files in your code.
    Attached Files Attached Files

  14. #14
    Join Date
    Feb 2006
    Posts
    16
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: how connect in qt4....

    Thanks for your help....

Similar Threads

  1. A signal/slot connect isn't working.
    By Daimonie in forum Qt Programming
    Replies: 6
    Last Post: 15th February 2009, 22:55
  2. Replies: 12
    Last Post: 18th September 2008, 15:04
  3. connect problem QDialog
    By Zergi in forum Newbie
    Replies: 1
    Last Post: 1st January 2008, 13:36
  4. Replies: 5
    Last Post: 28th August 2006, 14:36

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.