コード例 #1
0
ファイル: DbPlugin.cpp プロジェクト: botvs/FinancialAnalytics
bool DbPlugin::open (QString &d, DBIndex *i)
{
  if (DBBase::open(d))
    return TRUE;

  chartIndex = i;

  QString s;
  DBIndexItem item;
  chartIndex->getIndexItem(indexKey, item);
  item.getType(s);
  type = getType(s);

  item.getPath(s);
  if (! s.length())
  {
    item.setPath(d);
    chartIndex->setIndexItem(indexKey, item);
  }

  return FALSE;
}
コード例 #2
0
void StocksDialog::createDetailsPage ()
{
    QWidget *w = new QWidget(this);

    Q3VBoxLayout *vbox = new Q3VBoxLayout(w);
    vbox->setMargin(5);
    vbox->setSpacing(5);

    Q3GridLayout *grid = new Q3GridLayout(vbox);
    grid->setMargin(0);
    grid->setSpacing(5);

    QLabel *label = new QLabel(tr("Symbol"), w);
    grid->addWidget(label, 0, 0);

    QString s;
    DBIndexItem item;
    index->getIndexItem(symbol, item);
    item.getSymbol(s);
    label = new QLabel(s, w);
    label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
    grid->addWidget(label, 0, 1);

    label = new QLabel(tr("Name"), w);
    grid->addWidget(label, 1, 0);

    item.getTitle(s);
    title = new QLineEdit(s, w);
    grid->addWidget(title, 1, 1);

    label = new QLabel(tr("Exchange"), w);
    grid->addWidget(label, 2, 0);

    item.getExchange(s);
    Exchange ex;
    ex.getExchange(s.toInt(), s);
    label = new QLabel(s, w);
    label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
    grid->addWidget(label, 2, 1);

    label = new QLabel(tr("Type"), w);
    grid->addWidget(label, 3, 0);

    item.getType(s);
    label = new QLabel(s, w);
    label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
    grid->addWidget(label, 3, 1);

    label = new QLabel(tr("First Date"), w);
    grid->addWidget(label, 4, 0);

    Bar bar;
    db->getFirstBar(bar);
    if (! bar.getEmptyFlag())
    {
        bar.getDateTimeString(TRUE, s);
        label = new QLabel(s, w);
        label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
        grid->addWidget(label, 4, 1);
    }

    label = new QLabel(tr("Last Date"), w);
    grid->addWidget(label, 5, 0);

    Bar bar2;
    db->getLastBar(bar2);
    if (! bar2.getEmptyFlag())
    {
        bar2.getDateTimeString(TRUE, s);
        label = new QLabel(s, w);
        label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
        grid->addWidget(label, 5, 1);
    }

    grid->expand(grid->numRows() + 1, grid->numCols());
    grid->setColStretch(1, 1);

    vbox->addStretch(1);

    addTab(w, tr("Details"));
}