Results 1 to 2 of 2

Thread: QwtDial label

  1. #1
    Join Date
    Dec 2012
    Posts
    1
    Qt products
    Platforms
    Windows

    Default QwtDial label

    Hi All,
    I am struggling to put a label onto a QwtDial. Ideally I would like to have both the units inside the dial and then a separate label outside saying what the dial is showing. Is this possible? I have searched for quite a while though I have very little experience with GUIs so I maybe missing something obvious!

    At the minute I have made a simple function that returns a dial object. Can anyone help with what to add to insert the labels I want?

    EDIT: I am using Python

    def create_dials(self, name, unit):

    dial = Qwt.QwtDial()

    dial.setWrapping(False)
    dial.setReadOnly(True)
    dial.setFixedSize(150,150)

    dial.setOrigin(135.0)
    dial.setScaleArc(0.0, 270.0)
    dial.setRange(0.0, 240.0)
    dial.setScale(-1, 2, 20)

    dial.setNeedle(Qwt.QwtDialSimpleNeedle(
    Qwt.QwtDialSimpleNeedle.Arrow,
    True,
    QColor(Qt.red),
    QColor(Qt.gray).light(130)))

    dial.setScaleOptions(Qwt.QwtDial.ScaleTicks | Qwt.QwtDial.ScaleLabel )
    dial.setScaleTicks(0, 4, 8)


    return dial

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

    Default Re: QwtDial label

    Well the python bindings are for Qwt 5.2, let's see:

    dial.setScale() calculates the scale ticks for you. When you need more control over the positions of the ticks you can assign them by dial.scaleDraw()->setScaleDiv().

    The mapping of the tick positions to labels is done in QwtDialScaleDraw::label(). If you need something different as the numbers ( or you want some labels with special colors/fonts ) it has to be overloaded for a different mapping.

    Ticks and label on the inner side of the scales are not possible. The reason for this limitation is simply that the code of the round scales is older than the dial class and was never extended.

    Uwe

Similar Threads

  1. QwtDial works slowly in QWS
    By simophin in forum Qwt
    Replies: 1
    Last Post: 19th July 2010, 08:00
  2. QWTDial problem
    By zaferaltug in forum Qwt
    Replies: 2
    Last Post: 20th November 2008, 16:40
  3. How Can I rewrite qwtDial Class
    By validator in forum Qwt
    Replies: 4
    Last Post: 21st February 2008, 07:25
  4. Can I Add two needle for QwtDial
    By validator in forum Qwt
    Replies: 4
    Last Post: 14th February 2008, 09:57
  5. QwtDial not exits
    By hiuao in forum Qwt
    Replies: 1
    Last Post: 23rd August 2007, 10:22

Tags for this Thread

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.