Results 1 to 9 of 9

Thread: Reimplementing a Widgets Look

  1. #1
    Join Date
    Dec 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Reimplementing a Widgets Look

    Hi
    I'm making an application for a small black and white screen and need to change the appearance of the scroll bar in a listwidget. If I reimplement QScrollbar and modify its paint event is there a way to make the list widget use this reimplemented scrollbar? Or is there a better way of achieving this?
    Thanks

  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: Reimplementing a Widgets Look

    If I reimplement QScrollbar and modify its paint event is there a way to make the list widget use this reimplemented scrollbar?
    Why not ? It will be a new widget and you can use it.
    Or is there a better way of achieving this?
    Try stylesheets. It will be easier. You can get examples from the docs under Qt StyleSheets

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

    Stobie (10th January 2010)

  4. #3
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Reimplementing a Widgets Look

    Subclass QStyle and set the new style in your QApplication using QApplication::setStyle.
    It's nice to be important but it's more important to be nice.

  5. The following user says thank you to axeljaeger for this useful post:

    Stobie (10th January 2010)

  6. #4
    Join Date
    Dec 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Reimplementing a Widgets Look

    thanks guys, I got it to look the way I wanted using style sheets. I'm using a stripped down version of Qt though and when I try to make it there it says QApplication has no member named setStyleSheet(). Do you know what needs to be included when configuring Qt to include setStyleSheet() ?

  7. #5
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Reimplementing a Widgets Look

    There is definitely such a method in QApplication.
    It's nice to be important but it's more important to be nice.

  8. #6
    Join Date
    Dec 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Reimplementing a Widgets Look

    Don't worry, I got it. When I was configuring I added -no-scripttools which meant qapplication didnt have the method. I reconfigured without that option and It's fine now. Thanks again for your help.

  9. #7
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Reimplementing a Widgets Look

    -no-scripttools should have nothing to do with stylesheets. Scripttools are the debugger for the QScript-engine.
    It's nice to be important but it's more important to be nice.

  10. #8
    Join Date
    Dec 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Reimplementing a Widgets Look

    Ok, I think I made a mistake and actually included everything when I thought I just removed -no-scriptools because somehow the qconfig file I was using had all of its content deleted. There is something I'm not including in the configuration though which means I can't use setStyleSheet, do you have any idea what that might be?

  11. #9
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Reimplementing a Widgets Look

    From the header of QApplication, I see that there is a define:
    QT_NO_STYLE_STYLESHEET
    It's nice to be important but it's more important to be nice.

Similar Threads

  1. Replies: 1
    Last Post: 17th February 2009, 16:55
  2. Reimplementing QApplication::notify( )
    By Rayven in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2008, 17:22
  3. Reimplementing QApplication::notify()
    By Doug Broadwell in forum Qt Programming
    Replies: 5
    Last Post: 21st June 2007, 21:41
  4. Reimplementing QApplication::notify()
    By Doug Broadwell in forum Newbie
    Replies: 3
    Last Post: 13th June 2007, 07:53
  5. Qt4/Win32 - Reimplementing Copy
    By gesslar in forum Qt Programming
    Replies: 1
    Last Post: 22nd March 2006, 05:32

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.