Results 1 to 7 of 7

Thread: Tool bar as photoshop, where only one is selected.

  1. #1
    Join Date
    Apr 2009
    Posts
    132
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    67
    Thanked 6 Times in 5 Posts

    Default Tool bar as photoshop, where only one is selected.

    Hi friends!

    Is there any easy way to create a tool bar with checkeable actions where only one action may be selected at once?
    I'm trying to use toggled signals, but my code looks ugly and difficult.

    Any suggestion/idea?

    Thanks in advance.

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

    Default Re: Tool bar as photoshop, where only one is selected.

    Simply use setAutoExclusive().

  3. The following user says thank you to Lykurg for this useful post:

    ricardo (23rd June 2009)

  4. #3
    Join Date
    Apr 2009
    Posts
    132
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    67
    Thanked 6 Times in 5 Posts

    Default Re: Tool bar as photoshop, where only one is selected.

    Quote Originally Posted by Lykurg View Post
    Simply use setAutoExclusive().
    Yes, you are right, after reading the docs, it seems that is what I'm looking for.
    Just one question, can I use Designer or must I do that by code?

    Thanks.

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

    Default Re: Tool bar as photoshop, where only one is selected.

    Quote Originally Posted by ricardo View Post
    can I use Designer
    Yes, of course, look at the property editor!

  6. The following user says thank you to Lykurg for this useful post:

    ricardo (23rd June 2009)

  7. #5
    Join Date
    Apr 2009
    Posts
    132
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    67
    Thanked 6 Times in 5 Posts

    Default Re: Tool bar as photoshop, where only one is selected.

    Perhaps you are wrong about Qt Designer. I've been looking for setAutoExclusive on QAtions and QToolBar but there is nothing at property editor.

    I guess I have to create by code a QActionGropu and add actions, and after that, add it to a tool bar (no idea how to)

    Another question is: Why this code does not delete/destroy alignmentGroup variable?
    http://doc.trolltech.com/4.1/mainwin...indow-cpp.html

    What do you think Lykurg? By the way, thanks a lot, you are very helpful.

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

    Default Re: Tool bar as photoshop, where only one is selected.

    Quote Originally Posted by ricardo View Post
    Perhaps you are wrong about Qt Designer. I've been looking for setAutoExclusive on QAtions and QToolBar but there is nothing at property editor.
    I guess I have to create by code a QActionGropu and add actions, and after that, add it to a tool bar (no idea how to)
    Ah, ok, I was wrong. It is only displayed as an action not as the tool button, which it is in fact. So you have it to do in your code. But simply create a QToolButton, add the action, set autoExclusive and add the button to the toolbar. should work without a action group (when you don't have other "normal" actions inside the toolbar), it does at least work inside a QFrame.

    Another question is: Why this code does not delete/destroy alignmentGroup variable?
    http://doc.trolltech.com/4.1/mainwin...indow-cpp.html
    Because the parent deletes it by itself, if it gets destroyed.

  9. The following user says thank you to Lykurg for this useful post:

    ricardo (23rd June 2009)

  10. #7
    Join Date
    Apr 2009
    Posts
    132
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    67
    Thanked 6 Times in 5 Posts

    Default Re: Tool bar as photoshop, where only one is selected.

    Thaks, useful.

Similar Threads

  1. Grouping of Tool buttons in Tool bar
    By febil in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2009, 12:51
  2. How to get parent of selected item in TreeView?
    By RavenS in forum Qt Programming
    Replies: 2
    Last Post: 7th March 2009, 14:27
  3. Tool for web application?
    By cool_qt in forum General Programming
    Replies: 3
    Last Post: 9th December 2008, 10:21
  4. tool buttons on top of label
    By McKee in forum Qt Programming
    Replies: 5
    Last Post: 2nd November 2008, 17:07
  5. deleting selected headers
    By ru_core in forum Qt Programming
    Replies: 3
    Last Post: 16th April 2008, 08:53

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.