From swamprat09, 5 Months ago, written in Plain Text.
Embed
  1. #include <QtCharts/QCandlestickSeries>
  2. #include <QtCharts/QCandlestickSet>
  3. #include <QtCharts/QChartView>
  4.  
  5. #include <QDateTime>
  6. #include <QTextStream>
  7.  
  8. QT_CHARTS_USE_NAMESPACE
  9.  
  10. // .pro needs to include
  11. // Qt += charts core
  12. int main()
  13. {
  14.         QCandlestickSet * stick1 = new QCandlestickSet(2,10,6,8);
  15.        
  16.         QTextStream out(stdout);
  17.  
  18.         QDateTime datetime = QDateTime::currentDateTime();
  19.         out << "The date and time is " << datetime.toString() << endl;
  20.         out << "datetime: " << datetime.toMSecsSinceEpoch() << endl;
  21.  
  22.         QDateTime datetime2 = QDateTime(QDate(1917, 12, 20), QTime(17, 30, 12, 55));
  23.         out << "The date and time is " << datetime2.toString() << endl;
  24.         out << "datetime2: " << datetime2.toMSecsSinceEpoch() << endl;
  25.        
  26.        
  27.         out << "open: " << stick1->open() << endl;
  28.         out << "high: " << stick1->high() << endl;
  29.         out << "low: " << stick1->low() << endl;
  30.         out << "close: " << stick1->close() << endl;
  31.  
  32.         stick1->setTimestamp(datetime.toMSecsSinceEpoch());
  33.         out << "timestamp: " << (long) stick1->timestamp() << endl;
  34.  
  35.         stick1->setTimestamp(datetime2.toMSecsSinceEpoch());
  36.         out << "timestamp: " << (long) stick1->timestamp() << endl;
  37.  
  38.         out << (qreal) -100 << endl;
  39.                
  40.         return 0;
  41. }