Results 1 to 2 of 2

Thread: QwtScaleDraw class not working

  1. #1
    Join Date
    Aug 2015
    Location
    Prague
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QwtScaleDraw class not working

    Hello!

    I don't know why the code below is not working and I can't explain the way
    1) widget->setScaleDraw(new draw()); calls the class draw so that it doesn't setAlignment on the widget.
    I know two other ways to put it right such as
    2) widget->setAlignment(QwtScaleDraw::TopScale)
    3) widget->setScaleDraw(inst_draw = new draw());
    But im not interested in them. I would like to particularly know why the first option is not working and what I'm missing to know.Thank you a lot!

    class drawublic QwtScaleDraw{
    public:
    draw();
    };

    draw::draw(){this->setAlignment(QwtScaleDraw::TopScale);};

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    QwtScaleWidget* widget = new QwtScaleWidget;
    widget->setScaleDraw(new draw());
    widget->show();


    return a.exec();
    }

  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: QwtScaleDraw class not working

    Qwt is open source - looking at the code of QwtScaleWidget::setScaleDraw() and you will see immediately why the line in the constructor of draw doesn't have any effect.

    Uwe

Similar Threads

  1. Replies: 5
    Last Post: 27th July 2015, 09:44
  2. Replies: 1
    Last Post: 25th June 2014, 18:46
  3. Replies: 2
    Last Post: 16th September 2013, 10:57
  4. Is QWebView class working in Qt 5.0.0? Please HELP
    By vakhobiz in forum Qt Programming
    Replies: 0
    Last Post: 15th September 2012, 14:08
  5. Replies: 2
    Last Post: 14th September 2011, 07:53

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.