本文整理汇总了C++中setFlag函数的典型用法代码示例。如果您正苦于以下问题:C++ setFlag函数的具体用法?C++ setFlag怎么用?C++ setFlag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFlag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _edge
QGVEdge::QGVEdge(QGVEdgePrivate *edge, QGVScene *scene) : _edge(edge), _scene(scene)
{
setFlag(QGraphicsItem::ItemIsSelectable, true);
}
示例2: RobotPart
//! [10]
Robot::Robot(QGraphicsItem *parent)
: RobotPart(parent)
{
setFlag(ItemHasNoContents);
QGraphicsObject *torsoItem = new RobotTorso(this);
QGraphicsObject *headItem = new RobotHead(torsoItem);
QGraphicsObject *upperLeftArmItem = new RobotLimb(torsoItem);
QGraphicsObject *lowerLeftArmItem = new RobotLimb(upperLeftArmItem);
QGraphicsObject *upperRightArmItem = new RobotLimb(torsoItem);
QGraphicsObject *lowerRightArmItem = new RobotLimb(upperRightArmItem);
QGraphicsObject *upperRightLegItem = new RobotLimb(torsoItem);
QGraphicsObject *lowerRightLegItem = new RobotLimb(upperRightLegItem);
QGraphicsObject *upperLeftLegItem = new RobotLimb(torsoItem);
QGraphicsObject *lowerLeftLegItem = new RobotLimb(upperLeftLegItem);
//! [10]
//! [11]
headItem->setPos(0, -18);
upperLeftArmItem->setPos(-15, -10);
lowerLeftArmItem->setPos(30, 0);
upperRightArmItem->setPos(15, -10);
lowerRightArmItem->setPos(30, 0);
upperRightLegItem->setPos(10, 32);
lowerRightLegItem->setPos(30, 0);
upperLeftLegItem->setPos(-10, 32);
lowerLeftLegItem->setPos(30, 0);
//! [11]
//! [12]
QParallelAnimationGroup *animation = new QParallelAnimationGroup(this);
QPropertyAnimation *headAnimation = new QPropertyAnimation(headItem, "rotation");
headAnimation->setStartValue(20);
headAnimation->setEndValue(-20);
QPropertyAnimation *headScaleAnimation = new QPropertyAnimation(headItem, "scale");
headScaleAnimation->setEndValue(1.1);
animation->addAnimation(headAnimation);
animation->addAnimation(headScaleAnimation);
//! [12]
QPropertyAnimation *upperLeftArmAnimation = new QPropertyAnimation(upperLeftArmItem, "rotation");
upperLeftArmAnimation->setStartValue(190);
upperLeftArmAnimation->setEndValue(180);
animation->addAnimation(upperLeftArmAnimation);
QPropertyAnimation *lowerLeftArmAnimation = new QPropertyAnimation(lowerLeftArmItem, "rotation");
lowerLeftArmAnimation->setStartValue(50);
lowerLeftArmAnimation->setEndValue(10);
animation->addAnimation(lowerLeftArmAnimation);
QPropertyAnimation *upperRightArmAnimation = new QPropertyAnimation(upperRightArmItem, "rotation");
upperRightArmAnimation->setStartValue(300);
upperRightArmAnimation->setEndValue(310);
animation->addAnimation(upperRightArmAnimation);
QPropertyAnimation *lowerRightArmAnimation = new QPropertyAnimation(lowerRightArmItem, "rotation");
lowerRightArmAnimation->setStartValue(0);
lowerRightArmAnimation->setEndValue(-70);
animation->addAnimation(lowerRightArmAnimation);
QPropertyAnimation *upperLeftLegAnimation = new QPropertyAnimation(upperLeftLegItem, "rotation");
upperLeftLegAnimation->setStartValue(150);
upperLeftLegAnimation->setEndValue(80);
animation->addAnimation(upperLeftLegAnimation);
QPropertyAnimation *lowerLeftLegAnimation = new QPropertyAnimation(lowerLeftLegItem, "rotation");
lowerLeftLegAnimation->setStartValue(70);
lowerLeftLegAnimation->setEndValue(10);
animation->addAnimation(lowerLeftLegAnimation);
QPropertyAnimation *upperRightLegAnimation = new QPropertyAnimation(upperRightLegItem, "rotation");
upperRightLegAnimation->setStartValue(40);
upperRightLegAnimation->setEndValue(120);
animation->addAnimation(upperRightLegAnimation);
QPropertyAnimation *lowerRightLegAnimation = new QPropertyAnimation(lowerRightLegItem, "rotation");
lowerRightLegAnimation->setStartValue(10);
lowerRightLegAnimation->setEndValue(50);
animation->addAnimation(lowerRightLegAnimation);
QPropertyAnimation *torsoAnimation = new QPropertyAnimation(torsoItem, "rotation");
torsoAnimation->setStartValue(5);
torsoAnimation->setEndValue(-20);
animation->addAnimation(torsoAnimation);
//! [13]
for (int i = 0; i < animation->animationCount(); ++i) {
QPropertyAnimation *anim = qobject_cast<QPropertyAnimation *>(animation->animationAt(i));
anim->setEasingCurve(QEasingCurve::SineCurve);
anim->setDuration(2000);
}
animation->setLoopCount(-1);
animation->start();
//! [13]
}
示例3: QQuickItem
QQuickCanvasItem::QQuickCanvasItem(QQuickItem *parent)
: QQuickItem(*(new QQuickCanvasItemPrivate), parent)
{
setFlag(ItemHasContents);
}
示例4: m_frame
///////////////////////////////////////////////////////////////////////////////
// QSGVlcVideoFrameMaterial
QSGVlcVideoFrameMaterial::QSGVlcVideoFrameMaterial()
: m_frame( 0 )
{
memset( m_planeTexIds, 0, sizeof( m_planeTexIds ) );
setFlag( Blending, false );
}
示例5: m_shuttle
AndroidRotationControl::AndroidRotationControl(Shuttle *shuttle) : m_shuttle(shuttle), width(200), height(200)
{
setFlag(QGraphicsItem::ItemIsFocusable);
setAcceptTouchEvents(true);
}
示例6: prect
//.........这里部分代码省略.........
subModelColor = _subModel;
submodelLevel = _submodelLevel;
parentRelativeType = _parentRelativeType;
BorderData borderData = _border.valuePixels();
BackgroundData backgroundData = _background.value();
int bt = borderData.thickness;
QColor penColor,brushColor;
QRectF prect(bt/2,bt/2,pixmap->width()-1-bt,pixmap->height()-1-bt);
pixmap->setAlphaChannel(*pixmap);
pixmap->fill(Qt::transparent);
QPainter painter(pixmap);
switch(backgroundData.type) {
case BackgroundData::BgImage:
{
QString image_name = backgroundData.string;
QFile file(image_name);
if ( ! file.exists()) {
return;
}
QImage image(image_name);
if (backgroundData.stretch) {
QSize psize = pixmap->size();
QSize isize = image.size();
qreal sx = psize.width();
qreal sy = psize.height();
sx /= isize.width();
sy /= isize.height();
painter.scale(sx,sy);
painter.drawImage(0,0,image);
} else {
for (int y = 0; y < pixmap->height(); y += image.height()) {
for (int x = 0; x < pixmap->width(); x += image.width()) {
painter.drawImage(x,y,image);
}
}
}
brushColor = Qt::transparent;
}
break;
case BackgroundData::BgTransparent:
break;
case BackgroundData::BgColor:
case BackgroundData::BgSubmodelColor:
if (backgroundData.type == BackgroundData::BgColor) {
brushColor = LDrawColor::color(backgroundData.string);
} else {
brushColor = LDrawColor::color(_subModel.value(submodelLevel));
}
break;
}
qreal rx = borderData.radius;
qreal ry = borderData.radius;
qreal dx = pixmap->width();
qreal dy = pixmap->height();
if (dx && dy) {
if (dx > dy) {
// the rx is going to appear larger that ry, so decrease rx based on ratio
rx *= dy;
rx /= dx;
} else {
ry *= dx;
ry /= dy;
}
}
if (borderData.type == BorderData::BdrNone) {
penColor = Qt::transparent;
} else {
penColor = LDrawColor::color(borderData.color);
}
QPen pen;
pen.setColor(penColor);
pen.setWidth(bt);
pen.setCapStyle(Qt::RoundCap);
pen.setJoinStyle(Qt::RoundJoin);
painter.setPen(pen);
painter.setBrush(brushColor);
painter.setRenderHints(QPainter::HighQualityAntialiasing,true);
painter.setRenderHints(QPainter::Antialiasing,true);
if (borderData.type == BorderData::BdrRound) {
painter.drawRoundRect(prect,rx,ry);
} else {
painter.drawRect(prect);
}
setToolTip(toolTip);
setFlag(QGraphicsItem::ItemIsSelectable,true);
setFlag(QGraphicsItem::ItemIsMovable,true);
}
示例7: receive_RR
int receive_RR(int fd, char *RR, int s) {
char flag_ST;
int option = START;
int r = s ? 0 : 1;
int c_rr = 1 | (r << 5);
while(!(STOP_RR)){
read(fd, &flag_ST, 1);
//fprintf(stderr, "option %d flag_ST 0x%x flag %d r %d c_rr %x\n", option, flag_ST, getFlag(), r, c_rr);
int flag = getFlag();
if(flag && flag != -1){
alarm(0);
setFlag(-1);
STOP_RR = TRUE;
return -1;
}
switch (option) {
case START:
if (flag_ST == F){
option = FLAG_RCV;
RR[0] = flag_ST;
}
else
option = START;
break;
case FLAG_RCV:
if (flag_ST == F){
option = FLAG_RCV;
RR[0] = flag_ST;
}
else if (flag_ST == A) {
option = A_RCV;
RR[1] = flag_ST;
}
else
option = START;
break;
case A_RCV:
if (flag_ST == F){
option = FLAG_RCV;
RR[0] = flag_ST;
}
else if (flag_ST == c_rr) {
option = C_RCV;
RR[2] = flag_ST;
}
else
option = START;
break;
case C_RCV:
if (flag_ST == F) {
option = FLAG_RCV;
RR[0] = flag_ST;
}
else if (flag_ST == (c_rr^A)){
option = BCC_OK;
RR[3] = flag_ST;
}
else
option = START;
break;
case BCC_OK:
if (flag_ST == F){
option = STOP_ST;
STOP_RR = TRUE;
RR[4] = flag_ST;
}
else
option = START;
break;
case STOP_ST:
STOP_RR = TRUE;
break;
default:
break;
}
}
return r;
}
示例8: setFlagTo
inline static UINT8 setFlagTo(UINT8 ccr, UINT8 flag, bool set) {
return set ? setFlag(ccr, flag) : clearFlag(ccr, flag);
}
示例9: QQuickPaintedItem
MyImage::MyImage(QQuickItem *parent) :
QQuickPaintedItem(parent)
#else
MyImage::MyImage(QDeclarativeItem *parent) :
QDeclarativeItem(parent)
#endif
{
#if(QT_VERSION<0x050000)
setFlag(QGraphicsItem::ItemHasNoContents, false);
#endif
m_status = Null;
m_cache = true;
m_grayscale = false;
m_source = "";
m_sourceSize = QSize(0,0);
pixmap = NULL;
reply = NULL;
connect(&manager, SIGNAL(finished(QNetworkReply*)), SLOT(onDownImageFinished(QNetworkReply*)));
}
MyImage::~MyImage()
{
if(pixmap!=NULL)
delete pixmap;
}
QUrl MyImage::source() const
{
return m_source;
}
QUrl MyImage::maskSource() const
{
return m_maskSource;
}
bool MyImage::cache() const
{
return m_cache;
}
bool MyImage::grayscale() const
{
return m_grayscale;
}
void MyImage::chromaticToGrayscale(QImage &image)
{
if(image.isNull()||image.isGrayscale ())
return;
for(int i=0;i<image.width ();++i){
for(int j=0;j<image.height ();++j){
QRgb pixel = image.pixel(i,j);
int a = qAlpha(pixel);
pixel = qGray (pixel);
pixel = qRgba(pixel,pixel,pixel,a);
image.setPixel (i,j,pixel);
}
}
}
QString MyImage::imageFormatToString(const QByteArray &array)
{
QByteArray str = array.toHex ();
if(str.mid (2,6)=="504e47")
return "png";
if(str.mid (12,8)=="4a464946")
return "jpg";
if(str.left (6)=="474946")
return "gif";
if(str.left (4)=="424d")
return "bmp";
return "";
}
示例10: QgsLayerTreeModel
QgsLegendModelV2::QgsLegendModelV2( QgsLayerTreeGroup* rootNode, QObject* parent )
: QgsLayerTreeModel( rootNode, parent )
{
setFlag( QgsLayerTreeModel::AllowLegendChangeState, false );
setFlag( QgsLayerTreeModel::AllowNodeReorder, true );
}
示例11: DiagramCanvas
ArrowPointCanvas::ArrowPointCanvas(UmlCanvas * canvas, int x, int y)
: DiagramCanvas(0, canvas, x, y, ARROW_POINT_SIZE, ARROW_POINT_SIZE, -1)
{
browser_node = canvas->browser_diagram();
setFlag(QGraphicsItem::ItemIsSelectable, true);
}
示例12: setFlag
void Letter::setJoin() {
setFlag(QGraphicsItem::ItemIsMovable, false);
setBrush(QColor("#555555"));
setCursor(Qt::ArrowCursor);
m_movable = false;
}
示例13: setReadOnly
inline void setReadOnly(bool set = true)
{ setFlag(flags, flagIsReadOnly, set); }
示例14: mMapKey
YigSynthGraphic::YigSynthGraphic(QString synthType, QString mapKey, const QPointF &point, float param1, float param2,
int outBus, QGraphicsScene *scene) :
mMapKey(mapKey),
audioOutBus(outBus),
selectingUser(" "),
QGraphicsEllipseItem(0, 0, ELLIPSE_SIZE, ELLIPSE_SIZE, 0)
{
mSynthType = synthType;
autoCableCounter = 0;
moveBy(point.x(), point.y());
setFlag( QGraphicsItem::ItemIsSelectable, true );
setFlag( QGraphicsItem::ItemIsMovable, true );
setFlag(QGraphicsItem::ItemSendsGeometryChanges);
setZValue(10);
//setCacheMode(QGraphicsItem::DeviceCoordinateCache);
//setAcceptsHoverEvents(true);
// MOD FIELD 1
modField1 = new YigModField(this, param1, 0, 0, MOD_FIELD_SIZE, MOD_FIELD_SIZE, this);
modField1->moveBy((-MOD_FIELD_SIZE/2) + (ELLIPSE_SIZE/2), (-MOD_FIELD_SIZE/2) + (ELLIPSE_SIZE/2));
modField1->setFlag( QGraphicsItem::ItemIsSelectable, true );
modField1->setFlag( QGraphicsItem::ItemIsMovable, false );
QColor outlineColor = YigColorKit::background2;
pen.setColor(QColor(0, 0, 0, 25));
pen.setColor( outlineColor );
modField1->setPen( pen );
//modField1->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
/*
QRadialGradient gradient(QPointF(MOD_FIELD_SIZE/2, MOD_FIELD_SIZE/2), MOD_FIELD_SIZE/2,
QPointF(MOD_FIELD_SIZE/2, MOD_FIELD_SIZE/2));
gradient.setColorAt(0, QColor(0, 0, 0, 0));
gradient.setColorAt(0.3, QColor(0, 0, 0, 100));
gradient.setColorAt(0.75, QColor(0, 0, 0, 170));
gradient.setColorAt(1, QColor(0, 0, 0, 50));
QBrush radialBrush(gradient);*/
//modField1->setBrush( QColor(0, 0, 0, 160) );
modField1->setBrush(Qt::NoBrush);
QColor modColor = YigColorKit::background2;
modColor.setAlpha(150);
//brush.setColor(modColor);
//modField1->setBrush(QBrush(modColor));
modField1->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
modField1->setZValue(0);
//modField1->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
// MOD FIELD 2
modField2 = new YigModField2(this, param2, 0, 0, MOD_FIELD_2_SIZE, MOD_FIELD_2_SIZE, this);
modField2->moveBy(((-MOD_FIELD_2_SIZE/2) + (ELLIPSE_SIZE/2)), ((-MOD_FIELD_2_SIZE/2) + (ELLIPSE_SIZE/2)));
modField2->setFlag( QGraphicsItem::ItemIsSelectable, true );
modField2->setFlag( QGraphicsItem::ItemIsMovable, false );
//modField2->setPen( pen );
modField2->setPen(Qt::NoPen);
/*
QRadialGradient gradient2(QPointF(MOD_FIELD_2_SIZE/2, MOD_FIELD_2_SIZE/2), MOD_FIELD_2_SIZE/2,
QPointF(MOD_FIELD_2_SIZE/2, MOD_FIELD_2_SIZE/2));
gradient2.setColorAt(0, QColor(255, 255, 255, 0));
gradient2.setColorAt(0.5, QColor(0, 0, 0, 0));
gradient2.setColorAt(0.7, QColor(255, 255, 255, 160));
gradient2.setColorAt(0.8, QColor(255, 255, 255, 160));
gradient2.setColorAt(0.95, QColor(255, 255, 255, 100));
gradient2.setColorAt(1, QColor(0, 0, 0, 100));
QBrush radialBrush2(gradient2);
modField2->setBrush( radialBrush2 );*/
modField2->setBrush(Qt::NoBrush);
//modColor = YigColorKit::focus1Highlight;
//modColor.setAlpha(100);
//modField2->setBrush(modColor);
//modField2->setCacheMode(QGraphicsItem::DeviceCoordinateCache);;
modField2->setFlag(QGraphicsItem::ItemStacksBehindParent);
//modField2->setZValue(3);
//modField2->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
// AUDIO OUTPUT
/*
audioOutput = new YigEllipseItem( this, 0, 0, SMALL_ELLIPSE_SIZE, SMALL_ELLIPSE_SIZE, this );
//audioOutput->moveBy((ELLIPSE_SIZE/2) - (SMALL_ELLIPSE_SIZE/2), ELLIPSE_SIZE - SMALL_ELLIPSE_SIZE);
audioOutput->moveBy(7.5 + TRI_OFFSET_X, 7.5*SQRT_THREE + TRI_OFFSET_Y);
audioOutput->setFlag( QGraphicsItem::ItemIsSelectable, false );
audioOutput->setFlag( QGraphicsItem::ItemIsMovable, false );
audioOutput->setCacheMode(QGraphicsItem::DeviceCoordinateCache);*/
// AUDIO INPUT
/*
audioInput = new YigEllipseItem( this, 0, 0, SMALL_ELLIPSE_SIZE, SMALL_ELLIPSE_SIZE, this );
//audioInput->moveBy((ELLIPSE_SIZE/2) - (SMALL_ELLIPSE_SIZE/2), 0);
audioInput->moveBy(0 + TRI_OFFSET_X, 0 + TRI_OFFSET_Y);*/
audioInput = new QGraphicsEllipseItem(0, 0, AUDIO_ELLIPSE_SIZE, AUDIO_ELLIPSE_SIZE, this);
audioInput->moveBy((ELLIPSE_SIZE/2) - (AUDIO_ELLIPSE_SIZE/2), (ELLIPSE_SIZE/2) - (AUDIO_ELLIPSE_SIZE/2));
audioInput->setFlag( QGraphicsItem::ItemIsSelectable, false );
//.........这里部分代码省略.........
示例15: SetupDebug
void SetupDebug(void)
{
char var[256];
_DBPRINTF("** TextEditor.mcp v" LIB_REV_STRING " startup **********************\n");
_DBPRINTF("Exec version: v%ld.%ld\n", ((struct Library *)SysBase)->lib_Version, ((struct Library *)SysBase)->lib_Revision);
_DBPRINTF("Initializing runtime debugging:\n");
if(GetVar("texteditor.mcp.debug", var, sizeof(var), 0) > 0)
{
char *s = var;
// static list of our debugging classes tokens.
// in the texteditor.mcp.debug variable these classes always start with a @
static const struct { const char *token; unsigned long flag; } dbclasses[] =
{
{ "ctrace", DBC_CTRACE },
{ "report", DBC_REPORT },
{ "assert", DBC_ASSERT },
{ "timeval", DBC_TIMEVAL },
{ "debug", DBC_DEBUG },
{ "error", DBC_ERROR },
{ "warning", DBC_WARNING },
{ "mtrack", DBC_MTRACK },
{ "all", DBC_ALL },
{ NULL, 0 }
};
static const struct { const char *token; unsigned long flag; } dbflags[] =
{
{ "always", DBF_ALWAYS },
{ "startup", DBF_STARTUP },
{ "all", DBF_ALL },
{ NULL, 0 }
};
// we parse the env variable token-wise
while(*s)
{
ULONG i;
char *e;
if((e = strpbrk(s, " ,;")) == NULL)
e = s+strlen(s);
// check if the token is class definition or
// just a flag definition
if(s[0] == '@')
{
// check if this call is a negation or not
if(s[1] == '!')
{
// search for the token and clear the flag
for(i=0; dbclasses[i].token; i++)
{
if(strnicmp(&s[2], dbclasses[i].token, strlen(dbclasses[i].token)) == 0)
{
_DBPRINTF("clear '%s' debug class flag.\n", dbclasses[i].token);
clearFlag(debug_classes, dbclasses[i].flag);
}
}
}
else
{
// search for the token and set the flag
for(i=0; dbclasses[i].token; i++)
{
if(strnicmp(&s[1], dbclasses[i].token, strlen(dbclasses[i].token)) == 0)
{
_DBPRINTF("set '%s' debug class flag\n", dbclasses[i].token);
setFlag(debug_classes, dbclasses[i].flag);
}
}
}
}
else
{
// check if this call is a negation or not
if(s[0] == '!')
{
for(i=0; dbflags[i].token; i++)
{
if(strnicmp(&s[1], dbflags[i].token, strlen(dbflags[i].token)) == 0)
{
_DBPRINTF("clear '%s' debug flag\n", dbflags[i].token);
clearFlag(debug_flags, dbflags[i].flag);
}
}
}
else
{
// check if the token was "ansi" and if so enable the ANSI color
// output
if(strnicmp(s, "ansi", 4) == 0)
{
_DBPRINTF("ansi output enabled\n");
ansi_output = TRUE;
}
else
{
//.........这里部分代码省略.........