Results 1 to 2 of 2

Thread: extend QScintilla class

  1. #1
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default extend QScintilla class

    I've been trying to extend the QScintilla class to add some functionality that I'm missing, but I keep running into some errors. My header file looks like the following:

    Qt Code:
    1. #ifndef EDITOR_H
    2. #define EDITOR_H
    3.  
    4. #include <QKeyEvent>
    5. #include <Qsci/qsciglobal.h>
    6. #include <Qsci/qsciscintilla.h>
    7.  
    8. class QSCINTILLA_EXPORT Editor : public QsciScintilla
    9. {
    10. Q_OBJECT
    11.  
    12. public:
    13. Editor(QWidget* parent = 0);
    14. virtual ~Editor();
    15.  
    16. signals:
    17.  
    18. public slots:
    19. void keyPressEvent(QKeyEvent* e);
    20.  
    21. private:
    22.  
    23. };
    24.  
    25. #endif // EDITOR_H
    To copy to clipboard, switch view to plain text mode 

    My current .pro file looks as:

    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2011-09-20T18:58:15
    4. #
    5. #-------------------------------------------------
    6. # http://hackage.haskell.org/trac/haskell-prime/wiki/UnicodeInHaskellSource
    7.  
    8. TARGET = naelc
    9. TEMPLATE = app
    10. QT += core gui
    11. DEFINES += QSCINTILLA_DLL #__SPECIAL_WINDOWS_DEFINE__
    12. LIBS += -lqscintilla2
    13. DEPENDPATH += .
    14.  
    15. SOURCES += src/main.cpp\
    16. src/naelc.cpp \
    17. src/projectswidget.cpp \
    18. src/editorwidget.cpp \
    19. src/constants.cpp \
    20. src/project.cpp \
    21. src/orientationbutton.cpp \
    22. src/module.cpp \
    23. src/editor.cpp
    24.  
    25. HEADERS += src/naelc.h \
    26. src/projectswidget.h \
    27. src/editorwidget.h \
    28. src/constants.h \
    29. src/project.h \
    30. src/orientationbutton.h \
    31. src/module.h \
    32. src/editor.h \
    33.  
    34. FORMS += ui/naelc.ui \
    35. ui/projectswidget.ui \
    36. ui/editorwidget.ui
    37.  
    38. RESOURCES += \
    39. resources.qrc
    To copy to clipboard, switch view to plain text mode 

    When I compile this though, I keep getting the following errors:

    Qt Code:
    1. ./release\editorwidget.o:editorwidget.cpp:(.text+0x313): undefined reference to `_imp___ZN6EditorC1EP7QWidget'
    2. ./release\editorwidget.o:editorwidget.cpp:(.text+0x713): undefined reference to `_imp___ZN6EditorC1EP7QWidget'
    3. ./release\editor.o:editor.cpp:(.text+0xfb): undefined reference to `_imp___ZTV6Editor'
    4. ./release\editor.o:editor.cpp:(.text+0x123): undefined reference to `_imp___ZTV6Editor'
    5. ./release\editor.o:editor.cpp:(.text+0x153): undefined reference to `_imp___ZTV6Editor'
    6. ./release\editor.o:editor.cpp:(.text+0x197): undefined reference to `_imp___ZTV6Editor'
    7. ./release\editor.o:editor.cpp:(.text+0x1cb): undefined reference to `_imp___ZTV6Editor'
    8. ./release\moc_editor.o:moc_editor.cpp:(.text+0x15): undefined reference to `_imp___ZN6Editor16staticMetaObjectE'
    9. ./release\moc_editor.o:moc_editor.cpp:(.text+0x26): undefined reference to `_imp___ZN6Editor16staticMetaObjectE'
    To copy to clipboard, switch view to plain text mode 

    I have no clue what is going on here. My guess would be that I would have to define Editor in a separate project and export it's own .dll file and use that inside my project.

  2. #2
    Join Date
    Oct 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: extend QScintilla class

    I think you should remove the QSCINTILLA_EXPORT from the class definition.

Similar Threads

  1. QScintilla
    By drake1983 in forum Newbie
    Replies: 3
    Last Post: 1st November 2010, 13:01
  2. QScintilla
    By gerome69 in forum Qt Programming
    Replies: 2
    Last Post: 17th May 2009, 14:30
  3. qscintilla and markers
    By sawerset in forum Qt Programming
    Replies: 0
    Last Post: 17th February 2009, 21:39
  4. Documentation on QScintilla api files
    By davidh in forum Qt Programming
    Replies: 0
    Last Post: 29th November 2007, 18:36
  5. How to extend a class ?
    By agent007se in forum Newbie
    Replies: 11
    Last Post: 27th June 2006, 12:09

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.