Results 1 to 4 of 4

Thread: adding QAction to QDialog is not working

  1. #1
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default adding QAction to QDialog is not working

    hi,
    I want to add QAction to my customized dialog inherited from QDialog.

    QDialog has addAction method to add actions to QDialog. But it seems that Qaction added is not visible on QDialog.

    This way i am creating QAction and adding it to QDialog :

    Qt Code:
    1. QAction *actCount = new QAction(QIcon(tr("English_en\\countonback.png")), tr("Count On / Back"), this);
    2. addAction( actCount );
    To copy to clipboard, switch view to plain text mode 

    Can anybody guide me what is wrong and how to do it.

    Thanks in advance

    Regards,
    ~Sanjay
    Last edited by jpn; 13th August 2008 at 16:04. Reason: missing [code] tags

  2. #2
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: adding QAction to QDialog is not working

    Hi!

    void QWidget::addAction ( QAction * action )
    -Appends the action action to this widget's list of actions.

    Create an QToolButton add the action to the button with:

    void QToolButton::setDefaultAction ( QAction * action ) [slot]

    then add the button to the QDialogs layout.

  3. #3
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: adding QAction to QDialog is not working

    thanks,

    Its working.

    But i am having one more problem.

    Actions i have added now has button like appearance. Is it possible to have action like appearance.

    Regards,
    ~Sanjay

  4. #4
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: adding QAction to QDialog is not working

    You could add this action to QToolBar and add this toolbar to the dialogs layout

    or take a look at:

    http://doc.trolltech.com/4.4/widgets-styles.html

Similar Threads

  1. Replies: 11
    Last Post: 31st May 2007, 02:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.