QCustomPlot - показать элемент на QCPAxisRect ниже customPlot

В проекте, напоминающемфинансовая демонстрация QCustomPlot Я хочу нарисовать QCPItemRect не только в области графика, но и в области ниже графика.

имеющий

QCPAxisRect *   xRect = new QCPAxisRect( this->ui.customPlot )
...
this->ui.customPlot->plotLayout()->addElement(1, 0, xRect);          

Я хочу добавить QCPItemRect как

QCPItemRect *    xItem = new QCPItemRect( this->ui.customPlot );
                 xItem -> setPen   ( QPen ( Qt::black ));

                 xItem -> bottomRight ->setAxisRect( this->xRect );
                 xItem -> topLeft     ->setAxisRect( this->xRect );

                 xItem -> bottomRight ->setCoords(x - 2.0, y - 2.0);
                 xItem -> topLeft     ->setCoords(x + 2.0, y + 2.0);

                 this->ui.customPlot->addItem( xItem );

Тем не менее, прямоугольник по-прежнему рисуется наthis->ui.customPlot в отличие отthis->xRect, Зачем?

Любая помощь очень ценится, Даниэль

ОБНОВИТЬ Сам нашел часть ответа, одна недостающая строка кода

xItem -> setClipAxisRect( xRect )

До сих пор работает только с некоторыми QCPAxisRects.

ОБНОВЛЕНИЕ 2 Все еще не там. Ниже приведен самый маленький фрагмент кода, который воспроизводит поведение - этого достаточно, чтобы вставить его в пустой проект QCustomPlot:

// create a rectAxis, put it below the main plot
QCPAxisRect *   xRect = new QCPAxisRect( this->ui.customPlot );
                this->ui.customPlot->plotLayout()->addElement( 1, 0, xRect );

// create a rectItem and show it on the xRect    
QCPItemRect *   xRectItem = new QCPItemRect( this->ui.customPlot );

                xRectItem->setVisible          (true);
                xRectItem->setPen              (QPen(Qt::transparent));
                xRectItem->setBrush            (QBrush(Qt::lightGray));

                xRectItem->topLeft     ->setType(QCPItemPosition::ptPlotCoords);
                xRectItem->topLeft     ->setAxisRect( xRect );
                xRectItem->topLeft     ->setCoords( 1, 4 );

                xRectItem->bottomRight ->setType(QCPItemPosition::ptPlotCoords);
                xRectItem->bottomRight ->setAxisRect( xRect );
                xRectItem->bottomRight ->setCoords( 2, 1 );

                xRectItem->setClipAxisRect     ( xRect );
                xRectItem->setClipToAxisRect   ( false );       // XXX

                this->ui.customPlot->replot();[/code]

Поведение зависит от того, закомментирована ли строка «XXX» или нет

строка закомментирована - прямоугольник не появляется ВСЕ.линия слева - прямоугольник вытягивается в основной прямоугольник, например, как показаноВот.

Любой намек очень ценится, Даниэль

Ответы на вопрос(1)

Ваш ответ на вопрос