PDA

View Full Version : problem in adding toolbar



bhogasena
29th January 2009, 14:42
hi,
i have derived one class from QWidget. in derived class i add QGlwidget in that irendered some objects. now i would like to add toolbar to the widget.

in derived class i declare objects for QAction and QToolbar

i have written code like
code:


void Window::createToolBars()
{
zoomToolBar = addToolBar(tr("Zoom"));
zoomToolBar->addAction(zoominAct);

zoomToolBar->addAction(zoomoutAct);

zoomToolBar->addAction(resetAct);

mouseToolBar = addToolBar(tr("Mouse"));
mouseToolBar->addAction(mouseAct);

}

it showing error as "addToolBar" is undeclared identifier.
can any one help me so that i'll be thankful to you.

thanks and regards
k. bhogasena reddy

jpn
29th January 2009, 14:47
As you can see from the documentation, addToolBar() is part of QMainWindow API. Please launch Qt Assistant and write "addToolBar" to the Index-tab.

bhogasena
29th January 2009, 14:53
yes,
addToolbar is member of QMainwindow. i included that class in my header.
i am not able to get what's the problem

nightghost
29th January 2009, 15:13
yes,
addToolbar is member of QMainwindow. i included that class in my header.
i am not able to get what's the problem

Inherit from QMainWindow instead of QWidget if you want to use the method QMainWindow::addToolBar()