void MainWindow::setupLayoutTest(QCustomPlot *customPlot)
{

	QCPLayoutGrid *mainLayout = customPlot->plotLayout();
	mainLayout->removeAt(0);
	// create 3x3 grid:
	mainLayout->addElement(0, 0, new QCPAxisRect(customPlot));
	mainLayout->addElement(0, 1, new QCPAxisRect(customPlot));
	mainLayout->addElement(0, 2, new QCPAxisRect(customPlot));
	mainLayout->addElement(1, 0, new QCPAxisRect(customPlot));
	mainLayout->addElement(1, 1, new QCPAxisRect(customPlot));
	mainLayout->addElement(1, 2, new QCPAxisRect(customPlot));
	mainLayout->addElement(2, 0, new QCPAxisRect(customPlot));
	mainLayout->addElement(2, 1, new QCPAxisRect(customPlot));
	mainLayout->addElement(2, 2, new QCPAxisRect(customPlot));
	QList<QCPAxisRect*> rlist;
	for (int i=0; i<mainLayout->elementCount(); ++i)
	{
		rlist << qobject_cast<QCPAxisRect*>(mainLayout->elementAt(i));
		rlist.last()->addAxes(QCPAxis::atLeft|QCPAxis::atRight|QCPAxis::atTop|QCPAxis::atBottom);
	}

	mainLayout->setColumnStretchFactors(QList<double>() << 1 << 2 << 1);
	mainLayout->setRowStretchFactors(QList<double>() << 1 << 2 << 3);

	mainLayout->element(0, 0)->setMinimumSize(200, 100);
	mainLayout->element(0, 1)->setMaximumSize(150, 100);
	mainLayout->element(2, 2)->setMinimumSize(100, 100);


	/*
	customPlot->setFont(QFont(customPlot->font().family(), 7));
	customPlot->axisRect(0)->axis(QCPAxis::atRight)->setTickLabels(true);
	customPlot->axisRect(0)->axis(QCPAxis::atTop)->setTickLabels(true);
	customPlot->axisRect(0)->axis(QCPAxis::atLeft)->setTickLabelFont(customPlot->font());
	customPlot->axisRect(0)->axis(QCPAxis::atRight)->setTickLabelFont(customPlot->font());
	customPlot->axisRect(0)->axis(QCPAxis::atTop)->setTickLabelFont(customPlot->font());
	customPlot->axisRect(0)->axis(QCPAxis::atBottom)->setTickLabelFont(customPlot->font());

	QCPLayoutGrid *layout = customPlot->plotLayout();
	layout->setRowSpacing(8);
	layout->setColumnSpacing(8);
	layout->addElement(0, 1, new QCPAxisRect(customPlot));
	layout->addElement(1, 0, new QCPAxisRect(customPlot));

	QCPLayoutGrid *subLayout = new QCPLayoutGrid;
	subLayout->addElement(0, 0, new QCPAxisRect(customPlot));
	subLayout->addElement(0, 1, new QCPAxisRect(customPlot));
	subLayout->setColumnStretchFactor(0, 0.7);
	layout->addElement(1, 1, subLayout);

	QList<QCPAxisRect*> rects = customPlot->axisRects();
	for (int i=0; i<rects.size(); ++i)
	{
	rects.at(i)->addAxes(QCPAxis::atLeft|QCPAxis::atRight|QCPAxis::atTop|QCPAxis::atBottom);
	rects.at(i)->axis(QCPAxis::atLeft)->grid()->setVisible(true);
	rects.at(i)->axis(QCPAxis::atBottom)->grid()->setVisible(true);
	}

	QCPCurve *c = new QCPCurve(customPlot->xAxis, customPlot->yAxis);
	customPlot->addPlottable(c);

	QCPCurveDataMap *d1 = new QCPCurveDataMap;
	d1->insert(0, QCPCurveData(0, 2, 1));
	d1->insert(1, QCPCurveData(1, 3, 2));
	d1->insert(2, QCPCurveData(2, 6, 4));

	c->clearData();
	c->setData(d1, false);

	QCPCurveDataMap *d2 = new QCPCurveDataMap;
	d2->insert(0, QCPCurveData(0, 26, 14));
	d2->insert(2, QCPCurveData(2, 31, 22));
	d2->insert(4, QCPCurveData(4, 61, 42));

	c->clearData();
	c->setData(d2, false);

	customPlot->replot();
	*/

	/*
	QCPLayoutGrid *topLayout = customPlot->plotLayout();
	QList<QCPAxisRect*> rects;
	for (int i=0; i<5; ++i)
	rects << new QCPAxisRect(customPlot);

	for (int i=0; i<rects.size(); ++i)
	{
	topLayout->addElement(0, i+1, rects.at(i));
	rects.at(i)->addAxis(QCPAxis::atLeft);
	rects.at(i)->addAxis(QCPAxis::atRight);
	rects.at(i)->addAxis(QCPAxis::atBottom);
	rects.at(i)->addAxis(QCPAxis::atTop);
	for (int k=0; k<rects.at(i)->axes().size(); ++k)
	{
	QCPAxis *ax = rects.at(i)->axes().at(k);
	ax->setTicks(false);
	ax->setTickLabels(false);
	ax->grid()->setVisible(false);
	}
	rects.at(i)->setAutoMargins(QCP::msNone);
	rects.at(i)->setMargins(QMargins(1, 1, 1, 1));
	}

	topLayout->setColumnStretchFactors(QList<double>() << 1 << 1e9 << 1e7 << 1e9 << 1e3 << 1e1);
	rects.at(0)->setMaximumSize(300, QWIDGETSIZE_MAX);
	rects.at(1)->setMaximumSize(250, QWIDGETSIZE_MAX);
	rects.at(2)->setMinimumSize(200, 0);
	rects.at(3)->setMaximumSize(150, QWIDGETSIZE_MAX);
	rects.at(4)->setMaximumSize(100, QWIDGETSIZE_MAX);

	QCPLayoutGrid *subLayout = new QCPLayoutGrid;
	topLayout->addElement(1, 3, subLayout);
	QCPAxisRect *r0 = new QCPAxisRect(customPlot);
	subLayout->addElement(0, 0, r0);
	r0->addAxes(QCPAxis::atLeft|QCPAxis::atRight|QCPAxis::atTop|QCPAxis::atBottom);
	QCPAxisRect *r1 = new QCPAxisRect(customPlot);
	subLayout->addElement(0, 1, r1);
	r1->addAxes(QCPAxis::atLeft|QCPAxis::atRight|QCPAxis::atTop|QCPAxis::atBottom);
	r1->setMaximumSize(200, QWIDGETSIZE_MAX);*/
}