Results 1 to 4 of 4

Thread: How to add label in speedometer

  1. #1
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question How to add label in speedometer

    Hi everyone,

    Currently I am designing a speedometer in Qt. I did read the example which come with Qwt installation package. However, I didn't create the this widget manually, but created it by dragging the Qwtdial widget into my dialog.

    Here is my code:
    Qt Code:
    1. ui->Dial->setScaleArc(0.0, 270.0);
    2. ui->Dial->scaleDraw()->setSpacing(1);
    3. ui->Dial->setScaleTicks(0, 2, 4);
    4. ui->Dial->setRange(0, 160);
    5. ui->Dial->setScale(1, 2, 20);
    6. QwtDialSimpleNeedle::Arrow, true, Qt::red,
    7. QColor(Qt::gray).light(130));
    8. ui->Dial->scaleDraw()->setPenWidth(1);
    9. ui->Dial->setNeedle(needle);
    To copy to clipboard, switch view to plain text mode 

    My question is how i can add label at the bottom of speedometer?

    In the example, it used
    Qt Code:
    1. SpeedoMeter::drawScaleContents(QPainter *painter,
    2. const QPoint &center, int radius) const
    To copy to clipboard, switch view to plain text mode 
    but i don't know how to use in my code.

    thanks in advance.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to add label in speedometer

    The code for the label in the speedometer is broken in Qwt 6.0.0 ( its a QPointF no QPoint ). Look at the code in SVN trunk.

    Uwe

  3. #3
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to add label in speedometer

    Hi Uwe,

    Thanks for your reply. I am using Qwt 5.2.1.
    Does the label code in this version is broken too?
    Can you give me any other hint please?

    Cheers
    Last edited by cooper; 1st August 2011 at 00:19.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to add label in speedometer

    Quote Originally Posted by cooper View Post
    Thanks for your reply. I am using Qwt 5.2.1.
    Does the label code in this version is broken too?
    No - but you can simply start the application to see if it works.
    Quote Originally Posted by cooper View Post
    Can you give me any other hint please?
    Not at all - the code shows you what to do in a couple of simple lines.

    Uwe

Similar Threads

  1. Internet Speedometer
    By dilidpan in forum Qt Programming
    Replies: 10
    Last Post: 23rd May 2010, 15:50
  2. Label over menubar
    By zgulser in forum Qt Tools
    Replies: 4
    Last Post: 19th January 2009, 14:43
  3. label as a QGraphicsItem
    By magland in forum Qt Programming
    Replies: 1
    Last Post: 29th December 2007, 17:24
  4. label
    By mickey in forum Qt Programming
    Replies: 10
    Last Post: 8th June 2006, 18:58
  5. tool tip for label
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 21st April 2006, 13:22

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.