Here you are. The error is:
virtual bool QTextEdit::canInsertFromMimeData(const QMimeData*) const is protected
Here you are. The error is:
virtual bool QTextEdit::canInsertFromMimeData(const QMimeData*) const is protected
Great.
Do you know what a protected method is?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
I guess so. I've been searching for more information on this subject but still i don't know why the error is here. It it is protected the instance of QTextEdit - textEdit should have access to this method, shouldn't it?
Well, with programming you should not 'guess' - you should know!I guess so.
Make sure you understand what public, protected and private are.
Yes, QTextEdit can access it, but you are accessing it from 'MainWindow'.t it is protected the instance of QTextEdit - textEdit should have access to this method, shouldn't it?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
hmmm I see. I will try to think of how it should be. Thanks for help!
Have a look at the drag and drop documentation, there are code snippets as well for demonstration:
http://doc.trolltech.com/4.7/dnd.html
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
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):
Qt Code:
#ifndef TEXTEDITOR_H #define TEXTEDITOR_H #include <QtGui> { Q_OBJECT protected: }; #endif // TEXTEDITOR_HTo 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!
Last edited by high_flyer; 24th February 2011 at 08:52. Reason: code tags
Declare and implement this constructor in TextEditor class, then run make clean, qmake and make on your project.undefined reference to `TextEditor::TextEditor(QWidget*)'
Bookmarks