[Qt-interest] [Qt-creator] Export Visual Studio 2008projects to Qt
Pedro Silva Vicente
psilvavicente at gmail.com
Thu Nov 12 04:05:48 CET 2009
Alex
I started learning Qt recently and I did not notice that XML API, but yes
that could have been a better approach. I'll give it a try, thanks for the
information.
Pedro
----- Original Message -----
From: "Bravo.Alex" <Alex.Bravo at igt.com>
To: <qt-creator at trolltech.com>; <qt-interest at trolltech.com>
Sent: Wednesday, November 11, 2009 7:47 PM
Subject: Re: [Qt-creator] [Qt-interest] Export Visual Studio 2008projects to
Qt
> Pedro,
> I'm just curious, since .vcproj has XML syntax, why not use really nice
> XML APIs
> that Qt has to extract info from that file?
> The resulting code usually is much more stable than direct string
> manipulation.
>
> Example: consider what would happen if there's a define named
> "RelativePath"
>
> I do like your idea though.
>
> -----Original Message-----
> From: qt-creator-bounces at trolltech.com
> [mailto:qt-creator-bounces at trolltech.com] On Behalf Of Pedro Silva Vicente
> Sent: Wednesday, November 11, 2009 3:50 PM
> To: Pedro Silva Vicente; qt-interest at trolltech.com;
> qt-creator at trolltech.com
> Subject: Re: [Qt-creator] [Qt-interest] Export Visual Studio 2008 projects
> to Qt
>
> I initially created a .pro project from scratch and added each project
> file
> name on the .vcproj file by hand (vcproj has an XML like syntax), but
> since the solution has thousands of files, I gave up quickly.
>
> I ended up changing a Qt application that I am developing to just read the
> .vcproj file and export the file names to a text file that I used for
> the
> "SOURCES" and "HEADERS" part of the .pri Qt file.
>
> The relevant code is here, feel free to use, with some tweaking this code
> can be changed to generate the .pro or .pri files directly.
> The code reads the .vcproj file and extracts each file name, located in
> the
> .vcproj file with the keyword "RelativePath" and saves each name to a new
> file "out.txt".
>
> "file_name " in the parameter list is the name of the .vcproj file ,
> obtained from
>
> fileName = QFileDialog::getOpenFileName(this,
> tr("Open File"), ".",
> tr("HDF5 files (*.h5);;All files (*.*)"));
>
>
> void MainWindow::convert( const char* file_name )
> {
>
> FILE *fr;
> FILE *fw;
> char s[512];
> int c;
> int index;
> int len;
> QString name;
> QByteArray ba;
>
>
> fr = fopen(file_name, "r");
> fw = fopen("out.txt", "w");
> if ( fr == NULL )
> {
> return;
> }
>
>
> c = getc(fr);
> while (c != EOF)
> {
>
> fscanf( fr, "%s", s );
>
> QString str( s );
> QString path ( "./src/" );
>
> if ( str.contains( "RelativePath" ) )
> {
>
> index = str.lastIndexOf ( QChar('\\' ) );
> len = str.length();
> name = str.right( len - index - 1 );
> name.chop( 1 );
> path.append( name );
> path.append( " \\" );
>
> ba = path.toLatin1();
> fwrite( ba.data(), sizeof( char ), path.length(), fw );
> fwrite( "\n", sizeof( char ), 1, fw );
> }
>
>
> c = getc(fr);
> }
> fclose(fr);
> fclose(fw);
>
> return;
>
>
>
> }
>
>
>
>
>
> ----- Original Message -----
> From: "David Ching" <dc at remove-this.dcsoft.com>
> To: <qt-interest at trolltech.com>
> Sent: Wednesday, November 11, 2009 10:02 AM
> Subject: Re: [Qt-interest] Export Visual Studio 2008 projects to Qt
>
>
>> "Girish Ramakrishnan" <girish at forwardbias.in> wrote in message
>> news:hdebhu$alk$1 at eple.troll.no...
>>> Have you tried the Visual Studio Integration? Add-In is for old versions
>>> of visual studio.
>>>
>>
>> VS Integration has always been for commercial only, and that has been
>> formally deprecated by Nokia. They aren't developing it anymore (in
>> fact,
>> they had stopped in the 4.3 or 4.4 timeframe) and encourage everyone to
>> now
>> use the Add-In (which is available for GPL and LPGL) as well.
>>
>> Regarding the original poster's question, I don't believe the Add-in will
>> generate a .pro file for non-Qt projects, but it shouldn't be very hard
>> to
>> construct one. If nothing else, just create a temporary new Qt project
>> and
>> add all the files from the non-Qt project, then export the temporary Qt
>> project. Alternatively, open a command prompt and use qmake -project to
>> generate a .pro file from the files in the current folder.
>>
>> But then settings like compiler/linker are not necessarily set right. So
>> maybe just examine the .sln and .vcproj of the Qt project and add the
>> relevant lines into the non-Qt project to fool the Add-in into thinking
>> it
>> is a Qt project.
>>
>>
>> -- David
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
More information about the Qt-interest-old
mailing list