[Solved]Why my defined QAction has no response?
-
Whether the QAction is not working for him
-
Thank you, Sam
You are quire right.
I am sorry for my silly problem. It confused me for a week.
I really wish the meta object compiler can help much.
-
You are welcome,
bq. I am sorry for my silly problem.
No need, we all are here to learn :)
Kindly Edit your first post and prepend [Solved] to the title.
Happy Coding !!
-
In my project i also used the same QAction, but when compiling it show some errors.
Thats y i asked u about the QAction. Will u please tell me about that -
[quote author="gayu" date="1353399435"]In my project i also used the same QAction, but when compiling it show some errors.
Thats y i asked u about the QAction. Will u please tell me about that[/quote]What errors are you getting ?
-
ERROR
no matching function for call to ‘QAction::QAction(QString, QPixmap, QString, unsigned int, mainForm* const, const char [8])’ -
And how are you connecting the signals and slots ? Kindly share your code .
-
Ya sure
The following is the main.cpp file@
#include <qapplication.h>
#include "mainform.h"int main( int argc, char ** argv )
{
QApplication a( argc, argv );
mainForm w;
w.show();
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
}
@
The following code is somewhere in the mainform.cpp file@
void mainForm::setupLanguageActions()
{Q3ToolBar *tb = new Q3ToolBar( this ); tb->setLabel( "Language Actions" ); Q3PopupMenu *menu = new Q3PopupMenu( this ); menuBar()->insertItem( tr( "&Language" ), menu ); Q3Action *a; a = new Q3Action( tr( "Tamil" ), tr( "&Tamil" ), Qt::CTRL + Qt::Key_Z, this, "langtamil" ); connect( a, SIGNAL( activated() ), this, SLOT( ChangeLangTamil() ) ); a->addTo( tb ); a->addTo( menu ); a = new Q3Action( tr( "Hindi" ), tr( "&Hindi" ), Qt::CTRL + Qt::Key_Y, this, "langhindi" ); connect( a, SIGNAL( activated() ), this, SLOT( ChangeLangHindi() ) ); a->addTo( tb ); a->addTo( menu );
}
@
And also for more actions.. -
Are you including the proper header files , Try including QObject header and build.
Also check for the proper signature of Q3Action class . -
Might what the question i'm asking is silly, but please tell me
Whether Qt4 support QAction -
[quote author="gayu" date="1353403125"]Might what the question i'm asking is silly, but please tell me
Whether Qt4 support QAction[/quote]Ofcourse Qt4 support QAction ,you can have a look in "Porting to Qt 4":http://qt-project.org/doc/qt-4.8/porting4.html#qaction and "QAction":http://qt-project.org/doc/qt-4.8/qaction.html class.
But why are you still working in Qt 3 ?
-
So when using Q3ToolBar and Q3PopupMenu, their actions must be Q3Actions.
Otherwise the QAction itself is used right.