本文整理汇总了C++中QBitmap::depth方法的典型用法代码示例。如果您正苦于以下问题:C++ QBitmap::depth方法的具体用法?C++ QBitmap::depth怎么用?C++ QBitmap::depth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBitmap
的用法示例。
在下文中一共展示了QBitmap::depth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBitmap
void QCursor::setBitmap( const QBitmap &bitmap, const QBitmap &mask,
int hotX, int hotY )
{
if ( !initialized )
initialize();
if ( bitmap.depth() != 1 || mask.depth() != 1 ||
bitmap.size() != mask.size() ) {
#if defined(QT_CHECK_NULL)
qWarning( "QCursor: Cannot create bitmap cursor; invalid bitmap(s)" );
#endif
QCursor *c = &cursorTable[arrowCursorIdx];
c->data->ref();
data = c->data;
return;
}
data = new QCursorData;
Q_CHECK_PTR( data );
data->bm = new QBitmap( bitmap );
data->bmm = new QBitmap( mask );
data->hcurs = 0;
data->cshape = BitmapCursor;
data->hx = hotX >= 0 ? hotX : bitmap.width()/2;
data->hy = hotY >= 0 ? hotY : bitmap.height()/2;
data->fg.red = 0 << 8;
data->fg.green = 0 << 8;
data->fg.blue = 0 << 8;
data->bg.red = 255 << 8;
data->bg.green = 255 << 8;
data->bg.blue = 255 << 8;
update(); // Xcursor's backward compatibility hack needs the cursor to be created
// right after the bitmaps are created and filled with data
}
示例2: setBitmap
void QCursor::setBitmap( const QBitmap &bitmap, const QBitmap &mask,
int hotX, int hotY )
{
if ( !initialized )
initialize();
if ( bitmap.depth() != 1 || mask.depth() != 1 ||
bitmap.size() != mask.size() ) {
#if defined(QT_CHECK_NULL)
qWarning( "QCursor: Cannot create bitmap cursor; invalid bitmap(s)" );
#endif
QCursor *c = &cursorTable[arrowCursorIdx];
c->data->ref();
data = c->data;
return;
}
data = new QCursorData;
Q_CHECK_PTR( data );
data->bm = new QBitmap( bitmap );
data->bmm = new QBitmap( mask );
data->cshape = BitmapCursor;
data->id = nextCursorId++;
data->hx = hotX >= 0 ? hotX : bitmap.width()/2;
data->hy = hotY >= 0 ? hotY : bitmap.height()/2;
QPaintDevice::qwsDisplay()->defineCursor(data->id, *data->bm,
*data->bmm, data->hx, data->hy);
}