Results 1 to 4 of 4

Thread: problem in adding toolbar

  1. #1
    Join Date
    Jan 2009
    Posts
    33
    Qt products
    Qt4
    Platforms
    Windows
    Thanked 2 Times in 2 Posts

    Default problem in adding toolbar

    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:

    Qt Code:
    1. void Window::createToolBars()
    2. {
    3. zoomToolBar = addToolBar(tr("Zoom"));
    4. zoomToolBar->addAction(zoominAct);
    5.  
    6. zoomToolBar->addAction(zoomoutAct);
    7.  
    8. zoomToolBar->addAction(resetAct);
    9.  
    10. mouseToolBar = addToolBar(tr("Mouse"));
    11. mouseToolBar->addAction(mouseAct);
    12.  
    13. }
    To copy to clipboard, switch view to plain text mode 

    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
    Last edited by jpn; 29th January 2009 at 14:44. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: problem in adding toolbar

    As you can see from the documentation, addToolBar() is part of QMainWindow API. Please launch Qt Assistant and write "addToolBar" to the Index-tab.
    J-P Nurmi

  3. #3
    Join Date
    Jan 2009
    Posts
    33
    Qt products
    Qt4
    Platforms
    Windows
    Thanked 2 Times in 2 Posts

    Default Re: problem in adding toolbar

    yes,
    addToolbar is member of QMainwindow. i included that class in my header.
    i am not able to get what's the problem

  4. #4
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    11
    Thanked 16 Times in 16 Posts

    Default Re: problem in adding toolbar

    Quote Originally Posted by bhogasena View Post
    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()

Similar Threads

  1. Adding QGLWidget to QGraphicsScene problem
    By sanjayshelke in forum Qt Programming
    Replies: 10
    Last Post: 26th April 2016, 15:03
  2. QString - problem with adding strings
    By pitterb in forum Newbie
    Replies: 1
    Last Post: 13th January 2009, 20:03
  3. Mac OS ToolBar problem, (setUnifiedTitleAndToolBarOnMac)
    By s-valve in forum Qt-based Software
    Replies: 0
    Last Post: 7th November 2008, 13:52
  4. Adding a line edit in a toolbar
    By borges in forum Qt Tools
    Replies: 1
    Last Post: 16th August 2007, 15:33
  5. Adding a toolbar to a TableWidget
    By Walter in forum Qt Programming
    Replies: 2
    Last Post: 1st July 2007, 21:13

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
  •  
Qt is a trademark of The Qt Company.