Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Why my defined QAction has no response?
Forum Updated to NodeBB v4.3 + New Features

[Solved]Why my defined QAction has no response?

Scheduled Pinned Locked Moved General and Desktop
16 Posts 3 Posters 5.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mybiandou
    wrote on last edited by
    #6

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #7

      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 !!

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gayu
        wrote on last edited by
        #8

        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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sam
          wrote on last edited by
          #9

          [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 ?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gayu
            wrote on last edited by
            #10

            ERROR
            no matching function for call to ‘QAction::QAction(QString, QPixmap, QString, unsigned int, mainForm* const, const char [8])’

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sam
              wrote on last edited by
              #11

              And how are you connecting the signals and slots ? Kindly share your code .

              1 Reply Last reply
              0
              • G Offline
                G Offline
                gayu
                wrote on last edited by
                #12

                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..

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Sam
                  wrote on last edited by
                  #13

                  Are you including the proper header files , Try including QObject header and build.
                  Also check for the proper signature of Q3Action class .

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    gayu
                    wrote on last edited by
                    #14

                    Might what the question i'm asking is silly, but please tell me
                    Whether Qt4 support QAction

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Sam
                      wrote on last edited by
                      #15

                      [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 ?

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        gayu
                        wrote on last edited by
                        #16

                        So when using Q3ToolBar and Q3PopupMenu, their actions must be Q3Actions.
                        Otherwise the QAction itself is used right.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved