I have one more question concerning this topic..I changed approach a little bit and i tried subclassing QTextEdit this way(The body of this functions is taken directly from drag-and-drop documentation of QTextEdit):
#ifndef TEXTEDITOR_H
#define TEXTEDITOR_H
#include <QtGui>
{
Q_OBJECT
protected:
bool canInsertFromMimeData
( const QMimeData *source
) const;
void insertFromMimeData
( const QMimeData *source
);
};
#endif // TEXTEDITOR_H
#ifndef TEXTEDITOR_H
#define TEXTEDITOR_H
#include <QtGui>
class TextEditor: public QTextEdit
{
Q_OBJECT
protected:
bool canInsertFromMimeData( const QMimeData *source ) const;
void insertFromMimeData( const QMimeData *source );
};
#endif // TEXTEDITOR_H
To copy to clipboard, switch view to plain text mode
Then I put my new widget- TextEditor, using QT Creator, to my project but unfotunatelly there's error when compiling it:
debug/mainwindow.o:mainwindow.cpp
.text$_ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0xcc0): undefined reference to `TextEditor::TextEditor(QWidget*)'
collect2: ld returned 1 exit status
Does anybody know why such error occurs and how to fix it?
Regards!
Bookmarks