[Qt-interest] moc .cpp file in visual studio

Linda Maria linda.maria.bjork at gmail.com
Tue Jun 30 09:21:24 CEST 2009


Thanks a lot all

This is basically what I have been doing. That is, to create custom build to
moc my .h files that include Q_OBJECT class declarations. However, I dont
know how to handle .cpp files that include private Q_OBJECT class
declarations. These files need to be moc-ed (to create .moc files) and
compiled with C/C++ Compiler Tool. Does visual studio support this?

Thanks,
Linda



Message: 6
Date: Mon, 29 Jun 2009 21:40:46 -0700
From: "David Ching" <dc at remove-this.dcsoft.com>
Subject: Re: [Qt-interest] moc .cpp file in visual studio
To: qt-interest at trolltech.com
Message-ID: <h2c50k$97k$1 at eple.troll.no>
Content-Type: text/plain; format=flowed; charset="iso-2022-jp";
       reply-type=original

<Oliver.Knoll at comit.ch> wrote in message
news:C10F29AB06447B4881FC0DE1E302E2F2E92F97C4 at sg000036.corproot.net...
> At least the VS 2005 Express does not for sure, don't know about the VS
> 2008 Express version. But I would be surprised if it would support
> plugins.
>

VS 2008 Express doesn't support plug-ins either.


> (Note that previously there were separate tools called "Qt Visual Studio
> AddOn" and "Qt Visual Studio Integration" - not sure if they still exist
> in parallel. I always got confused, but from what I remember the "AddOn"
> would simply provide the moc'cing/uic'ing steps and also still worked with
> Qt 3 (and 4, off course), whereas the "Integration" also embedded the Qt
> Designer etc. into Visual Studio (and only supported Qt 4)).
>

They still do exist in parallel.  The Add On is the one freely available;
the VS Integration is the commercial-only one.  The latest Add On has
knowledge of .ui files and will launch the external Qt Designer when
double-clicked.  I don't think there is any real benefit of the VS
Integration one any longer, and the download page for the Add-on states it
is meant to be used for both (L)GPL AND Commercial.


> Alternativelly you edit the *.h to be mock'ed MANUALLY and type in the
> necessary POST-BUILD steps (or was it Custom compile steps? Can't
> remember...). The easiest thing would probably be to create a dummy
> project with at least one *.ui and *.h to be mocked, and let "qmake -t
> vcapp" create a Visual Studio project for you. Then see how the *.h files
> are custom-compiled and copy/adapt that code in your own Visual Studio
> project. It is a PAIN, but it works (and don't forget to manually add the
> gener
> ated moc_*.cpp etc. files to your project as well, otherwise you'll get
> linker errors!).
>

The Add-On adds a Qt menu to VS, and one of the items is Open .PRO file (or
something similar to that).  I believe that does the equivalent of
"qmake -t".


Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090630/efffe789/attachment.html 


More information about the Qt-interest-old mailing list