本文整理汇总了C++中Q3ValueList::last方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3ValueList::last方法的具体用法?C++ Q3ValueList::last怎么用?C++ Q3ValueList::last使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3ValueList
的用法示例。
在下文中一共展示了Q3ValueList::last方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 );
}
示例2: QVERIFY
void tst_Q3ValueList::fromLast()
{
Q3ValueList<int> a;
Q3ValueListIterator<int> it = a.fromLast();
QVERIFY( (it == a.end()) );
a.append( 1 );
a.append( 10 );
a.append( 100 );
it = a.fromLast();
QVERIFY( (it != a.end()) );
QCOMPARE( a.last(), 100 );
*(a.fromLast()) = 200;
QCOMPARE( a.last(), 200 );
}
示例3: 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);
}
示例4: 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 );
//.........这里部分代码省略.........
示例5: feedbackPixmap
QPixmap NoteDrag::feedbackPixmap(NoteSelection *noteList)
{
if (noteList == 0)
return QPixmap();
static const int MARGIN = 2;
static const int SPACING = 1;
QColor textColor = noteList->firstStacked()->note->basket()->textColor();
QColor backgroundColor = noteList->firstStacked()->note->basket()->backgroundColor().dark(NoteContent::FEEDBACK_DARKING);
Q3ValueList<QPixmap> pixmaps;
Q3ValueList<QColor> backgrounds;
Q3ValueList<bool> spaces;
QPixmap pixmap;
int height = 0;
int width = 0;
int i = 0;
bool elipsisImage = false;
QColor bgColor;
bool needSpace;
for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked(), ++i) {
if (elipsisImage) {
pixmap = QPixmap(7, 2);
pixmap.fill(backgroundColor);
QPainter painter(&pixmap);
painter.setPen(textColor);
painter.drawPoint(1, 1);
painter.drawPoint(3, 1);
painter.drawPoint(5, 1);
painter.end();
bgColor = node->note->basket()->backgroundColor();
needSpace = false;
} else {
pixmap = node->note->content()->feedbackPixmap(/*maxWidth=*/kapp->desktop()->width() / 2, /*maxHeight=*/96);
bgColor = node->note->backgroundColor();
needSpace = node->note->content()->needSpaceForFeedbackPixmap();
}
if (!pixmap.isNull()) {
if (pixmap.width() > width)
width = pixmap.width();
pixmaps.append(pixmap);
backgrounds.append(bgColor);
spaces.append(needSpace);
height += (i > 0 && needSpace ? 1 : 0) + pixmap.height() + SPACING + (needSpace ? 1 : 0);
if (elipsisImage)
break;
if (height > kapp->desktop()->height() / 2)
elipsisImage = true;
}
}
if (!pixmaps.isEmpty()) {
QPixmap result(MARGIN + width + MARGIN, MARGIN + height - SPACING + MARGIN - (spaces.last() ? 1 : 0));
QPainter painter(&result);
// Draw all the images:
height = MARGIN;
Q3ValueList<QPixmap>::iterator it;
Q3ValueList<QColor>::iterator it2;
Q3ValueList<bool>::iterator it3;
int i = 0;
for (it = pixmaps.begin(), it2 = backgrounds.begin(), it3 = spaces.begin(); it != pixmaps.end(); ++it, ++it2, ++it3, ++i) {
if (i != 0 && (*it3)) {
painter.fillRect(MARGIN, height, result.width() - 2 * MARGIN, SPACING, (*it2).dark(NoteContent::FEEDBACK_DARKING));
++height;
}
painter.drawPixmap(MARGIN, height, *it);
if ((*it).width() < width)
painter.fillRect(MARGIN + (*it).width(), height, width - (*it).width(), (*it).height(), (*it2).dark(NoteContent::FEEDBACK_DARKING));
if (*it3) {
painter.fillRect(MARGIN, height + (*it).height(), result.width() - 2 * MARGIN, SPACING, (*it2).dark(NoteContent::FEEDBACK_DARKING));
++height;
}
painter.fillRect(MARGIN, height + (*it).height(), result.width() - 2 * MARGIN, SPACING, Tools::mixColor(textColor, backgroundColor));
height += (*it).height() + SPACING;
}
// Draw the border:
painter.setPen(textColor);
painter.drawLine(0, 0, result.width() - 1, 0);
painter.drawLine(0, 0, 0, result.height() - 1);
painter.drawLine(0, result.height() - 1, result.width() - 1, result.height() - 1);
painter.drawLine(result.width() - 1, 0, result.width() - 1, result.height() - 1);
// Draw the "lightly rounded" border:
painter.setPen(Tools::mixColor(textColor, backgroundColor));
painter.drawPoint(0, 0);
painter.drawPoint(0, result.height() - 1);
painter.drawPoint(result.width() - 1, result.height() - 1);
painter.drawPoint(result.width() - 1, 0);
// Draw the background in the margin (the inside will be painted above, anyway):
painter.setPen(backgroundColor);
painter.drawLine(1, 1, result.width() - 2, 1);
painter.drawLine(1, 1, 1, result.height() - 2);
painter.drawLine(1, result.height() - 2, result.width() - 2, result.height() - 2);
painter.drawLine(result.width() - 2, 1, result.width() - 2, result.height() - 2);
// And assign the feedback pixmap to the drag object:
//multipleDrag->setPixmap(result, QPoint(-8, -8));
return result;
}
return QPixmap();
}