本文整理汇总了C++中QListIterator::peekNext方法的典型用法代码示例。如果您正苦于以下问题:C++ QListIterator::peekNext方法的具体用法?C++ QListIterator::peekNext怎么用?C++ QListIterator::peekNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListIterator
的用法示例。
在下文中一共展示了QListIterator::peekNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateConstraintName
void SubassemblyView::updateConstraintName ( const QString& /*name*/ )
{
// The budget approach is just to recompute all of the list view strings.
// Not sure what being more selective would avail us.
//ListViewItem* list_item = list_view_item_->firstChild();
//TODO
ListViewItem* list_item = static_cast<ListViewItem*>(list_view_item_->child(0));
QListIterator< std::shared_ptr<AssemblyConstraint>> constraint = subassembly_->constraints().
constraints();
while ( constraint.hasNext() ) {
QString text;
if ( constraint.peekNext()->type() == lC::STR::MATE_OFFSET ||
constraint.peekNext()->type() == lC::STR::ALIGN_OFFSET )
text = tr( "Offset %1: " ).
arg( UnitsBasis::instance()->format( constraint.peekNext()->offset(),false));
if ( constraint.peekNext()->reference1().empty() ) {
text += lC::formatName( model()->idPath( constraint.peekNext()->reference0()));
}
else {
text += tr( "%1 to %2" ).
arg( lC::formatName( model()->idPath( constraint.peekNext()->reference0()))).
arg( lC::formatName( model()->idPath( constraint.peekNext()->reference1())));
}
list_item->setData( text, lC::DETAIL );
//TODO
//list_item = list_item->nextSibling();
}
}
示例2: paintTextLine
/*
The ultimate line painting function.
Currently missing features:
- draw indent lines
*/
void KateRenderer::paintTextLine(QPainter& paint, KateLineLayoutPtr range, int xStart, int xEnd, const KTextEditor::Cursor* cursor)
{
Q_ASSERT(range->isValid());
// kDebug( 13033 )<<"KateRenderer::paintTextLine";
// font data
const QFontMetricsF &fm = config()->fontMetrics();
int currentViewLine = -1;
if (cursor && cursor->line() == range->line())
currentViewLine = range->viewLineForColumn(cursor->column());
paintTextLineBackground(paint, range, currentViewLine, xStart, xEnd);
if (range->layout()) {
bool drawSelection = m_view->selection() && showSelections() && m_view->selectionRange().overlapsLine(range->line());
// Draw selection in block selecton mode. We need 2 kinds of selections that QTextLayout::draw can't render:
// - past-end-of-line selection and
// - 0-column-wide selection (used to indicate where text will be typed)
if (drawSelection && m_view->blockSelection()) {
int selectionStartColumn = m_doc->fromVirtualColumn(range->line(), m_doc->toVirtualColumn(m_view->selectionRange().start()));
int selectionEndColumn = m_doc->fromVirtualColumn(range->line(), m_doc->toVirtualColumn(m_view->selectionRange().end()));
QBrush selectionBrush = config()->selectionColor();
if (selectionStartColumn != selectionEndColumn) {
KateTextLayout lastLine = range->viewLine(range->viewLineCount() - 1);
if (selectionEndColumn > lastLine.startCol()) {
int selectionStartX = (selectionStartColumn > lastLine.startCol()) ? cursorToX(lastLine, selectionStartColumn, true) : 0;
int selectionEndX = cursorToX(lastLine, selectionEndColumn, true);
paint.fillRect(QRect(selectionStartX - xStart, (int)lastLine.lineLayout().y(), selectionEndX - selectionStartX, lineHeight()), selectionBrush);
}
} else {
const int selectStickWidth = 2;
KateTextLayout selectionLine = range->viewLine(range->viewLineForColumn(selectionStartColumn));
int selectionX = cursorToX(selectionLine, selectionStartColumn, true);
paint.fillRect(QRect(selectionX - xStart, (int)selectionLine.lineLayout().y(), selectStickWidth, lineHeight()), selectionBrush);
}
}
QVector<QTextLayout::FormatRange> additionalFormats;
if (range->length() > 0) {
// We may have changed the pen, be absolutely sure it gets set back to
// normal foreground color before drawing text for text that does not
// set the pen color
paint.setPen(attribute(KTextEditor::HighlightInterface::dsNormal)->foreground().color());
// Draw the text :)
if (drawSelection) {
// FIXME toVector() may be a performance issue
additionalFormats = decorationsForLine(range->textLine(), range->line(), true).toVector();
range->layout()->draw(&paint, QPoint(-xStart,0), additionalFormats);
} else {
range->layout()->draw(&paint, QPoint(-xStart,0));
}
}
QBrush backgroundBrush;
bool backgroundBrushSet = false;
// Loop each individual line for additional text decoration etc.
QListIterator<QTextLayout::FormatRange> it = range->layout()->additionalFormats();
QVectorIterator<QTextLayout::FormatRange> it2 = additionalFormats;
for (int i = 0; i < range->viewLineCount(); ++i) {
KateTextLayout line = range->viewLine(i);
// Determine the background to use, if any, for the end of this view line
backgroundBrushSet = false;
while (it2.hasNext()) {
const QTextLayout::FormatRange& fr = it2.peekNext();
if (fr.start > line.endCol())
break;
if (fr.start + fr.length > line.endCol()) {
if (fr.format.hasProperty(QTextFormat::BackgroundBrush)) {
backgroundBrushSet = true;
backgroundBrush = fr.format.background();
}
goto backgroundDetermined;
}
it2.next();
}
while (it.hasNext()) {
const QTextLayout::FormatRange& fr = it.peekNext();
if (fr.start > line.endCol())
break;
if (fr.start + fr.length > line.endCol()) {
if (fr.format.hasProperty(QTextFormat::BackgroundBrush)) {
backgroundBrushSet = true;
backgroundBrush = fr.format.background();
}
//.........这里部分代码省略.........
示例3: init
void SubassemblyView::init ( void )
{
setObjectName( subassembly_->name().toLatin1() );
drawer_ = Space3D::OCSubassemblyDrawFactory::drawer( subassembly_, view() );
modify_input_ = new SubassemblyModifyInput( this );
dimensions_[0] = dimensions_[1] = dimensions_[2] = 0;
dimension_name_ = view()->genSelectionName();
ListViewItem* previous_item = parent()->previousItem( parent()->listViewItem(),
subassembly_->id() );
list_view_item_ = new ListViewItem( parent()->listViewItem(), previous_item );
list_view_item_->setData( lC::formatName( subassembly_->name() )
+ QString( " <%1>" ).arg( subassembly_->id() ),
lC::NAME );
list_view_item_->setData( trC( subassembly_->type() ), lC::TYPE );
list_view_item_->setData( tr( "Model: %1.%2 <%3>" ).
arg( lC::formatName( subassembly_->subassembly()->name()) ).
arg( trC( subassembly_->subassembly()->type() ) ).
arg( lC::idToString( subassembly_->subassembly()->ID() ) ),
lC::DETAIL );
//TODO
//list_view_item_->listView()->ensureItemVisible( list_view_item_ );
QListIterator<std::shared_ptr<AssemblyConstraint>> constraint =
subassembly_->constraints().constraints();
ListViewItem* constraint_item = 0;
while ( constraint.hasNext() ) {
constraint_item = new ListViewItem( list_view_item_, constraint_item );
constraint_item->setData( trC( lC::STR::CONSTRAINT ), lC::NAME );
constraint_item->setData( trC( constraint.peekNext()->type() ), lC::TYPE );
constraint_item->setData( QVariant(), lC::DETAIL );
updateChangedConstraint( 0, constraint.peekNext().get() );
// Are there any offset constraints which need dimensions?
if ( constraint.peekNext()->type() == lC::STR::MATE_OFFSET ||
constraint.peekNext()->type() == lC::STR::ALIGN_OFFSET )
updateChangedOffset( constraint.peekNext().get() );
constraint.next();
}
#if 0
connect( subassembly_, SIGNAL( locationChanged() ), SLOT( updateLocation() ) );
connect( subassembly_, SIGNAL( solidChanged() ), SLOT( updateTessellation() ) );
#else
connect( subassembly_, SIGNAL( locationChanged() ), SLOT( updateTessellation() ) );
#endif
connect( subassembly_, SIGNAL( materialChanged() ), SLOT( updateMaterial() ) );
connect( subassembly_, SIGNAL( constraintCreated( const AssemblyConstraint*) ),
SLOT( updateNewConstraint( const AssemblyConstraint* ) ) );
connect( subassembly_, SIGNAL( constraintChanged( const AssemblyConstraint*,
const AssemblyConstraint*) ),
SLOT( updateChangedConstraint( const AssemblyConstraint*,
const AssemblyConstraint* ) ) );
connect( subassembly_, SIGNAL( constraintOffsetChanged( const AssemblyConstraint*) ),
SLOT( updateChangedOffset( const AssemblyConstraint* ) ) );
connect( subassembly_, SIGNAL( constraintCanceled() ),
SLOT( updateCanceledConstraint() ) );
connect( subassembly_->subassembly(), SIGNAL( nameChanged(const QString&) ),
SLOT( updateModelName( const QString& ) ) );
connect( parent(), SIGNAL( orientationChanged( const GLdouble* ) ),
SLOT( updateViewNormal( const GLdouble* ) ) );
if ( offset_info_dialog_ == 0 )
offset_info_dialog_ = new OffsetInfoDialog( parent()->lCMW() );
}