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


C++ QPtrList::current方法代码示例

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


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

示例1: main

int main(int argc,char **argv)
{
	QApplication app(argc,argv);
	QPtrList<int> list;
	
	for (int i=0;i<3;i++)
	{
		list.append(new int(i)); // 插入資料
	}

	list.first(); // 先跳到第一個元素
	for (int i=0;i<3;i++,list.next())
	{
		cout << *(list.current()) << endl;
	}

	list.first();
	list.next();
	list.remove();
	list.remove();
	list.remove();
	cout << *(list.current()) << endl;
	// 由這一個例子可以知道,刪掉一個成員後,指標會跑到下一個.但若刪掉後沒有下一個時,指標會跑到前一個

	return 0;
}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:26,代码来源:main.cpp

示例2: temp_stack_next

void QtCalculator::temp_stack_next(){

  CALCAMNT *number;

  if( temp_stack.current() == temp_stack.getLast()){
        KNotifyClient::beep();
        return;
  }

  number = temp_stack.next();

  if(number == NULL){
       KNotifyClient::beep();
    return;
  }
  else{
    //    printf("Number: %Lg\n",*number);
    last_input = RECALL;
    DISPLAY_AMOUNT = *number;
    UpdateDisplay();

  }


}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例3: clearMarks

void QXsldbgDoc::clearMarks(bool allMarkTypes)
{
    if (locked)
	return;

    KTextEditor::MarkInterface *markIf = KTextEditor::markInterface(kDoc);
    if (markIf){
        if (!allMarkTypes){
            QPtrList<KTextEditor::Mark> marks = markIf->marks();
            while ( marks.current()) {
                markIf->removeMark(marks.current()->line, KTextEditor::MarkInterface::Execution);
                markIf->removeMark(marks.current()->line, KTextEditor::MarkInterface::BreakpointReached);
                marks.next();
            }
        }else {
            markIf->clearMarks();
        }
    }

}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:20,代码来源:qxsldbgdoc.cpp

示例4: slotButtReplace

// -----------------------------------------------------------------------
// Is called if the "Replace"-button is pressed.
void ChangeDialog::slotButtReplace()
{
  Expr.setWildcard(true);  // switch into wildcard mode
  Expr.setPattern(CompNameEdit->text());
/*  if(!Expr.isValid()) {
    QMessageBox::critical(this, tr("Error"),
	  tr("Regular expression for component name is invalid."));
    return;
  }*/


  // create dialog showing all found components
  QDialog *Dia = new QDialog(this);
  Dia->setCaption(tr("Found Components"));
  QVBoxLayout *Dia_All = new QVBoxLayout(Dia);
  Dia_All->setSpacing(3);
  Dia_All->setMargin(5);
  QScrollView *Dia_Scroll = new QScrollView(Dia);
  Dia_Scroll->setMargin(5);
  Dia_All->addWidget(Dia_Scroll);
  QVBox *Dia_Box = new QVBox(Dia_Scroll->viewport());
  Dia_Scroll->addChild(Dia_Box);
  QLabel *Dia_Label = new QLabel(tr("Change properties of\n")
                               + tr("these components ?"), Dia);
  Dia_All->addWidget(Dia_Label);
  
  QHBox *Dia_h = new QHBox(Dia);
  Dia_h->setSpacing(5);
  Dia_All->addWidget(Dia_h);
  QPushButton *YesButton = new QPushButton(tr("Yes"), Dia_h);
  connect(YesButton, SIGNAL(clicked()),
	  Dia, SLOT(accept()));
  connect(new QPushButton(tr("Cancel"), Dia_h), SIGNAL(clicked()),
	  Dia, SLOT(reject()));


  QPtrList<QCheckBox> pList;
  QCheckBox *pb;
  Component *pc;
  QStringList List;
  QString str;
  int i1, i2;
  // search through all components
  for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next()) {
    if(matches(pc->Model)) {
      if(Expr.search(pc->Name) >= 0)
        for(Property *pp = pc->Props.first(); pp!=0; pp = pc->Props.next())
          if(pp->Name == PropNameEdit->currentText()) {
            pb = new QCheckBox(pc->Name, Dia_Box);
            pList.append(pb);
            pb->setChecked(true);
            i1 = pp->Description.find('[');
            if(i1 < 0)  break;  // no multiple-choice property

            i2 = pp->Description.findRev(']');
            if(i2-i1 < 2)  break;
            str = pp->Description.mid(i1+1, i2-i1-1);
            str.replace( QRegExp("[^a-zA-Z0-9_,]"), "" );
            List = List.split(',',str);
            if(List.findIndex(NewValueEdit->text()) >= 0)
              break;    // property value is okay

            pb->setChecked(false);
            pb->setEnabled(false);
            break;
          }
    }
  }

  QColor theColor;
  if(pList.isEmpty()) {
    YesButton->setEnabled(false);
    theColor =
       (new QLabel(tr("No match found!"), Dia_Box))->paletteBackgroundColor();
  }
  else  theColor = pList.current()->paletteBackgroundColor();

  Dia_Scroll->viewport()->setPaletteBackgroundColor(theColor);
  Dia->resize(50, 300);


  // show user all components found
  int Result = Dia->exec();
  if(Result != QDialog::Accepted) return;


  bool changed = false;
  // change property values
  for(pb = pList.first(); pb!=0; pb = pList.next()) {
    if(!pb->isChecked())  continue;

    for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next()) {
      if(pb->text() != pc->Name)  continue;

      for(Property *pp = pc->Props.first(); pp!=0; pp = pc->Props.next()) {
        if(pp->Name != PropNameEdit->currentText())  continue;

        int tx_Dist, ty_Dist, tmp;
//.........这里部分代码省略.........
开发者ID:MikeBrinson,项目名称:qucs,代码行数:101,代码来源:changedialog.cpp


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