Results 1 to 2 of 2

Thread: Problem in changing the tracker font size

  1. #1
    Join Date
    Oct 2009
    Posts
    13
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Problem in changing the tracker font size

    Hi all,

    I have a 2D plot and I want to change the font size used by the tracker pen.

    My code is:

    Qt Code:
    1. if (zoomer != NULL)
    2. delete zoomer;
    3.  
    4. zoomer = new QwtPlotZoomer(qwtPlot->canvas());
    5.  
    6. zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton);
    7. zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
    8.  
    9. const QColor c(Qt::white);
    10. zoomer->setTrackerMode(QwtPicker::AlwaysOn);
    11. zoomer->setRubberBandPen(c);
    12. zoomer->setTrackerPen(c);
    13. QFont qf=zoomer->trackerFont();
    14. zoomer->setTrackerFont(QFont(qf.family(),18,qf.weight(), qf.italic()));
    To copy to clipboard, switch view to plain text mode 

    Even if the code is compiled without errors or warnings the font size of tracker pen is not changed at all in the plot (the default size is 10)! The color instead is set properly.

    Thank you in advance for your help!

    Bye

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

    Default Re: Problem in changing the tracker font size

    Indeed setTrackerFont doesn't work.

    But what you can do is to assign the font to the plot canvas ( the font of the tracker text widget is initialized with it ) before you attach your zoomer.

    Another option is to overload the trackerText method and add the font to the QwtText object.

    Uwe

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

    gd (9th December 2009)

Similar Threads

  1. PDF Printer doesn't use font size
    By gruszczy in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2009, 20:39
  2. Replies: 3
    Last Post: 29th December 2008, 16:54
  3. Replies: 1
    Last Post: 25th December 2007, 10:35
  4. Font size calculation when painting in a QImage
    By Ishark in forum Qt Programming
    Replies: 3
    Last Post: 15th July 2007, 22:22
  5. Font Problem
    By prakash in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 16:53

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.