0

Can I copy QtCore folder from QtCreator and use it in my Visual Studio 2013 C++ project?

I need them to be able include this:

#include "QtCore/qdatetime.h"
#include "QtCore/qnamespace.h"

Which I found in that QtCore folder.

For be able to run this:

  double QDateTime2RatTime(const QDateTime *qdt) {
   const qint64 diffFrom1970To1900 = 2209161600000;
   const double MSecsPerDay = 24.0*60.0*60.0*1000.0;
   const double InvMSecsPerDay = 1.0 / MSecsPerDay;

   qint64 diff = qdt->toMSecsSinceEpoch() + diffFrom1970To1900;
   return ((double)diff)*InvMSecsPerDay;
}

That function is called like this:

char* stringDateTime = "2000-02-29T12:05:00+02:00";
QDateTime qTime = QDateTime::fromString(stringDateTime, Qt::ISODate); 
double time = convertTime(&qTime); 

Conclusion:
Input: char* stringDateTime = "2000-02-29T12:05:00+02:00";
output:double time
Process: using function double QDateTime2RatTime(const QDateTime *qdt) Dependencies: Qt I don't have it in my Visual Studio 2013 Question: Can I use QtCore from Qt Creator which I installed? (latest version). Just copy QtCore folder to my Visual Studio project folder and include headers I need will it work with that binaries?

user1097772
  • 3,499
  • 15
  • 59
  • 95
  • 1
    The only function you need is toMSecSinceEpoch and you want to import the whole core? Just look at the sources [here](https://qt.gitorious.org/qt/qt/source/57756e72adf2081137b97f0e689dd16c770d10b1:src/corelib/tools/qdatetime.cpp) if you really need the Qt function and copy the necessary code. However, what do you exactly not like about the VS [time function](https://msdn.microsoft.com/en-us/library/1f4c8f33.aspx)? – BaCaRoZzo Jan 30 '15 at 20:30
  • @BaCaRoZzo I also need `QDateTime::fromString(stringDateTime, Qt::ISODate); ` but in fact I just need to convert that damn time `"2000-02-29T12:05:00+02:00";` to double according this function. If would be able do similar action without the Qt I would be happiest man in da world. But thanks for that links, it would be helpful. – user1097772 Jan 30 '15 at 21:03
  • Come on pal, don't be so negative. You can work things out. You just need to stick the pieces together. :) Qt converts date which are in Iso 8601 format, you can try to follow the [answer here](http://stackoverflow.com/questions/11768099/parse-json-iso8601-date-in-c-cx) or search for a way to convert such format in Visual c++. – BaCaRoZzo Jan 30 '15 at 22:59

0 Answers0