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


C++ Q3ValueList::first方法代码示例

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


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

示例1: QCOMPARE

void tst_Q3ValueList::pushing()
{
    Q3ValueList<int> a;
    a.append( 100 );

    a.push_front( 10 );
    QCOMPARE( a.first(), 10 );
    QCOMPARE( a.last(), 100 );

    a.push_back( 1000 );
    QCOMPARE( a.first(), 10 );
    QCOMPARE( a.last(), 1000 );
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:13,代码来源:tst_q3valuelist.cpp

示例2: setCaption


//.........这里部分代码省略.........
  pixmap = QPixmap(fileopen);
  Q3WhatsThis::add(new QToolButton(pixmap, "Open", QString::null,
				  this, SLOT(load()), tools, "open"),
		  OpenText);
  menu->setWhatsThis(menu->insertItem(pixmap, "&Open", this,
				      SLOT(load()), Qt::CTRL+Qt::Key_O),
		     OpenText);
  
  pixmap = QPixmap(filesave);
  Q3WhatsThis::add(new QToolButton(pixmap, "Save", QString::null,
				  this, SLOT(save()), tools, "save"),
		  SaveText);
  menu->setWhatsThis(menu->insertItem(pixmap, "&Save", this,
				      SLOT(save()), Qt::CTRL+Qt::Key_S),
		     SaveText);
  
  menu->insertSeparator();
  pixmap = QPixmap(::scan);
  Q3WhatsThis::add(new QToolButton(pixmap, "Scan", QString::null,
				  this, SLOT(scan()), tools, "scan"),
		  ScanText);
  menu->setWhatsThis(menu->insertItem(pixmap, "S&can", this,
				      SLOT(scan()), Qt::CTRL+Qt::Key_C),
		     ScanText);
  
  menu->insertSeparator();
  menu->insertItem("&Quit", this, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
  
  menu = new Q3PopupMenu(this);
  menuBar()->insertItem("&Browse", menu);
  
  pixmap = QPixmap(browsersearch);
  Q3WhatsThis::add(new QToolButton(pixmap, "Search", QString::null,
				  this, SLOT(browser_search()), tools, "search"),
		  SearchText);
  menu->setWhatsThis(menu->insertItem(pixmap, "&Search", this,
				      SLOT(browser_search()), Qt::CTRL+Qt::Key_S),
		     SearchText);
  
  pixmap = QPixmap(left_xpm);
  Q3WhatsThis::add(new QToolButton(pixmap, "Back", QString::null,
				  this, SLOT(historic_back()),
				  tools, "back"),
		  LeftText);
  
  pixmap = QPixmap(right_xpm);
  Q3WhatsThis::add(new QToolButton(pixmap, "Forward", QString::null,
				  this, SLOT(historic_forward()),
				  tools, "forward"),
		  RightText);
  
  (void)Q3WhatsThis::whatsThisButton(tools);

  //
  
  menu = new Q3PopupMenu(this);
  menuBar()->insertItem("&Style", menu);
  
#if !defined(QT_NO_STYLE_MOTIF)
  menu->insertItem("Motif", this, SLOT(motif_style()));
#endif
#if !defined(QT_NO_STYLE_MOTIFPLUS)
  menu->insertItem("MotifPlus", this, SLOT(motifplus_style()));
#endif
  menu->insertItem("Windows", this, SLOT(windows_style()));
  
  //
  
  menuBar()->insertSeparator();
  menu = new Q3PopupMenu(this);
  menuBar()->insertItem("&Help", menu);
  
  menu->insertItem("&About", this, SLOT(about()), Qt::Key_F1);
  menu->insertItem("About&Qt", this, SLOT(aboutQt()));
  menu->insertSeparator();
  menu->insertItem("What's This", this, SLOT(whatsThis()), Qt::SHIFT+Qt::Key_F1);
    
  //
  
  spl = new QSplitter(Qt::Vertical, this, "spl");
  
  browser = new BrowserView(spl);
  comment = new CommentView(spl);
  
  connect(comment, SIGNAL(refer(const QString &)),
	  browser, SLOT(refer(const QString &)));
  
  spl->moveToFirst(browser);

  Q3ValueList<int> lsz = spl->sizes();
  int h = lsz.first() + lsz.last();
  
  lsz.first() = (h*3)/4;
  lsz.last() = h - lsz.first();
  
  spl->setSizes(lsz);
  
  spl->setResizeMode(comment, QSplitter::KeepSize);
  setCentralWidget(spl);
}
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:JavaCatWindow.cpp

示例3: drawTree

QRect CEdge::drawTree( Q3Canvas* canvas, int left, int depth, StringToString* filter )
{
	int X_PADDING = 10;
	int Y_SPACING = 30;

//	int X_MARGIN = 10; unused variable 'X_Margin'
	int Y_MARGIN = 10;

	//================================================

	Q3CanvasItem* edge = new Q3CanvasText( LHS(), canvas ),
			   * leaf = NULL;
	Q3CanvasLine* line;

	m_CanvasItems.clear();
	m_CanvasItems.append( edge );

	int myLeft = left,
		myTop = ( depth * Y_SPACING ) + Y_MARGIN,
		myCenterX,
		myBottom,
		childCenterX,
		childLeft,
		childTop,
		shiftAmount;

	Q3ValueList<QRect> daughterBoundingRectangles;
	Q3ValueList<QRect>::iterator it;

	QRect myBoundingRect, rectangle;
	myBoundingRect.setTop( myTop );
	myBoundingRect.setLeft( myLeft );
	myBoundingRect.setBottom( myTop + edge->boundingRect().height() - 1 );
	myBoundingRect.setRight( myLeft + edge->boundingRect().width() - 1 );
	
	int count = 0;
//	bool first = TRUE; unused variable 'first'

	CEdge* daughter;
	for( daughter = m_Daughters.first(); daughter; daughter = m_Daughters.next() )
	{
		daughterBoundingRectangles.append( rectangle );

		daughterBoundingRectangles[count] = daughter->drawTree( canvas, left, depth + 1, filter );

		// Adjust left position based on bounding rectangle of last daughter
		left = daughterBoundingRectangles[count].right() + X_PADDING;

		count++;
	}

	if( m_Daughters.isEmpty() )
	{
		// Create leaf node
		childLeft = myLeft;
		childTop = ( ( depth + 1 ) * Y_SPACING ) + Y_MARGIN;

		leaf = new Q3CanvasText( Filter( filter, RHS() ), canvas );
		m_CanvasItems.append( leaf );

		leaf->move( childLeft, childTop );
		leaf->show();

		// Adjust my bounding rect
		if( leaf->boundingRect().right() > myBoundingRect.right() ) myBoundingRect.setRight( leaf->boundingRect().right() );
		myBoundingRect.setBottom( leaf->boundingRect().bottom() );
	}
	else
	{
		for( it = daughterBoundingRectangles.begin(); it != daughterBoundingRectangles.end(); ++it )
		{
			// Adjust my bounding rect
			if( (*it).right() > myBoundingRect.right() ) myBoundingRect.setRight( (*it).right() );
			if( (*it).bottom() > myBoundingRect.bottom() ) myBoundingRect.setBottom( (*it).bottom() );
		}
	}
	
	if( myBoundingRect.width() == edge->boundingRect().width() ) 
	{
		// Shift all children to the right
		if( m_Daughters.isEmpty() )
		{
			shiftAmount = int (( myBoundingRect.width() - leaf->boundingRect().width() ) / 2.0);

			leaf->move( leaf->boundingRect().left() + shiftAmount, leaf->boundingRect().top() );
			leaf->show();
		}
		else
		{
			shiftAmount = int (( myBoundingRect.width() - ( daughterBoundingRectangles.last().right() - daughterBoundingRectangles.first().left() ) ) / 2.0);
			
			for( daughter = m_Daughters.first(); daughter; daughter = m_Daughters.next() )
			{
				daughter->shiftTree( canvas, shiftAmount, 0 );
			}

			for( it = daughterBoundingRectangles.begin(); it != daughterBoundingRectangles.end(); ++it )
			{
				// Adjust the bounding rect position
				(*it).setLeft( (*it).left() + shiftAmount );
//.........这里部分代码省略.........
开发者ID:JohnAGoldsmith,项目名称:lxa420,代码行数:101,代码来源:Edge.cpp


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