Results 1 to 3 of 3

Thread: Adding a toolbar to a TableWidget

  1. #1
    Join Date
    Jun 2007
    Location
    Austria (Europe)
    Posts
    31
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Adding a toolbar to a TableWidget

    Hi,

    this is my first post on this forum. I'm a complete newbie to Qt so please forgive alle silly questions

    How can I add a toolbar to a QTableWidget?

    On my QMainWindow I used something like
    Qt Code:
    1. toolbar = new QToolBar( this );
    2. addToolBar( Qt::TopToolBarArea, toolbar );
    To copy to clipboard, switch view to plain text mode 

    but now I want to create a TableWidget as a main window and need a toolbar. QTableWidget has no addToolBar() so do I have to make a QMainWindow containing a QTableWidget and a QToolBar or is there another way?

    Thanks in advance...

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

    Default Re: Adding a toolbar to a TableWidget

    Quote Originally Posted by Walter View Post
    do I have to make a QMainWindow containing a QTableWidget and a QToolBar or is there another way?
    Yes, this is the way to go. Still if any Qt widget can be made a top level widget (aka. window), only QMainWindow provides functionality such as menus, toolbars and dock widgets. You might want to set the QTableWidget as a central widget of the QMainWindow, see QMainWindow::setCentralWidget() for more details.
    J-P Nurmi

  3. #3
    Join Date
    Jun 2007
    Location
    Austria (Europe)
    Posts
    31
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Adding a toolbar to a TableWidget

    Thank you very much!

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.