示例#1
0
void
PlotWidget::addPlot (QString plugin, int row, QString name)
{
  PluginFactory fac;
  Plugin *plug = fac.load(plugin);
  if (! plug)
    return;

  PluginData pd;
  pd.command = QString("settings");
  if (! plug->command(&pd))
    return;
  
  Entity *settings = pd.settings;
  settings->setName(name);
  
  _settings.insert(name, settings);
  
  addPlotSettings(settings);

  QVariant *tset = settings->get(QString("row"));
  if (tset)
    tset->setValue(row);

  Plot *plot = new Plot(name, 0);
  plot->setMinimumHeight(30);
  _plots.insert(name, plot);
  
  _csplitter->insertWidget(row, plot);

  plot->setStartIndex(_cw->scrollBarValue());
  
  // connect all we need here
  connect(plot, SIGNAL(signalResizeScrollBar(Plot *)), _cw, SLOT(resizeScrollBar(Plot *)));
  connect(this, SIGNAL(signalClear()), plot, SLOT(clear()));
  connect(this, SIGNAL(signalDraw()), plot, SLOT(updatePlot()));
  connect(this, SIGNAL(signalSetDates()), plot, SLOT(setDates()));
  connect(this, SIGNAL(signalBarLength(int)), plot, SLOT(setBarLength(int)));
  connect(this, SIGNAL(signalIndex(int)), plot, SLOT(setStartIndex(int)));
  connect(plot, SIGNAL(signalMessage(QString)), this, SIGNAL(signalMessage(QString)));
  connect(plot, SIGNAL(signalDeleteMarkers(QStringList)), this, SLOT(deleteMarkers(QStringList)));
}
示例#2
0
void PlotWidget::addPlot (QString plugin, int row, QString name)
{
  qWarning() << "PlotWidget::addPlot - " << name;
  IIndicatorPlugin *plug = dynamic_cast<IIndicatorPlugin*>(((PluginFactory*)PluginFactory::getPluginFactory())->loadPlugin(plugin));
  if (! plug)
    return;

  Entity *settings = plug->querySettings();

  settings->setName(name);
  _settings.insert(name, settings);
  
  addPlotSettings(settings);

  QVariant *tset = settings->get(QString("row"));
  if (tset)
    tset->setValue(row);

  Plot *plot = new Plot(name, 0);
  plot->setMinimumHeight(30);

  _plots.insert(name, plot);
  _csplitter->insertWidget(row, plot);

  plot->setStartIndex(_controlWidget->scrollBarValue());

  // connect all we need here
  connect(plot, SIGNAL(signalResizePanScrollBar(Plot *)), _controlWidget, SLOT(resizePanScrollBar(Plot *)));
  connect(this, SIGNAL(signalClear()), plot, SLOT(clear()));
  connect(this, SIGNAL(signalDraw()), plot, SLOT(updatePlot()));
  connect(this, SIGNAL(signalSetDates()), plot, SLOT(setDates()));
  connect(this, SIGNAL(signalBarLength(int)), plot, SLOT(setBarLength(int)));
  connect(this, SIGNAL(signalIndex(int)), plot, SLOT(setStartIndex(int)));
  connect(plot, SIGNAL(signalMessage(QString)), this, SIGNAL(signalMessage(QString)));
  connect(plot, SIGNAL(signalDeleteMarkers(QStringList)), this, SLOT(deleteMarkers(QStringList)));
  connect(_controlWidget, SIGNAL(signalRange(int)), plot, SLOT(setPage(int)));

}