本文整理汇总了C++中QValueList::at方法的典型用法代码示例。如果您正苦于以下问题:C++ QValueList::at方法的具体用法?C++ QValueList::at怎么用?C++ QValueList::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QValueList
的用法示例。
在下文中一共展示了QValueList::at方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: askForCorrelograms
void CorrelationView::askForCorrelograms(){
//If the widget is not about to be deleted, request the data.
if(!goingToDie){
dataReady = false;
//Compute the pairs for all the clusters currently shown.
const QValueList<int>& shownClusters = view.clusters();
QValueList<int> clusters;
QValueList<int>::const_iterator clustersIterator;
for(clustersIterator = shownClusters.begin(); clustersIterator != shownClusters.end(); ++clustersIterator)
clusters.append(*clustersIterator);
qHeapSort(clusters);
pairs.clear();
QValueList<Pair>* clusterPairs = new QValueList<Pair>();
QValueList<int>::iterator iterator;
int i = 0;
for(iterator = clusters.begin(); iterator != clusters.end(); ++iterator){
QValueList<int>::iterator iterator2;
for(iterator2 = clusters.at(i); iterator2 != clusters.end(); ++iterator2){
//Create pairs as (*iterator,*iterator2) where *iterator <= *iterator2
pairs.append(Pair(*iterator,*iterator2));
clusterPairs->append(Pair(*iterator,*iterator2));
}
++i;
}
//Create a thread to get the correlation data for that cluster.
CorrelationThread* correlationThread = getCorrelations(clusterPairs,clusters);
threadsToBeKill.append(correlationThread);
}
}
示例2: qHeapSort
CorrelationView::CorrelationView(KlustersDoc& doc,KlustersView& view,QColor backgroundColor,KStatusBar * statusBar,QWidget* parent,Data::ScaleMode scale,int binSize, int correlationTimeFrame,bool shoulderLine, const char* name,
int minSize, int maxSize, int windowTopLeft ,int windowBottomRight, int border) :
ViewWidget(doc,view,backgroundColor,statusBar,parent,name,minSize,maxSize,windowTopLeft,windowBottomRight,border,XMARGIN,YMARGIN),
scaleMode(scale),dataReady(true),binSize(binSize),timeWindow(correlationTimeFrame),shoulderLine(shoulderLine),
isZoomed(false),goingToDie(false),printState(false){
//The list owns its objects, it will delete the items that are removed.
threadsToBeKill.setAutoDelete(true); //The treads will be delete only from threadsToBeKill
//Set the only mode available.
mode = ZOOM;
//Set the drawing variables
nbBins = timeWindow / binSize;
binWidth = 100;
widthBorder = (nbBins * binWidth) / 30;
heightBorder = 20;
Xspace = (nbBins * binWidth) / 10;
Yspace = 40;
YsizeForMaxAmp = 200;
if(scale == Data::RAW) Yfactor = 1;
else Yfactor = YsizeForMaxAmp;
shift = nbBins * binWidth + Xspace;
//Compute variable to draw tick marks
int n = 0;
if((timeWindow - 1)/2 <= 30) n = 5;
if((timeWindow - 1)/2 > 30 && (timeWindow - 1)/2 <= 100) n = 10;
if((timeWindow - 1)/2 >= 100) n = 20;
int pixelPerTimeWindow = (timeWindow * binWidth) / binSize;
tickMarkStep = static_cast<float>(pixelPerTimeWindow * n) / static_cast<float>(timeWindow);
nbTickMarks = static_cast<int>(floor(0.5 + static_cast<float>((timeWindow/2) / static_cast<float>(n))));
tickMarkZero = ((nbBins - 1)/2)* binWidth + binWidth/2;
abscissaMin = 0;
ordinateMax = 0;
//Create the pairs for the clusters to show.
const QValueList<int>& shownClusters = view.clusters();
QValueList<int> clusters;
QValueList<int>::const_iterator clustersIterator;
for(clustersIterator = shownClusters.begin(); clustersIterator != shownClusters.end(); ++clustersIterator)
clusters.append(*clustersIterator);
qHeapSort(clusters);
QValueList<int>::iterator iterator;
int i = 0;
for(iterator = clusters.begin(); iterator != clusters.end(); ++iterator){
QValueList<int>::iterator iterator2;
for(iterator2 = clusters.at(i); iterator2 != clusters.end(); ++iterator2){
//Create pairs as (*iterator,*iterator2) where *iterator <= *iterator2
pairs.append(Pair(*iterator,*iterator2));
}
++i;
}
updateWindow();
//Set the cursor shap to a magnifier as the only action allowed on the widget is to zoom.
setCursor(zoomCursor);
//Allowed the mouse tracking to write the time in the status bar.
setMouseTracking(true) ;
}
示例3: moveDockWindow
void QDockArea::moveDockWindow( QDockWindow *w, const QPoint &p, const QRect &r, bool swap )
{
invalidateFixedSizes();
int mse = -10;
bool hasResizable = FALSE;
for ( QDockWindow *dw = dockWindows->first(); dw; dw = dockWindows->next() ) {
if ( dw->isHidden() )
continue;
if ( dw->isResizeEnabled() )
hasResizable = TRUE;
if ( orientation() != Qt::Horizontal )
mse = QMAX( QMAX( dw->fixedExtent().width(), dw->width() ), mse );
else
mse = QMAX( QMAX( dw->fixedExtent().height(), dw->height() ), mse );
}
if ( !hasResizable && w->isResizeEnabled() ) {
if ( orientation() != Qt::Horizontal )
mse = QMAX( w->fixedExtent().width(), mse );
else
mse = QMAX( w->fixedExtent().height(), mse );
}
QDockWindow *dockWindow = 0;
int dockWindowIndex = findDockWindow( w );
QPtrList<QDockWindow> lineStarts = layout->lineStarts();
QValueList<QRect> lines = layout->lineList();
bool wasAloneInLine = FALSE;
QPoint pos = mapFromGlobal( p );
QRect lr = *lines.at( lineOf( dockWindowIndex ) );
if ( dockWindowIndex != -1 ) {
if ( lineStarts.find( w ) != -1 &&
( dockWindowIndex < (int)dockWindows->count() - 1 && lineStarts.find( dockWindows->at( dockWindowIndex + 1 ) ) != -1 ||
dockWindowIndex == (int)dockWindows->count() - 1 ) )
wasAloneInLine = TRUE;
dockWindow = dockWindows->take( dockWindowIndex );
if ( !wasAloneInLine ) { // only do the pre-layout if the widget isn't the only one in its line
if ( lineStarts.findRef( dockWindow ) != -1 && dockWindowIndex < (int)dockWindows->count() )
dockWindows->at( dockWindowIndex )->setNewLine( TRUE );
layout->layoutItems( QRect( 0, 0, width(), height() ), TRUE );
}
} else {
dockWindow = w;
dockWindow->reparent( this, QPoint( 0, 0 ), TRUE );
if ( swap )
dockWindow->resize( dockWindow->height(), dockWindow->width() );
w->installEventFilter( this );
}
lineStarts = layout->lineStarts();
lines = layout->lineList();
QRect rect = QRect( mapFromGlobal( r.topLeft() ), r.size() );
if ( orientation() == Horizontal && QApplication::reverseLayout() ) {
rect = QRect( width() - rect.x() - rect.width(), rect.y(), rect.width(), rect.height() );
pos.rx() = width() - pos.x();
}
dockWindow->setOffset( point_pos( rect.topLeft(), orientation() ) );
if ( orientation() == Horizontal ) {
int offs = dockWindow->offset();
if ( width() - offs < dockWindow->minimumWidth() )
dockWindow->setOffset( width() - dockWindow->minimumWidth() );
} else {
int offs = dockWindow->offset();
if ( height() - offs < dockWindow->minimumHeight() )
dockWindow->setOffset( height() - dockWindow->minimumHeight() );
}
if ( dockWindows->isEmpty() ) {
dockWindows->append( dockWindow );
} else {
int dockLine = -1;
bool insertLine = FALSE;
int i = 0;
QRect lineRect;
// find the line which we touched with the mouse
for ( QValueList<QRect>::Iterator it = lines.begin(); it != lines.end(); ++it, ++i ) {
if ( point_pos( pos, orientation(), TRUE ) >= point_pos( (*it).topLeft(), orientation(), TRUE ) &&
point_pos( pos, orientation(), TRUE ) <= point_pos( (*it).topLeft(), orientation(), TRUE ) +
size_extent( (*it).size(), orientation(), TRUE ) ) {
dockLine = i;
lineRect = *it;
break;
}
}
if ( dockLine == -1 ) { // outside the dock...
insertLine = TRUE;
if ( point_pos( pos, orientation(), TRUE ) < 0 ) // insert as first line
dockLine = 0;
else
dockLine = (int)lines.count(); // insert after the last line ### size_t/int cast
} else { // inside the dock (we have found a dockLine)
if ( point_pos( pos, orientation(), TRUE ) <
point_pos( lineRect.topLeft(), orientation(), TRUE ) + 4 ) { // mouse was at the very beginning of the line
insertLine = TRUE; // insert a new line before that with the docking widget
} else if ( point_pos( pos, orientation(), TRUE ) >
point_pos( lineRect.topLeft(), orientation(), TRUE ) +
size_extent( lineRect.size(), orientation(), TRUE ) - 4 ) { // mouse was at the very and of the line
insertLine = TRUE; // insert a line after that with the docking widget
dockLine++;
}
//.........这里部分代码省略.........