Results 1 to 8 of 8

Thread: ui. files with Visual Studio 10

  1. #1
    Join Date
    Jul 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default ui. files with Visual Studio 10

    Hi,
    I only added a label in a complete C++/Qt Project with the Qt-Desinger, then I tried to rebuild the project with Visual Studio, but now I get some errors like this : "error C4430: missing type specifier - int assumed. Note: C++ does not support default-int", meaning that the compiler couldn't find my ui.-file ? I tried to remove the changes, but the result was the same... :/ Maybe you can help me ?
    Thanks a lot !

  2. #2
    Join Date
    Jul 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt Designer Class with Visual Studio

    Hi, I've got a complete Qt-Projekt, including some .ui-files and it worked with Visual Studio. Then I wanted to change some Labels etc. in the ui.-files, but now the Visual Studio add-on only creates empty .cpp and .h-files...
    And I get nearly 263 Erros caused of this...The first error is: 324 IntelliSense: identifier "Dialog" is undefined m:\... 2382
    The ui-files were first written with Qt 3 and now transfomed to Qt 4. I changed the Labels with the Desinger an Qt 4.7.4 Version. So I used the uic3.exe and also tried the uic.exe, but it doesn't work ...

    Have you any idea ?
    Thanks a lot for help !

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt Designer Class with Visual Studio

    How can we help you if all you tell us is that you made some changes to a project and now get a lot of errors when you try to build it?

    • Could you build the project before you made the changes?
    • If you create a completely new project with a ui file (maybe a dialog-based app), do you get the same problems?
    • Did you install the Qt Visual Studio plugin? Is it the correct one for Visual Studio 2010?
    • Do you have more than one version of Qt installed? If so, are you sure you are compiling against the one you think you are?

  4. #4
    Join Date
    Jul 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: ui. files with Visual Studio 10

    I could compile the project and everything runed...I've got the Qt plug-in for Visual Studio 10 and it creates .h and .cpp-files to the .ui-files in the build folder, but after I changed one file it only creats an empty .cpp and .h- files for it...
    How does the plug-in exactly work ? o.O

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: ui. files with Visual Studio 10

    I assume the plugin simply arranges to run the [B]uic[B] command over the *.ui files in your project, adding the resulting source files to the project (just like qmake does for the rest of us). If you are getting empty *.cpp/*.h files then my guess (and it is only a guess) is that you have broken the *.ui file.

    Is the *.ui file zero sized? Valid XML? What do you get when you run uic over the *.ui file? C++ code like this:
    Qt Code:
    1. $ uic test.ui
    2. /********************************************************************************
    3. ** Form generated from reading UI file 'test.ui'
    4. **
    5. ...
    6. QT_END_NAMESPACE
    7.  
    8. #endif // UI_TEST_H
    To copy to clipboard, switch view to plain text mode 
    or something like this:
    Qt Code:
    1. $ uic test.ui
    2. uic: Error in line 1, column 0 : Premature end of document.
    3. File 'fuck.ui' is not valid
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: ui. files with Visual Studio 10

    The Visual Studio Qt plugin manages the project file (VS version of a Makefile), provides some wizards for adding new Qt-based classes to projects, can import and export .pro files, adds build and link rules to run uic and moc when needed, and so forth. For ui files, opening them for edit will run Qt Designer by default. It would be nearly impossible to use Visual Studio productively on Qt projects without it.

    It sounds to me like the OP has broken the UI file. I'm not sure how that is possible if the only changes that were made were done through Qt Designer unless something happened when saving the file to cause corruption.

    It is also possible that if a new widget was added to the .ui file, the appropriate #include files might not have been added to the C++ class source files. This doesn't happen automatically. A "C++ does not support default int" error usually arises when the return type for a method or an argument type for a method has not been specified (or can't be determined from the types in scope during the compilation).

    I'd suggest deleting the .ui file and using Qt Designer in stand-alone mode to re-create a new file with the same name as the old one. If the old file can still be opened in Qt Designer, then rename it, open it, create a new widget / dialog, and drag and drop the old widgets and layouts into the new one.

  7. #7
    Join Date
    Jul 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: ui. files with Visual Studio 10

    It's simply empty.. o.O There are no hinds on some errors ... :/

  8. #8
    Join Date
    Jul 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: ui. files with Visual Studio 10

    ...I've got still problems with this project... It is written in Qt 3 with Visual Studio 10 and "transformed" to Qt 4 with the uic3.exe, that means I've got a .ui-file, Qt-Version 3.3, that I can open and edit with the Qt4-Designer, but I can't compile the edited version. The uic3.exe builds a Qt4 compatible .h and .cpp-file, including the informations from the .ui and ui.h-file. What I want is to transforme the .ui and ui.h in that way, that I can edit the .ui file with the Qt 4-Designer.
    I tried to write my own .h and .cpp within the Slots and Signal for one of the, with the QtDesigner tranformed, .ui-files. I tried Project->addClass->Qt4GuiClass but I got the error: "It is impossible to add a QtGuiClass to the current project, as it was not created using Qt4VSAddin." Then I tried "Convert project to Qt add-in project" but I got still the same error.
    I also tried to add the .ui/.h/.cpp-files from a VisualStudio written, working test-project and to include them in my project, but I my tries had no success, in that way, that Visual Studio doesn't create the ui_myTest.h or the moc_...-file or somethÃ*ng else additional..
    Have you any idea how I can modify the settings or what I have to add ?

Similar Threads

  1. moc files on visual studio ?
    By jajdoo in forum Newbie
    Replies: 0
    Last Post: 10th November 2011, 14:17
  2. Replies: 1
    Last Post: 16th August 2011, 00:26
  3. Replies: 1
    Last Post: 22nd June 2010, 18:22
  4. Creation of .ts Files in Visual Studio
    By Ragnaron in forum Installation and Deployment
    Replies: 0
    Last Post: 9th March 2010, 10:56
  5. visual studio project files - adding extra files
    By luf in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2008, 22:05

Tags for this Thread

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.