Results 1 to 5 of 5

Thread: Can I layout widgets by using StyleSheet?

  1. #1
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question Can I layout widgets by using StyleSheet?

    So,Can I use stylesheet to layout my widgets?
    For example,I want myFrame(QFrame) set to x:30px,y:30px.And I also want to set the width&height.In this way,people can theme my app by themselves.

    But I think it's probably not possible...I need verification.
    It's not the goodbye that hurts,but the flashback that follow.

  2. #2
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can I layout widgets by using StyleSheet?

    I finally figure it out myself.
    for somebody who wants to know how,see the stylesheet below:
    Qt Code:
    1. background: url(:/Pics/TitleBG.png) no-repeat;
    2. qproperty-geometry:rect(0 0 252 35);
    3. }
    To copy to clipboard, switch view to plain text mode 

    set the qproperty-geometry to be rect(x,y,width,height).
    It's not the goodbye that hurts,but the flashback that follow.

  3. #3
    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: Can I layout widgets by using StyleSheet?

    I am not sure what application you are doing, but please don't layout your widgets manualy. Use layouts for that! They are much better than manual layout!!! See QHBoxLayout for example and make yourself familiar with the layout concept of Qt...

  4. #4
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can I layout widgets by using StyleSheet?

    Yeah,I know Layout is good.But the interface of the app I'm building is not so complex.And if I manualy layout my widgets,I can use stylesheet to theme my app better.
    It's not the goodbye that hurts,but the flashback that follow.

  5. #5
    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: Can I layout widgets by using StyleSheet?

    Maybe you want to use QML (or Qt Quick)

Similar Threads

  1. Replies: 7
    Last Post: 12th January 2011, 22:01
  2. Replies: 5
    Last Post: 18th April 2010, 23:31
  3. Remove widgets in a Layout
    By jayreddy in forum Qt Programming
    Replies: 2
    Last Post: 4th December 2009, 10:21
  4. Widgets Layout in a QToolBar.
    By cydside in forum Qt Programming
    Replies: 1
    Last Post: 27th June 2009, 08:46
  5. Custom widgets in layout
    By Palmik in forum Newbie
    Replies: 11
    Last Post: 26th January 2009, 12:08

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.