PDA

View Full Version : adding QAction to QDialog is not working



sanjayshelke
13th August 2008, 08:08
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 :


QAction *actCount = new QAction(QIcon(tr("English_en\\countonback.png")), tr("Count On / Back"), this);
addAction( actCount );

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

Thanks in advance

Regards,
~Sanjay

kemp
13th August 2008, 08:18
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.

sanjayshelke
13th August 2008, 08:52
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

kemp
13th August 2008, 09:39
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