本文整理汇总了C++中QArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QArray::size方法的具体用法?C++ QArray::size怎么用?C++ QArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QArray
的用法示例。
在下文中一共展示了QArray::size方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceIndexes
/*!
Replaces the elements of this index buffer, starting at \a index,
with the contents of \a values. All other elements keep their
current values.
If the index buffer has been uploaded to the GL server, then this
function must be called with a current GL context that is compatible
with the uploaded buffer.
The index buffer must have been originally created with the
int element type.
OpenGL/ES systems usually do not support 32-bit index values unless
they have a special extension for that purpose. On systems without
32-bit index values, this function will need to convert all values
to 16-bit which may incur a performance penalty and lose information.
\sa setIndexes()
*/
void QGLIndexBuffer::replaceIndexes(int index, const QArray<uint>& values)
{
Q_D(QGLIndexBuffer);
Q_ASSERT_X(d->elementType == GL_UNSIGNED_INT || !d->hasIntBuffers,
"QGLIndexBuffer::replaceIndexes()",
"buffer created with ushort element type, replacing with int");
if (d->elementType != GL_UNSIGNED_INT && d->hasIntBuffers)
return;
if (d->buffer.isCreated()) {
if (d->hasIntBuffers) {
d->buffer.bind();
d->buffer.write(index * sizeof(int),
values.constData(), values.size() * sizeof(int));
d->buffer.release();
} else {
QArray<ushort> svalues = qt_qarray_uint_to_ushort(values);
d->buffer.bind();
d->buffer.write(index * sizeof(ushort),
svalues.constData(),
svalues.size() * sizeof(ushort));
d->buffer.release();
}
} else if (d->elementType == GL_UNSIGNED_INT) {
d->indexesInt.replace(index, values.constData(), values.size());
d->indexCount = d->indexesInt.size();
} else {
QArray<ushort> svalues = qt_qarray_uint_to_ushort(values);
d->indexesShort.replace(index, svalues.constData(), svalues.size());
d->indexCount = d->indexesShort.size();
}
}
示例2: int
string ClsFEGroupPlot::wSpacePlotSelected2Range(QArray<int> &qarraySelected){
string strRange;
if(dynamic_cast<ClsTopologySparse*>(ClsFESystemManager::Instance()->getFEGroup( strGroupID )->getTopology())){
ClsTopologySparse *clsTopologySparse = dynamic_cast<ClsTopologySparse*>(ClsFESystemManager::Instance()->getFEGroup( strGroupID )->getTopology());
iGroupWidth = clsTopologySparse->nrCellsHorizontal();
iGroupHeight = clsTopologySparse->nrCellsVertical();
for(unsigned int ii = 0; ii< qarraySelected.size(); ii++){
int iy = int(qarraySelected[ii] / iGroupWidth) + 1;
int ix = qarraySelected[ii] - int(qarraySelected[ii] / iGroupWidth) * iGroupWidth + 1;
if(clsTopologySparse->isValidCell(ix, iy)){
// cout << "clsTopologySparse->pos2index(ix, iy): " << clsTopologySparse->pos2index(ix, iy) << endl;
// cout << __FILE__ << ": ix, iy: " << ix << ", " << iy << endl;
strRange = iqrUtils::int2string(clsTopologySparse->pos2index(ix, iy)) + ";" + strRange ;
}
}
} else {
for(unsigned int ii = 0; ii< qarraySelected.size(); ii++){
strRange = iqrUtils::int2string(qarraySelected[ii]) + ";" + strRange ;
}
}
return strRange;
}
示例3: setIndexes
/*!
Sets the index \a values in this index buffer, replacing the
entire current contents.
If the index buffer has been uploaded to the GL server, then this
function must be called with a current GL context that is compatible
with the uploaded buffer.
OpenGL/ES systems usually do not support 32-bit index values unless
they have a special extension for that purpose. On systems without
32-bit index values, this function will need to convert all values
to 16-bit which may incur a performance penalty and lose information.
\sa replaceIndexes()
*/
void QGLIndexBuffer::setIndexes(const QArray<uint>& values)
{
Q_D(QGLIndexBuffer);
if (d->buffer.isCreated()) {
if (d->hasIntBuffers) {
d->buffer.bind();
d->buffer.allocate(values.constData(), values.size() * sizeof(int));
d->buffer.release();
// The element type may have changed from ushort to int.
d->elementType = GL_UNSIGNED_INT;
} else {
QArray<ushort> svalues = qt_qarray_uint_to_ushort(values);
d->buffer.bind();
d->buffer.allocate(svalues.constData(), svalues.size() * sizeof(ushort));
d->buffer.release();
}
} else if (d->hasIntBuffers) {
d->indexesInt = values;
d->elementType = GL_UNSIGNED_INT;
d->indexesShort = QArray<ushort>();
} else {
d->indexesShort = qt_qarray_uint_to_ushort(values);
d->elementType = GL_UNSIGNED_SHORT;
d->indexesInt = QArray<uint>();
}
d->indexCount = values.size();
}
示例4:
/** Get a vector of Rfcomm channels of the services having "uuid" in the class ID List*/
QArray<int> OTPeer::rfcommList( const OTUUID & uuid) {
QArray<int> rfcommList;
unsigned int channel;
for( unsigned int i = 0;
i < serviceList.count();
i ++ ) {
if( serviceList[i]->hasClassID(uuid)) {
if( serviceList[i]->rfcommChannel(channel) ) {
rfcommList.resize( rfcommList.size()+1 );
rfcommList[rfcommList.size()-1] = channel;
}
}
}
return rfcommList;
}
示例5: overlayTransparentColor
QColor QGLContext::overlayTransparentColor() const
{
//### make more efficient using the transpColor member
if ( isValid() ) {
if ( !trans_colors_init )
find_trans_colors();
VisualID myVisualId = ((XVisualInfo*)vi)->visualid;
for ( int i = 0; i < (int)trans_colors.size(); i++ ) {
if ( trans_colors[i].vis == myVisualId )
return QColor( qRgb( 1, 2, 3 ), trans_colors[i].color );
}
}
return QColor(); // Invalid color
}
示例6: id
/*!
Returns all ids associated with the application CategoryGroup \a app
and the passed in \a labels in that group.
*/
QArray<int> Categories::ids( const QString &app, const QStringList &labels) const
{
QArray<int> results;
QStringList::ConstIterator it;
int i;
for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) {
int value = id( app, *it );
if ( value != 0 ) {
int tmp = results.size();
results.resize( tmp + 1 );
results[ tmp ] = value;
}
}
return results;
}
示例7: while
static QArray<ushort> qt_qarray_uint_to_ushort(const QArray<uint> &array)
{
QArray<ushort> result;
const uint *values = array.constData();
int size = array.size();
bool largeValue = false;
result.reserve(size);
while (size-- > 0) {
uint value = *values++;
if (ushort(value) != value)
largeValue = true;
result.append(ushort(value));
}
if (largeValue)
qWarning("QGLIndexBuffer::setIndexes: large 32-bit value provided to a 16-bit only buffer");
return result;
}
示例8: remove
void TodoManager::remove( const QArray<int>& ids)
{
for ( uint i=0; i < ids.size(); i++ )
remove( ids[i] );
}
示例9: hasOpenGLOverlays
bool QGLFormat::hasOpenGLOverlays()
{
if ( !trans_colors_init )
find_trans_colors();
return trans_colors.size() > 0;
}