Results 1 to 2 of 2

Thread: QT Open Source, Designer and MSVC++

  1. #1
    Join Date
    Oct 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default QT Open Source, Designer and MSVC++

    I followed the tips on compiling QT for MSVC2005 and creating .vcproj files. I successfully compiled a Hello World! QT Example in MSVC++....

    Now I'm trying to use QT Designer with msvc++ 2005...

    I made a simple dialog following a tutorial, I saved the form (.ui file) to my project's directory

    I redid this

    qmake -project -t vcapp -o helloqt.pro
    qmake

    in a command prompt

    When I opened the .vcproj file again, there was a new folder called "Generated Forms" in the solution explorer

    this folder pointed to files moc_mainwindow.cpp and moc_mainwindow.h, which unfortunately do not exist...

    Note, there's also a folder called "Form files" which contains the .ui file I created earlier

    It would appear that I'm onto something, but I haven't gotten to the point that I can save a .ui file, compile my project with glue code and pop up my new GUI..

    What did I do wrong?

  2. #2
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QT Open Source, Designer and MSVC++

    this folder pointed to files moc_mainwindow.cpp and moc_mainwindow.h, which unfortunately do not exist...
    these file is required if you have Q_OBJECT micro in your class. means you using signal and slot.
    for creating these file you need to compile mainwindow.h

    Do the following steps:
    1. right clickon mainWindow.h in explorer tree branch, then select properties.
    in properties window goto Custom Build Step-->General then enter in
    Command line field : "%qtdir%\bin\moc.exe" "$(InputDir)$(InputName).h" -o "$(InputDir)moc_$(InputName).cpp"

    note: here qtdir is environment variable which have path of Qt or you can write Path of Qt directly.

    output field: $(InputDir)moc_$(InputName).cpp

    2. right click on mainWindow.h then select compile. this process will generate moc_mainwindow.cpp and moc_window.h

    3. you add this in "Generated " tree branch.

    now you can build your application.

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.