Results 1 to 7 of 7

Thread: Star Rating system in QLineEdit or simliar

  1. #1
    Join Date
    Jun 2012
    Posts
    38
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Star Rating system in QLineEdit or simliar

    Dear Qters,

    I am in the need of creating the Star Rating Widget and I was wondering how I should actually do it. I have looked at the star delegate example, which works for for QTableView and similar Widgets, but could I do something similar with a QLineEdit? Or are there better approaches?

    I would very much appreciate any advice and examples on how you would program such a feature.

    thanks in advance,

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Star Rating system in QLineEdit or simliar

    That sounds more like a case for a custom widget, e.g. based on QWidget or QFrame.

    Or you could just use the rating widget from the widget addons library: http://inqlude.org/libraries/kwidgetsaddons.html

    Cheers,
    _

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

    d_stranz (18th December 2015)

  4. #3
    Join Date
    Jun 2012
    Posts
    38
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Star Rating system in QLineEdit or simliar

    Thanks, I will take a look at the ratingWidget class. It needs to be editable so will see if it can be used.

    thanks for answering!

  5. #4
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Star Rating system in QLineEdit or simliar

    I think that the easiest way to do it would be using class inherited from QLabel. You will have a resource of you star bitmap and method that sets stars and prepare QPixmap created from one or more star bitmaps, then it is loaded by QLabel. It's as easy as that.

  6. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,719
    Thanks
    259
    Thanked 760 Times in 750 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Star Rating system in QLineEdit or simliar

    It's as easy as that.
    And that's pretty much what the KDE rating widget does. You can spend your time reinventing the wheel, or you can spend your time using the already-invented wheel to take you to new and interesting places.

  7. #6
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Star Rating system in QLineEdit or simliar

    You can spend your time reinventing the wheel
    As You can see on my website, reinventing the wheel is my hobby ;P

  8. #7
    Join Date
    Jun 2012
    Posts
    38
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Star Rating system in QLineEdit or simliar

    Thanks Guys!

    there is nothing wrong by reinventing the wheel from time to time ;-) who knows it might get rounder than before ;-)

Similar Threads

  1. Replies: 2
    Last Post: 14th November 2015, 02:15
  2. [Bug Report?] Star Delegate Example
    By juarez in forum General Discussion
    Replies: 0
    Last Post: 9th May 2013, 04:06
  3. Star Delegate Example
    By graciano in forum Qt Programming
    Replies: 5
    Last Post: 9th February 2010, 16:55
  4. how to make system calls to be displayed in QLineEdit
    By wagmare in forum Qt Programming
    Replies: 2
    Last Post: 10th November 2008, 06:08
  5. Replies: 5
    Last Post: 20th January 2006, 22:58

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.