Results 1 to 7 of 7

Thread: QToolButton + style sheet problem

  1. #1
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb QToolButton + style sheet problem

    Does anyone know if this is correct?

    Qt Code:
    1. tb = new QToolButton (_viewGroup);
    2. tb->setText ("Trial");
    3. tb->setFixedWidth (150);
    4. tb->setFixedHeight (40);
    5. tb->setArrowType (Qt::DownArrow);
    6. tb->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    7.  
    8. // This section here ???
    9. tb->setStyleSheet ("down-arrow: subcontrol-position: right center");
    To copy to clipboard, switch view to plain text mode 

    I want to move the arrow to the right

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QToolButton + style sheet problem

    I dont know.. but if it works, it might be right

  3. #3
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QToolButton + style sheet problem

    Quote Originally Posted by aamer4yu View Post
    I dont know.. but if it works, it might be right
    uhm it doesn't work. Sorry if the wording on my post was wrong. But I want to know how to use that function call to move the "arrow" in a QToolButton to the right side of the button.

  4. #4
    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: QToolButton + style sheet problem

    Quote Originally Posted by John82 View Post
    [CODE]tb->setStyleSheet ("down-arrow: subcontrol-position: right center");[/CODE
    You should take a closer look at the syntax of css. I don't have checked if your commands work but one right syntax is:
    css Code:
    1. QToolButton::down-arrow{subcontrol-position: right center;}
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QToolButton + style sheet problem

    Quote Originally Posted by Lykurg View Post
    You should take a closer look at the syntax of css. I don't have checked if your commands work but one right syntax is:
    css Code:
    1. QToolButton::down-arrow{subcontrol-position: right center;}
    To copy to clipboard, switch view to plain text mode 
    I tried this. I wrote the above line in a .qss file and read it. But it didnt work, that is why I am am looking for a direct implementation.

  6. #6
    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: QToolButton + style sheet problem

    Quote Originally Posted by John82 View Post
    I tried this. I wrote the above line in a .qss file and read it. But it didnt work, that is why I am am looking for a direct implementation.
    Did you mean by "direct implementation" setting the qss on the toolbutton? If so, that makes no difference and also there you have to respect the css syntax:
    Qt Code:
    1. tb->setStyleSheet ("::down-arrow {subcontrol-position: right center}");
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Aug 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QToolButton + style sheet problem

    Si necesitas estilizar y/o quieres controlar la flecha hacia abajo de los botones QToolButton de un QToolBar, es posible que tengas problemas cuando los creas a partir de QAction. La manera de acceder a ello es utilizando QToolButton::menu-arrow {...} o QToolButton::menu-button {...}

    Si tu tienes una barra de navegación la puedes nombrar barra->setObjectName("miBarra");
    Y puedes controlar su flecha abajo con #miBarra QToolButton::menu-arrow {...} o #miBarra QToolButton::menu-button {...}

Similar Threads

  1. qt 4 color palette / style sheet question
    By killerwookie99 in forum Qt Programming
    Replies: 1
    Last Post: 7th November 2008, 00:05
  2. [Qt 4.3.1]A problem with combobox style
    By Tamara in forum Qt Programming
    Replies: 3
    Last Post: 19th September 2007, 11:49
  3. QToolBox qss style sheet problem
    By eskil in forum Qt Programming
    Replies: 1
    Last Post: 17th August 2007, 18:45
  4. Qt 4.3 Style sheet, new features
    By Angelo Moriconi in forum Qt Programming
    Replies: 2
    Last Post: 12th June 2007, 16:22
  5. Problem with qtoolbutton
    By moowy in forum Qt Programming
    Replies: 1
    Last Post: 22nd September 2006, 14:30

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.