Results 1 to 2 of 2

Thread: error: invalid use of undefined type ‘struct QVariant’

  1. #1
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Question error: invalid use of undefined type ‘struct QVariant’

    Dear Everyone!
    see problem and suggest solution!

    frameplaylist.cpp: In member function ‘void FramePlaylist::read(int, int, int, dataPlay*)’:
    frameplaylist.cpp:59: error: invalid use of undefined type ‘struct QVariant’
    /usr/local/Trolltech/Qt-4.3.1/include/QtCore/qobject.h:60: error: forward declaration of ‘struct QVariant’
    frameplaylist.cpp:60: error: invalid use of undefined type ‘struct QVariant’
    /usr/local/Trolltech/Qt-4.3.1/include/QtCore/qobject.h:60: error: forward declaration of ‘struct QVariant’
    frameplaylist.cpp:65: error: invalid use of undefined type ‘struct QVariant’
    /usr/local/Trolltech/Qt-4.3.1/include/QtCore/qobject.h:60: error: forward declaration of ‘struct QVariant’
    frameplaylist.cpp:66: error: invalid use of undefined type ‘struct QVariant’
    /usr/local/Trolltech/Qt-4.3.1/include/QtCore/qobject.h:60: error: forward declaration of ‘struct QVariant’
    frameplaylist.cpp:67: error: invalid use of undefined type ‘struct QVariant’
    /usr/local/Trolltech/Qt-4.3.1/include/QtCore/qobject.h:60: error: forward declaration of ‘struct QVariant’
    frameplaylist.cpp:68: error: invalid use of undefined type ‘struct QVariant’
    /usr/local/Trolltech/Qt-4.3.1/include/QtCore/qobject.h:60: error: forward declaration of ‘struct QVariant’
    make: *** [frameplaylist.o] Error 1
    Qt Code:
    1. /*this is a frameplaylist.h*/
    2. #ifndef FRAMEPLAYLIST_H
    3. #define FRAMEPLAYLIST_H
    4. #include<QtGui/QWidget>
    5. #include<QtCore/QProcess>
    6. //#include"playlist.h"
    7. //#include"qscrollerview.h"
    8. #include <QDesktopWidget>
    9. #include <QRect>
    10. //#include "data.h"
    11. #include <QDebug>
    12. #include <QtCore/QRect>
    13. #include<QApplication>
    14. #include <QString>
    15. #include <QtSql/QSqlDatabase>
    16. #include <QtSql/QSqlQuery>
    17. #include <QtSql/QSqlError>
    18. #include <QMessageBox>
    19.  
    20. struct dataPlay
    21. {
    22. QString SeqData[100];
    23. QString mfileData[100];
    24. QString filetypeData[100];
    25. QString EndTimeData[100];
    26. QString filepathData[100];
    27. QString framenameData;
    28. };
    29. class FramePlaylist: public QWidget
    30. {
    31. Q_OBJECT
    32.  
    33. public:
    34. int tempId,frameId; //TemplateId,FrameId
    35. int locx,locy; //location X,location Y
    36. int h,w; //FrameHeight,FrameWidth
    37. int totalMediaFiles; //No.of MediaFiles in Each Frame
    38. int currentIndex; //Position of MediaFiles
    39. QString mediaPath[50]; //Location of MediaFile
    40. QString mediaType[50]; //Type of MediaFile
    41.  
    42. //public:
    43. //int h2,w2; //resolution hight,resolution width
    44. int seqNo; //SequenceNo.of MediaFiles in Each Frame
    45. int playaudio; //Play Audio Flag
    46. int stopFlag; //Stop Process Flag
    47. int playFlag;
    48. QString frameName; //Play Process Flag
    49. QProcess *mp;
    50. //QScrollerView *v;
    51. QRect screen;
    52. protected:
    53.  
    54. int checkMediaType(QString mediaType[],int seqNo);
    55. void playUrl();
    56. void playMplayer();
    57. void playScroller();
    58. public:
    59. FramePlaylist(QWidget *parent=0);
    60. ~FramePlaylist();
    61. //void loadFramePlaylistData();
    62. void read(int i, int id, int index, dataPlay* frameData);
    63. void loadMediaFiles(int i, int index, dataPlay* frameData);
    64. void play();
    65. void stop();
    66. void cal();
    67. //void readfile1();
    68. //void readfile2();
    69. void reSize(FramePlaylist *a,FramePlaylist *b);
    70. //void stopScroller();
    71. public slots:
    72. void endPlayProcess();
    73. //void stopPlay();
    74. };
    75.  
    76.  
    77. #endif
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. /*this is frameplaylist.cpp*/
    2. #include "frameplaylist.h"
    3.  
    4.  
    5. /**********************************************************************************************
    6. Initiate the Constructor and read the System Resolution
    7. **********************************************************************************************/
    8. FramePlaylist::FramePlaylist(QWidget *parent)
    9. : QWidget(parent)
    10. {
    11. currentIndex=0;
    12. stopFlag=0;
    13. setWindowFlags(Qt::FramelessWindowHint);
    14.  
    15. //system("xvidtune -show | cut -d ' ' -f1|cut -d'x' -f1|tee h1");
    16. //system("xvidtune -show | cut -d ' ' -f1|cut -d'x' -f2|tee w1");
    17.  
    18. //readfile1();
    19. //readfile2();
    20. db1 = QSqlDatabase::addDatabase( "QMYSQL" ); //Establised database canation
    21. db1.setDatabaseName("VistaPenguin" );
    22. db1.setUserName( "root" );
    23. db1.setHostName( "localhost" );
    24. if (!db1.open())
    25. {
    26. QMessageBox::critical(0,QObject::tr("Database Error"),db1.lastError().text());
    27. exit(0);
    28. }
    29. }
    30.  
    31. void FramePlaylist::read(int i, int id,int index, dataPlay* frameData)
    32. {
    33.  
    34. QSqlQuery playquery("Select * from ScreenTemplateDetail");
    35. if(playquery.isActive())
    36. {
    37.  
    38. while(playquery.next())
    39. {
    40. int typeId=playquery.value(0).toInt();
    41. frameName=playquery.value(2).toString();
    42. if(id==typeId)
    43. {
    44. if(frameName==frameData[i].framenameData)
    45. {
    46. h=playquery.value(3).toInt();
    47. w=playquery.value(4).toInt();
    48. locx=playquery.value(5).toInt();
    49. locy=playquery.value(6).toInt();
    50. }
    51.  
    52.  
    53. }
    54. }
    55. }
    56.  
    57. cal();
    58. loadMediaFiles(i,index,frameData);
    59. }
    To copy to clipboard, switch view to plain text mode 

    I am calling like this;
    f1.read(0,id,indexNo,frameData);
    Thanks in advance!
    Last edited by jacek; 19th October 2007 at 22:54. Reason: missing [code] tags
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  2. #2
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: error: invalid use of undefined type ‘struct QVariant’

    Looks like you forgot
    Qt Code:
    1. #include <QtCore/QVariant>
    To copy to clipboard, switch view to plain text mode 

    P.S: Please use code tag to post the source code as the syntax highlighting makes your code more readable to everyone.
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  3. The following user says thank you to Gopala Krishna for this useful post:

    ashukla (15th October 2007)

Similar Threads

  1. MS Sql native driver??
    By LordQt in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2007, 13:41
  2. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  3. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  4. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15
  5. Strange error while using Q3Canvas
    By Kapil in forum Newbie
    Replies: 13
    Last Post: 15th June 2006, 19:36

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.