当前位置: 首页>>代码示例>>C++>>正文


C++ Q3PtrList::at方法代码示例

本文整理汇总了C++中Q3PtrList::at方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrList::at方法的具体用法?C++ Q3PtrList::at怎么用?C++ Q3PtrList::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Q3PtrList的用法示例。


在下文中一共展示了Q3PtrList::at方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getSINWAV

PlotLine * SINWAV::calculateCustom (QString &, Q3PtrList<PlotLine> &)
{
  Q3PtrList<PlotLine> pll;
  pll.setAutoDelete(FALSE);
  getSINWAV(pll);
  pll.remove(1);
  return pll.at(0);
}
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:8,代码来源:SINWAV.cpp

示例2: QCOMPARE

void tst_Q3PtrList::replace()
{
    Q3PtrList<int> list;
    int foo = 4;
    list.setAutoDelete( TRUE );
    QCOMPARE( list.insert(0, new int(1)), (bool)TRUE );
    QCOMPARE( list.insert(1, new int(2)), (bool)TRUE );
    QCOMPARE( list.insert(2, new int(4)), (bool)TRUE );

    QCOMPARE( *(list.at(2)), 4 );
    QCOMPARE( list.replace(2, new int(3)), (bool)TRUE );
    QCOMPARE( *(list.at(2)), 3 );
    uint count = list.count();
    QCOMPARE( list.replace(3, &foo), (bool)FALSE );
    QCOMPARE( list.count(), count );

    int *p = new int(7);
    QCOMPARE( list.insert(2, p), (bool)TRUE );
    QCOMPARE( list.replace(2, p), (bool)TRUE );
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:20,代码来源:tst_q3ptrlist.cpp

示例3: createSummary

void TesterReport::createSummary (Q3PtrList<TradeItem> &trades, double account)
{
  int shortTrades = 0;
  int longTrades = 0;
  int winLongTrades = 0;
  int loseLongTrades = 0;
  int winShortTrades = 0;
  int loseShortTrades = 0;
  double totalWinLongTrades = 0;
  double totalLoseLongTrades = 0;
  double totalWinShortTrades = 0;
  double totalLoseShortTrades = 0;
  double largestWin = 0;
  double largestLose = 0;
  double accountDrawdown = account;
  double commission = 0;
  double balance = account;

  int loop;
  for (loop = 0; loop < (int) trades.count(); loop++)
  {
    TradeItem *trade = trades.at(loop);

    // get long/short trades
    if (trade->getTradePosition() == TradeItem::Long)
    {
      longTrades++;

      if (trade->getProfit() < 0)
      {
        loseLongTrades++;
	totalLoseLongTrades = totalLoseLongTrades + trade->getProfit();

	if (trade->getProfit() < largestLose)
	  largestLose = trade->getProfit();
      }
      else
      {
        winLongTrades++;
	totalWinLongTrades = totalWinLongTrades + trade->getProfit();

	if (trade->getProfit() > largestWin)
	  largestWin = trade->getProfit();
      }
    }
    else
    {
      shortTrades++;

      if (trade->getProfit() < 0)
      {
        loseShortTrades++;
	totalLoseShortTrades = totalLoseShortTrades + trade->getProfit();

	if (trade->getProfit() < largestLose)
	  largestLose = trade->getProfit();
      }
      else
      {
        winShortTrades++;
	totalWinShortTrades = totalWinShortTrades + trade->getProfit();

	if (trade->getProfit() > largestWin)
	  largestWin = trade->getProfit();
      }
    }

    commission = commission + trade->getEntryCom() + trade->getExitCom();
    balance = trade->getBalance();

    if (trade->getBalance() < accountDrawdown)
      accountDrawdown = trade->getBalance();

    tradeTable->setNumRows(tradeTable->numRows() + 1);
    QString ts;
    trade->getTradePositionString(ts);
    tradeTable->setText(tradeTable->numRows() - 1, 0, ts);
    trade->getEnterDateString(ts);
    tradeTable->setText(tradeTable->numRows() - 1, 1, ts);
    tradeTable->setText(tradeTable->numRows() - 1, 2, QString::number(trade->getEnterPrice(), 'f', 2));
    trade->getExitDateString(ts);
    tradeTable->setText(tradeTable->numRows() - 1, 3, ts);
    tradeTable->setText(tradeTable->numRows() - 1, 4, QString::number(trade->getExitPrice(), 'f', 2));
    trade->getExitSignalString(ts);
    tradeTable->setText(tradeTable->numRows() - 1, 5, ts);
    tradeTable->setText(tradeTable->numRows() - 1, 6, QString::number(trade->getProfit(), 'f', 2));
    tradeTable->setText(tradeTable->numRows() - 1, 7, QString::number(trade->getBalance(), 'f', 2));
    tradeTable->setText(tradeTable->numRows() - 1, 8, QString::number(trade->getVolume()));
  }

  // test summary
  summaryBalance->setNum(balance);
  summaryNetProfit->setNum(balance - account);
  summaryNetPercentage->setNum(((balance - account) / account) * 100);
  summaryInvestment->setNum(account);
  summaryCommission->setNum(commission);
  summaryDrawdown->setNum(accountDrawdown - account);
  summaryTrades->setNum(longTrades + shortTrades);
  summaryLongTrades->setNum(longTrades);
  summaryShortTrades->setNum(shortTrades);
//.........这里部分代码省略.........
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:101,代码来源:TesterReport.cpp


注:本文中的Q3PtrList::at方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。