Results 1 to 3 of 3

Thread: "Incomplete" Event class types [solved]

  1. #1
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default "Incomplete" Event class types [solved]

    Hello all!

    I'm having a serious problem with what seems to be all events. Whenever I use them I get an error "pointer to incomplete class type not allowed". This is compiled under Visual Studio 2010. I've gone up the entire event source code and as far as I can tell, everything is actually right. Since I don't really know what this error means It's difficult to track down. Derived classes from QWidget compile, link, and work fine. Trying to use any event kind from inside any file has the same issue, so I highly doubt its a coding error on my side, unless I'm missing an include or something.

    Here is a code sample from QSFMLTileSheet.cpp
    Qt Code:
    1. #include "QSFMLTileSheet.h"
    2.  
    3. void QSFMLTileSheet::mousePressEvent(QMouseEvent* evt) {
    4. if ((evt->x() > 0) {
    5. //execute code
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

    Trying to use evt gives the error "pointer to incomplete class type not allowed". Here is the header chain to QWidget.

    QSFMLTileSheet.h
    Qt Code:
    1. #ifndef INC_QSFMLTILESHEET_H
    2. #define INC_QSFMLTILESHEET_H
    3.  
    4. #include "QSFMLCanvas.h"
    5. #include "TileSheet.h"
    6.  
    7. namespace Toolkit {
    8. class QSFMLTileSheet : public QSFMLCanvas {
    9. public:
    10. QSFMLTileSheet(QWidget* Parent = 0, const QPoint& Position = QPoint(0,0), const QSize& Size = QSize(0,0), unsigned int FrameTime = 0, bool StretchResize = false);
    11.  
    12. TileSheet* GetTileSheet();
    13. void SetTileSheet(TileSheet* TSheet);
    14.  
    15. unsigned int GetWidth();
    16. unsigned int GetHeight();
    17.  
    18. void SetSelectable(bool Enable);
    19. bool GetSelectable();
    20.  
    21. void SetGridDrawing(bool Enable);
    22. bool GetGridDrawing();
    23.  
    24. void SetDrawMouseHover(bool Enable);
    25. bool GetDrawMouseHover();
    26.  
    27. void SetSelectedTileID(unsigned int TileID);
    28. unsigned int GetSelectedTileID();
    29.  
    30. unsigned int GetTileXCountFromID(unsigned int TileID);
    31. unsigned int GetTileYCountFromID(unsigned int TileID);
    32.  
    33. unsigned int GetMouseHoverTileID();
    34.  
    35. protected:
    36. void OnInit();
    37. void OnUpdate();
    38.  
    39. void mousePressEvent(QMouseEvent *event);
    40. void mouseMoveEvent(QMouseEvent *event);
    41.  
    42. private:
    43. TileSheet* tsheet;
    44.  
    45. sf::Sprite tsheetPreview;
    46. bool gridNeedsUpdating;
    47. bool drawTileGrid;
    48. bool selectable;
    49. bool drawMouseHover;
    50. unsigned int selectedTileID;
    51. };
    52. }
    53. #endif
    To copy to clipboard, switch view to plain text mode 

    QSFMLCanvas.h
    Qt Code:
    1. #ifndef INC_QSFMLCANVAS_H
    2. #define INC_QSFMLCANVAS_H
    3.  
    4. #include <SFML/Graphics.hpp>
    5. #include <Qt/qwidget.h>
    6. #include <Qt/qtimer.h>
    7.  
    8. namespace Toolkit {
    9. class QSFMLCanvas : public QWidget, public sf::RenderWindow {
    10. public:
    11. QSFMLCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size, unsigned int FrameTime = 0, bool StretchResize = false);
    12. virtual ~QSFMLCanvas();
    13.  
    14. protected:
    15. virtual void OnInit();
    16. virtual void OnUpdate();
    17. virtual QPaintEngine* paintEngine() const;
    18. virtual void showEvent(QShowEvent*);
    19. virtual void paintEvent(QPaintEvent*);
    20.  
    21. QTimer myTimer;
    22. bool myInitialized;
    23. };
    24. }
    25. #endif
    To copy to clipboard, switch view to plain text mode 

    I'm not sure where to go from here. I don't mind having to recompile Qt.

    Any help is appreciated, Thanks.
    Last edited by Live-Dimension; 5th August 2010 at 14:37.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: "Incomplete" Event class types

    I bet you haven't included the neede headers. Try to add
    Qt Code:
    1. #include <QMouseEvent>
    To copy to clipboard, switch view to plain text mode 
    and also better do not include the actuall header file qwidget.h. better also use
    Qt Code:
    1. #include <QtGui/QWidget>
    2. // or
    3. #include <QWidget>
    To copy to clipboard, switch view to plain text mode 

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

    Live-Dimension (5th August 2010)

  4. #3
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: "Incomplete" Event class types

    Actually, now that you mention it, I'm not so sure my include directory is set right, but it looks right.

    QT Root Dir "C:\Qt\vs2010\"
    QT Include dir (set in project settings): "C:\Qt\vs2010\include\"

    I keep having oddities, for example, #include <QMouseEvent> doesn't link to anything. I did notice that file seems to be missing.

    also better do not include the actuall header file qwidget.h. better also use
    Yeah I know. Problem is that visual studio automatically does that, and I get tired with fighting with it.

    edit: looks likes I'm meant to include all the directories inside /include/. ehh! Is this true? I use visual studio because creator drove me up the wall, but I'm still trying to figure out the right settings.

    edit: Well, after adding all the dirs inside /include suddenly everything works a whole lot better. Thankyou for giving me the idea!
    Last edited by Live-Dimension; 5th August 2010 at 14:38. Reason: updated contents

Similar Threads

  1. Replies: 1
    Last Post: 3rd May 2010, 09:25
  2. Replies: 4
    Last Post: 19th March 2008, 17:47
  3. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  4. Compilation error: "field 'xxx' has incomplete type"
    By fedcer in forum Qt Programming
    Replies: 4
    Last Post: 27th July 2007, 15:01
  5. Replies: 2
    Last Post: 25th August 2006, 11:35

Tags for this Thread

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.