Hi there,
I'm playing with multiple plots in a grid (following tutorial here http://www.qcustomplot.com/documentation/thelayoutsystem.html), but I can't seem to clear the default AxisRect to begin with. It works fine on Linux and Mac, but crashes on Windows. Also, no luck using plotLayout()->remove(plotLayout->element(0,0)), which also crashes. As a definite, simple example:
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->widget->plotLayout()->clear(); } MainWindow::~MainWindow() { delete ui; }
mainwindow.ui
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>400</width> <height>300</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralWidget"> <widget class="QCustomPlot" name="widget" native="true"> <property name="geometry"> <rect> <x>9</x> <y>9</y> <width>371</width> <height>221</height> </rect> </property> </widget> </widget> <widget class="QMenuBar" name="menuBar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>400</width> <height>21</height> </rect> </property> </widget> <widget class="QToolBar" name="mainToolBar"> <attribute name="toolBarArea"> <enum>TopToolBarArea</enum> </attribute> <attribute name="toolBarBreak"> <bool>false</bool> </attribute> </widget> <widget class="QStatusBar" name="statusBar"/> </widget> <layoutdefault spacing="6" margin="11"/> <customwidgets> <customwidget> <class>QCustomPlot</class> <extends>QWidget</extends> <header>qcustomplot.h</header> <container>1</container> </customwidget> </customwidgets> <resources/> <connections/> </ui>
Anyone come across this before?