Results 1 to 20 of 28

Thread: How Can i Load data from file.ecg and plot it ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Mar 2012
    Posts
    19
    Thanks
    15
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Windows Symbian S60

    Default Re: How Can i Load data from file.ecg and plot it ?

    thanks a lot for your help
    but when i use this code i have some errors
    i am using GUI application
    can you help me to fix this?. sorry for annoying you but i am a beginner ... thanks in advance

    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3. #include<QFile>
    4. #include<QtCore>
    5. #include<QtGui>
    6. #include<QTextStream>
    7.  
    8. MainWindow::MainWindow(QWidget *parent) :
    9. QMainWindow(parent),
    10. ui(new Ui::MainWindow)
    11. {
    12. ui->setupUi(this);
    13. ui->label->setText("Hello User :)");
    14.  
    15. }
    16.  
    17. MainWindow::~MainWindow()
    18. {
    19. delete ui;
    20. }
    21.  
    22. void MainWindow::on_pushButton_clicked()
    23. {
    24. QFile file("C:/ahmad/ecg test/tst.txt");
    25. if(!file.open( QFile::ReadOnly | QFile::Text))
    26. {
    27. ui->label->setText(" OOP : File Cant be Opened");
    28. return;
    29. }
    30. QTextStream in(&file);
    31. ui->label->setText("DONE : file opened");
    32. while (!in.atEnd())
    33. {
    34. list << in.readLine();
    35. }
    36. file.close();
    37. data = new double[list.size()];
    38. for(int i = 0; i< list.size(); i++)
    39. {
    40. data[i] = list[i].toDouble();
    41. }
    42. dataSize = list.size();
    43. }
    To copy to clipboard, switch view to plain text mode 


    and the errors are:
    C:\examples\Plot-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2010__Qt_SDK__Debug\..\..\Examples\Plot\mainw indow.cpp:38: error: C2248: 'QWidget::data' : cannot access private member declared in class 'QWidget'
    C:\examples\Plot-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2010__Qt_SDK__Debug\..\..\Examples\Plot\mainw indow.cpp:38: error: C2440: '=' : cannot convert from 'double *' to 'QWidgetData *'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    C:\examples\Plot-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2010__Qt_SDK__Debug\..\..\Examples\Plot\mainw indow.cpp:41: error: C2248: 'QWidget::data' : cannot access private member declared in class 'QWidget'
    C:\examples\Plot-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2010__Qt_SDK__Debug\..\..\Examples\Plot\mainw indow.cpp:41: error: C2679: binary '=' : no operator found which takes a right-hand operand of type 'double' (or there is no acceptable conversion)
    C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtGui/qwidget.h(143): could be 'QWidgetData &QWidgetData::operator =(const QWidgetData &)'
    while trying to match the argument list '(QWidgetData, double)'
    C:\examples\Plot-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2010__Qt_SDK__Debug\..\..\Examples\Plot\mainw indow.cpp:43: error: C2065: 'dataSize' : undeclared identifier
    Last edited by wysota; 20th March 2012 at 08:20. Reason: missing [code] tags

Similar Threads

  1. Replies: 12
    Last Post: 31st October 2010, 17:08
  2. Load data from different ui
    By Xtresis in forum Newbie
    Replies: 2
    Last Post: 29th September 2010, 11:57
  3. Way to load all of data from 2 tables into one QTableView?
    By Kevin Hoang in forum Qt Programming
    Replies: 8
    Last Post: 3rd April 2010, 09:42
  4. Saving pure plot data to image file
    By Debilski in forum Qwt
    Replies: 4
    Last Post: 7th April 2009, 17:02
  5. Replies: 6
    Last Post: 26th March 2009, 05:45

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
  •  
Qt is a trademark of The Qt Company.