Results 1 to 6 of 6

Thread: How do I create a toolbar like QT Creator's toolbar?

  1. #1
    Join Date
    Sep 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How do I create a toolbar like QT Creator's toolbar?

    Fellow QT users,

    I am new to QT and I am in the process of creating my first QT application. As part of this application, I would like to create a toolbar similar to the toolbar that is located on the left hand side of QT Creator (it's the one that has buttons for "Edit", "Design", "Debug", etc.).

    Would someone please tell me how this is done, or point me to where this is done in the source code for QT Creator?

    Thank you very much.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How do I create a toolbar like QT Creator's toolbar?


  3. #3
    Join Date
    Sep 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How do I create a toolbar like QT Creator's toolbar?

    Lykurg,

    Thank you for your reply.

    What I see at http://qt.gitorious.org/qt-creator/q...r/trees/master appears to be
    the entire source tree for Qt Creator. Could you be more specific as to where to
    look for the Qt Creator toolbar? I have qt-creator-2.0.1-src. Which file(s) should
    I look at?

    Thank you.

    Steve

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How do I create a toolbar like QT Creator's toolbar?

    The base of a Qt Creator toolbar is in src/libs/utils/styledbar
    To get the same graphics, you need to copy the toolbar painting code from the manhattan style too.

    In src/plugins/coreplugin you have in implementation in the editortoolbar

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How do I create a toolbar like QT Creator's toolbar?

    If you don't like to go through the sources you can achieve a look a like very simple:
    • Subclass QDockWidget and reimp the paint event where you draw your desired background if you need a gradient. Otherwise simply set a custom palette to it.
    • Subclass a QPushButton where you also do your custom background painting for normal state and selected state. the rest is done by the default implementation.


    Voila!

  6. #6
    Join Date
    Sep 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How do I create a toolbar like QT Creator's toolbar?

    Lykurg, tbscope,

    Thank you for your replies. I'm on my way to creating my first StyledBar.

    Steve

Similar Threads

  1. how to create internet explorer toolbar using Qt?
    By live_07 in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2011, 07:28
  2. Replies: 0
    Last Post: 12th January 2010, 18:27
  3. Replies: 20
    Last Post: 22nd October 2009, 01:22
  4. Toolbar
    By assismvla in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2008, 17:42
  5. Create a Toolbar on a Subclassed Textedit?
    By c_07 in forum Qt Programming
    Replies: 5
    Last Post: 12th October 2007, 18:17

Tags for this Thread

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.