Results 1 to 2 of 2

Thread: How to set the same width axesLabels of 2 QwtPlot

  1. #1
    Join Date
    Jul 2012
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default How to set the same width axesLabels of 2 QwtPlot

    Hi)I use qwt-6.0.1. For example, I have 2 QwtPlot which one of them situated above the one. The yAxis of the first one belong to [0,1] and the second one belong to [1000, 9999999]. That's why, the canvases of QwtPlots don't situate smoothly. I see the example "plotmatrix" which demonstrate this problem. But it is too hard to understand how to solve it. Please, could you show the simple example how to solve it , for instance. for yLeft axes and explain the plan how to do it.Please, help.

  2. #2
    Join Date
    Jul 2012
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to set the same width axesLabels of 2 QwtPlot

    I have solved this problem without axisTitle. The decision is(I have taken it from "plotmatrix" example)
    void PlotMatrix::alignVAxes(int col, int axis)
    {
    if ( axis != QwtPlot::yLeft && axis != QwtPlot::yRight )
    return;

    int maxExtent = 0;
    for ( int row = 0; row < numRows(); row++ )
    {
    QwtPlot *p = plot(row, col);
    if ( p )
    {
    QwtScaleWidget *scaleWidget = p->axisWidget(axis);

    QwtScaleDraw *sd = scaleWidget->scaleDraw();
    sd->setMinimumExtent(0);

    const int extent = sd->extent(
    QPen(Qt::black, scaleWidget->penWidth()),
    scaleWidget->font() );
    if ( extent > maxExtent )
    maxExtent = extent;
    }
    }
    for ( int row = 0; row < numRows(); row++ )
    {
    QwtPlot *p = plot(row, col);
    if ( p )
    {
    QwtScaleWidget *scaleWidget = p->axisWidget(axis);
    scaleWidget->scaleDraw()->setMinimumExtent(maxExtent);
    }
    }
    }

Similar Threads

  1. Replies: 9
    Last Post: 25th October 2012, 19:55
  2. Replies: 1
    Last Post: 17th May 2012, 17:18
  3. QToolBox width fixed to maximum content width
    By ghorwin in forum Qt Programming
    Replies: 0
    Last Post: 10th July 2009, 09:58
  4. Replies: 6
    Last Post: 14th May 2009, 12:02
  5. How to set QTableView width to width of horizontal header?
    By martinb0820 in forum Qt Programming
    Replies: 0
    Last Post: 2nd December 2008, 20:51

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.