[Qt-interest] newbie: error with building project
John McClurkin
jwm at nei.nih.gov
Thu Apr 30 13:32:52 CEST 2009
john doe wrote:
> Hello all,
> I am a newbie with Qt. I have tried to find my answer on the
> net but could not figure out the exact solution. I have started on a
> small project a basic form with a few text inputs, buttons and combo boxes.
>
> I get the following error when I build using QDevelop and QT 4.4.3
>
> Build (make)...
>
> /usr/bin/uic-qt4 ui/dialog.ui -o build/ui_dialog.h
>
> g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB
> -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I.
> -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore
> -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4
> -Ibuild -Ibuild -o build/dialogimpl.o src/dialogimpl.cpp
>
> src/dialogimpl.cpp: In member function ‘void DialogImpl::startjob()’:
>
> src/dialogimpl.cpp:97: error: request for member ‘text’ in
> ‘((DialogImpl*)this)->DialogImpl::<anonymous>.Ui::mygui::<anonymous>.Ui_mygui::operatoridcomboBox’,
> which is of non-class type ‘QComboBox*’
>
> make: *** [build/dialogimpl.o] Error 1
>
> ---------------------- Build finished with 1 error(s) ----------------------
>
>
> When I added the combo box on the main form in QT designer, it does say
> its of type QComboBox!
>
> I'm basically trying to read the current text in the combo box using
>
> void DialogImpl::startjob()
>
> {
>
> //declare vars
>
> QString str;
>
> //pick up the operator ID
>
> str=operatoridcomboBox.text(1);
The error message from the compiler says it all. operatoridcombox is a
pointer, not a QComboBox object. The line above should be
str=operatoridcomboBox->text(1);
>
> testlineEdit->setText( str );
>
> //start the job
>
> }
>
>
> I have tried currentText etc.. but all spit out the same error. It'll be
> great if someone can please help point out the issue, I'm also new to
> C++ which kind of compounds the problem.
>
>
> Thanks in advance.
>
More information about the Qt-interest-old
mailing list