PDA

View Full Version : Weird QTextEdit error



MarkoSan
31st March 2008, 09:10
I've added some QTextEdit to a QWidget and I get this weirdo error. The code of line is:
inline QString textInput()
{ return m_pTextInput->text(); };And the error is:
mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/markofr/workspace/SettingsEditor'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\4.3.4\include\QtCore" -I"..\..\..\..\Qt\4.3.4\include\QtCore" -I"..\..\..\..\Qt\4.3.4\include\QtGui" -I"..\..\..\..\Qt\4.3.4\include\QtGui" -I"..\..\..\..\Qt\4.3.4\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\4.3.4\mkspecs\win32-g++" -o debug\CDataInputWidget.o CDataInputWidget.cpp
In file included from CDataInputWidget.cpp:1:
CDataInputWidget.h: In member function `QString CDataInputWidget::textInput()':
CDataInputWidget.h:36: error: 'class QTextEdit' has no member named 'text'
mingw32-make[1]: *** [debug/CDataInputWidget.o] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/markofr/workspace/SettingsEditor'
mingw32-make: *** [debug] Error 2This CInputWidget is a class, made for QLabel+QTextEdit, grouped into QGroupBox. I am pretty sure it is a dumb error, but I cannot crack it, please help!

jpn
31st March 2008, 09:29
Nothing weird there. :) QTextEdit indeed has no such member as text(). You might want to take a closer look at QTextEdit docs.

MarkoSan
31st March 2008, 09:33
Nothing weird there. :) QTextEdit indeed has no such member as text(). You might want to take a closer look at QTextEdit (http://doc.trolltech.com/latest/qtextedit.html) docs.

Citate from docs:
Q (http://www.qtcentre.org/forum/qstring.html)String QTextEdit::text () const Returns all the text in the text edit as plain text.
See also setText (http://www.qtcentre.org/forum/qtextedit.html#setText)().

So, what the hell is going on?!

jpn
31st March 2008, 09:38
Are you reading docs of Qt 3? Could you provide a link?

Edit: Oh, it's part of Qt 3 Support Members for QTextEdit (http://doc.trolltech.com/4.3/qtextedit-qt3.html):


The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.

Qt3 support methods are only available if your Qt was built with Qt3Support.

aamer4yu
31st March 2008, 09:40
Did u include QTextEdit ??

#include<QTextEdit>

and does toPlainText() work instead of text() ??

MarkoSan
31st March 2008, 09:44
Citate from docs:

So, what the hell is going on?!

Ok, jpn! I was wrong, sorry, read the WRONG DOCS :D:D:D:D. But now I have a deeper problem. The following code:
connect(m_pStationIDInputWidget->ptrTextInput(),
SIGNAL(textChanged()),
this,
SLOT(stationIDTextChanged()));

returns warning:
warning: Object::connect: No such signal QLineEdit::textChanged()
Must I implement signal mapper or why this slot is never called when it should be?

jpn
31st March 2008, 09:59
returns warning:
warning: Object::connect: No such signal QLineEdit::textChanged()
QLineEdit doesn't have such signal. It has a parameter.

MarkoSan
31st March 2008, 10:06
Yes yes, I forgot to tell you I've changed the base class to QTextEdit, which has textChanged() signal. But I still get same warning.

jpn
31st March 2008, 11:05
But it says that you are passing a QLineEdit to the connect statement.