Пример #1
0
void Filter::showLegend()
{
	if (!d_output_graph)
		return;

	LegendWidget* legend = d_output_graph->legend();
	LegendWidget* l = d_output_graph->newLegend(legendInfo());
	if (legend)
		l->move(QPoint(legend->x(), legend->y() + legend->height() + 20));
}
	foreach(QWidget *i, d_widgets){
		LegendWidget *l = qobject_cast<LegendWidget *>(i);
		if (!l){
			QRect r = operateOn(i->geometry());
			i->setGeometry(r);

			FrameWidget *f = qobject_cast<FrameWidget *>(i);
			if (f)
				f->updateCoordinates();
			continue;
		}

		QRect new_rect = operateOn(l->geometry());
		l->move(new_rect.topLeft());
		if (!l->text().isEmpty()){
            QFont f = l->font();
            f.setPointSize(f.pointSize() * new_rect.width() * new_rect.height()/(l->rect().width() * l->rect().height()));
            l->setFont(f);
            l->plot()->notifyFontChange(f);
		}
	}