PDA

View Full Version : QToolBar



sabeesh
14th September 2007, 12:05
Hi,
I am using QT 4.3. I nned to create a toolbar. So I create the code like this.

================================================== =================
QToolBar *bar = new QToolBar("main", this);
pButton[pbt_ctl_size ] = new QToolButton;
pButton[pbt_ctl_size ]->setIcon(QPixmap((const char **)ctl_size_xpm));
pButton[pbt_ctl_size ]->setToolTip("Size and framerate");
connect(pButton[pbt_ctl_size ], SIGNAL(clicked()), pVideo, SLOT(ShowFormatDialog()));
pButton[pbt_ctl_size ]->setCheckable(true);
pButton[pbt_ctl_size ]->setEnabled(true);
bar->addWidget(pButton[pbt_ctl_size ]);



pButton[pbt_ctl_video ] = new QToolButton;
pButton[pbt_ctl_video]->setIcon(QPixmap((const char **)ctl_video_xpm));
pButton[pbt_ctl_video]->setToolTip("Video adjustments");
connect(pButton[pbt_ctl_video ], SIGNAL(clicked()), pVideo, SLOT(ShowFormatDialog()));
pButton[pbt_ctl_video]->setEnabled(true);
bar->addWidget(pButton[pbt_ctl_video ]);

================================================== ===========================

after this code QT display a toolbar and two icons in my window. But it is not activate. If any error in this code? How can I use the click event of this toolbar?
Please help me....

jpn
14th September 2007, 20:48
What do you mean by "is not active"? Did you add the tool bar to main window with QMainWindow::addToolBar()?