QGVEdge::QGVEdge(QGVEdgePrivate *edge, QGVScene *scene) : _edge(edge), _scene(scene) { setFlag(QGraphicsItem::ItemIsSelectable, true); }
//! [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] }
QQuickCanvasItem::QQuickCanvasItem(QQuickItem *parent) : QQuickItem(*(new QQuickCanvasItemPrivate), parent) { setFlag(ItemHasContents); }
/////////////////////////////////////////////////////////////////////////////// // QSGVlcVideoFrameMaterial QSGVlcVideoFrameMaterial::QSGVlcVideoFrameMaterial() : m_frame( 0 ) { memset( m_planeTexIds, 0, sizeof( m_planeTexIds ) ); setFlag( Blending, false ); }
AndroidRotationControl::AndroidRotationControl(Shuttle *shuttle) : m_shuttle(shuttle), width(200), height(200) { setFlag(QGraphicsItem::ItemIsFocusable); setAcceptTouchEvents(true); }
void BackgroundItem::setBackground( QPixmap *pixmap, PlacementType _parentRelativeType, Meta *_meta, BackgroundMeta &_background, BorderMeta &_border, MarginsMeta &_margin, StringListMeta &_subModel, int _submodelLevel, QString &toolTip) { meta = _meta; background = _background; border = _border; margin = _margin; 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); }
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; }
inline static UINT8 setFlagTo(UINT8 ccr, UINT8 flag, bool set) { return set ? setFlag(ccr, flag) : clearFlag(ccr, flag); }
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 ""; }
QgsLegendModelV2::QgsLegendModelV2( QgsLayerTreeGroup* rootNode, QObject* parent ) : QgsLayerTreeModel( rootNode, parent ) { setFlag( QgsLayerTreeModel::AllowLegendChangeState, false ); setFlag( QgsLayerTreeModel::AllowNodeReorder, true ); }
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); }
void Letter::setJoin() { setFlag(QGraphicsItem::ItemIsMovable, false); setBrush(QColor("#555555")); setCursor(Qt::ArrowCursor); m_movable = false; }
inline void setReadOnly(bool set = true) { setFlag(flags, flagIsReadOnly, set); }
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 ); audioInput->setFlag( QGraphicsItem::ItemIsMovable, false ); //audioInput->setCacheMode(QGraphicsItem::DeviceCoordinateCache); audioInput->setZValue(20); // MOD INPUT /* modInput = new YigEllipseItem( this, 0, 0, SMALL_ELLIPSE_SIZE, SMALL_ELLIPSE_SIZE, this ); //modInput->moveBy(0, (ELLIPSE_SIZE/2) - (SMALL_ELLIPSE_SIZE/2)); modInput->moveBy(15 + TRI_OFFSET_X, 0 + TRI_OFFSET_Y);*/ modInput = new QGraphicsEllipseItem(0, 0, MOD_ELLIPSE_SIZE, MOD_ELLIPSE_SIZE, this); modInput->moveBy((ELLIPSE_SIZE/2) - (MOD_ELLIPSE_SIZE/2), (ELLIPSE_SIZE/2) - (MOD_ELLIPSE_SIZE/2)); modInput->setFlag( QGraphicsItem::ItemIsSelectable, false ); modInput->setFlag( QGraphicsItem::ItemIsMovable, false ); //modInput->setCacheMode(QGraphicsItem::DeviceCoordinateCache); modInput->setZValue(20); // Synth Label synthLabel = new QGraphicsSimpleTextItem(this); synthLabel->moveBy( ELLIPSE_SIZE + 5, ELLIPSE_SIZE/2 - 4); synthLabel->setText(synthType); //QFont labelFont("Helvetica [Cronyx]", 11); QFont labelFont("monaco", 10); synthLabel->setFont(labelFont); synthLabel->setFlag( QGraphicsItem::ItemIsSelectable, false ); synthLabel->setFlag( QGraphicsItem::ItemIsMovable, false ); //synthLabel->setPen(YigColorKit::accent); //synthLabel->setCacheMode(QGraphicsItem::DeviceCoordinateCache); synthLabel->setCacheMode(QGraphicsItem::DeviceCoordinateCache); outlineColor = QColor( 0, 0, 0, 255 ); pen.setColor( outlineColor ); audioInput->setPen(Qt::NoPen); //audioOutput->setPen(pen); modInput->setPen(Qt::NoPen); /* QRadialGradient gradient3(QPointF(ELLIPSE_SIZE/2, ELLIPSE_SIZE/2), ELLIPSE_SIZE/2, QPointF(ELLIPSE_SIZE/2, ELLIPSE_SIZE/2)); gradient3.setColorAt(0, QColor(0, 0, 0, 255)); gradient3.setColorAt(0.8, QColor(0, 0, 0, 255)); gradient3.setColorAt(1, QColor(0, 0, 0, 0));*/ //setCacheMode( QGraphicsItem::DeviceCoordinateCache ); /* QRadialGradient gradient4(QPointF(AUDIO_ELLIPSE_SIZE/2, AUDIO_ELLIPSE_SIZE/2), AUDIO_ELLIPSE_SIZE/2, QPointF(AUDIO_ELLIPSE_SIZE/2, AUDIO_ELLIPSE_SIZE/2)); gradient4.setColorAt(0, QColor(0, 0, 0, 255)); gradient4.setColorAt(0.9, QColor(33, 33, 33, 255)); gradient4.setColorAt(1, QColor(0, 0, 0, 255)); audioInput->setBrush( QBrush(gradient4) );*/ audioInput->setBrush(Qt::NoBrush); audioInput->setPen(Qt::NoPen); /* QRadialGradient gradient5(QPointF(MOD_ELLIPSE_SIZE/2, MOD_ELLIPSE_SIZE/2), MOD_ELLIPSE_SIZE/2, QPointF(MOD_ELLIPSE_SIZE/2, MOD_ELLIPSE_SIZE/2)); gradient5.setColorAt(0, YigColorKit::accent); gradient5.setColorAt(0.85, YigColorKit::accent); gradient5.setColorAt(1, QColor(0, 0, 0)); modInput->setBrush( gradient5 ); modInput->setPen(Qt::NoPen);*/ // Arrows audioInArrow = new YigSignalArrow(AUDIO_INPUT, this); //audioOutArrow = new YigSignalArrow(AUDIO_OUTPUT, this); modInArrow = new YigSignalArrow(MOD_INPUT, this); //audioInput->setCacheMode( QGraphicsItem::DeviceCoordinateCache ); //modInput->setCacheMode( QGraphicsItem::DeviceCoordinateCache ); //setCacheMode( QGraphicsItem::DeviceCoordinateCache ); audioInput->setFlag(QGraphicsItem::ItemHasNoContents); modInput->setFlag(QGraphicsItem::ItemHasNoContents); //setFlag(QGraphicsItem::ItemHasNoContents); modField1->setFlag(QGraphicsItem::ItemHasNoContents); modField2->setFlag(QGraphicsItem::ItemHasNoContents); /* audioInput->setZValue(25); QColor penColor = YigColorKit::background2; penColor.setAlpha(200); pen = QPen(penColor); pen.setWidth(2);*/ //setBrush(gradient3); setBrush(Qt::NoBrush); setPen(Qt::NoPen); scene->addItem(this); }
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 { for(i=0; dbflags[i].token; i++) { if(strnicmp(s, dbflags[i].token, strlen(dbflags[i].token)) == 0) { _DBPRINTF("set '%s' debug flag\n", dbflags[i].token); setFlag(debug_flags, dbflags[i].flag); } } } } } // set the next start to our last search if(*e) s = ++e; else break; } } _DBPRINTF("set debug classes/flags (env:texteditor.mcp.debug): %08lx/%08lx\n", debug_classes, debug_flags); _DBPRINTF("** Normal processing follows ***************************************\n"); SetupDbgMalloc(); }
void SCgTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { setFlag(QGraphicsItem::ItemIsMovable, false); QGraphicsTextItem::mouseReleaseEvent(event); }
void ChapterCWriter::calculateChapter ( ) { _chapter = ( uint8 * ) realloc ( _chapter, 1 ); if ( _chapter == NULL ) { cerr << "realloc failed !" << endl; exit ( EXIT_FAILURE ); } memset ( _chapter, 0, 1 ); setFlag ( & _chapter[0], 0, 1 ); uint8 * position = _chapter + 1; unsigned short len = 0; for ( list<TCtrlInfo>::iterator i = _history.begin ( ) ; i != _history.end ( ) ; i++ ) { if ( ( * i ).payload >= checkpoint ( ) ) { if ( _tool[( * i ).number] & TOGGLE_TOOL ) { len++; _chapterLength = position - _chapter; _chapter = ( uint8 * ) realloc ( _chapter, _chapterLength + 2 ); if ( _chapter == NULL ) { cerr << "realloc failed !" << endl; exit ( EXIT_FAILURE ); } position = _chapter + _chapterLength; position[0] = 0x80; // S if ( ( * i ).payload == currentPayloadNumber ( ) - 1 ) { setFlag ( & position[0], 0, 0 ); setFlag ( & _chapter[0], 0, 0 ); unsetParentSBit ( ); } // NUMBER position[0] |= ( * i ).number; // A + T position[1] = 0xC0; // VALUE position[1] |= ( * i ).toggle; position += 2; } if ( _tool[( * i ).number] & VALUE_TOOL ) { len++; _chapterLength = position - _chapter; _chapter = ( uint8 * ) realloc ( _chapter, _chapterLength + 2 ); if ( _chapter == NULL ) { cerr << "realloc failed !" << endl; exit ( EXIT_FAILURE ); } position = _chapter + _chapterLength; // S setFlag ( & position[0], 0, 1 ); if ( ( * i ).payload == currentPayloadNumber ( ) - 1 ) { setFlag ( & position[0], 0, 0 ); setFlag ( & _chapter[0], 0, 0 ); unsetParentSBit ( ); } // NUMBER position[0] |= ( * i ).number; // A position[1] = 0x00; // VALUE position[1] |= ( * i ).value; position += 2; } if ( _tool[( * i ).number] & COUNT_TOOL ) { len++; _chapterLength = position - _chapter; _chapter = ( uint8 * ) realloc ( _chapter, _chapterLength + 2 ); if ( _chapter == NULL ) { cerr << "realloc failed !" << endl; exit ( EXIT_FAILURE ); } position = _chapter + _chapterLength; // S setFlag ( & position[0], 0, 1 ); if ( ( * i ).payload == currentPayloadNumber ( ) - 1 ) { setFlag ( & position[0], 0, 0 ); setFlag ( & _chapter[0], 0, 0 ); unsetParentSBit ( ); } // NUMBER position[0] |= ( * i ).number; // A position[1] = 0x80; // VALUE position[1] |= ( * i ).count; position += 2; } } } _chapter[0] |= len - 1; if ( len != 0 ) { _chapterLength = 1 + len * 2; } else { _chapterLength = 0; } }
void SCgTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (parentItem()->isSelected()) setFlag(QGraphicsItem::ItemIsMovable); QGraphicsTextItem::mousePressEvent(event); }
void receive_DISC(int fd, char *DISC_rec) { char flag_ST; int option = START; while(!(STOP_DISC)){ read(fd, &flag_ST, 1); int flag = getFlag(); if(flag && flag != -1){ alarm(0); setFlag(-1); STOP_DISC = TRUE; } switch (option){ case START: if (flag_ST == F){ option = FLAG_RCV; DISC_rec[0] = flag_ST; } else option = START; break; case FLAG_RCV: if (flag_ST == F) { option = FLAG_RCV; DISC_rec[0] = flag_ST; } else if (flag_ST == A){ option = A_RCV; DISC_rec[1] = flag_ST; } else option = START; break; case A_RCV: if (flag_ST == F){ option = FLAG_RCV; DISC_rec[0] = flag_ST; } else if (flag_ST == C_DISC){ option = C_RCV; DISC_rec[2] = flag_ST; } else option = START; break; case C_RCV: if (flag_ST == F){ option = FLAG_RCV; DISC_rec[0] = flag_ST; } else if (flag_ST == BCC_DISC){ option = BCC_OK; DISC_rec[3] = flag_ST; } else option = START; break; case BCC_OK: if (flag_ST == F){ option = STOP_ST; STOP_DISC = TRUE; DISC_rec[4] = flag_ST; } else option = START; break; case STOP_ST: STOP_DISC = TRUE; break; default: break; } } }
/* Descrition: To display different LED patterns accroding to input Inut: 1, 2, 3, 4 Outut: None */ void ledptn(unsigned char pattern) { if (pattern == 1) { setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x01); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x02); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x04); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x08); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x10); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x20); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x40); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x80); delayms(DELAY_TIME);} } else if (pattern == 2) { setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x80); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x40); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x20); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x10); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x08); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x04); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x02); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x01); delayms(DELAY_TIME);} } else if (pattern == 3) { setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x81); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x42); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x24); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x18); delayms(DELAY_TIME);} setFlag(); } else if (pattern == 4) { setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x18); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x24); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x42); delayms(DELAY_TIME);} setFlag(); if (chkFlag() == 0) { PORT_LED=led(0x81); delayms(DELAY_TIME);} setFlag(); } } /* ledptn */
void receive_UA(int fd, char *UA) { int option = START; char flag_ST; while(!(STOP_UA)) { //fprintf(stderr, "flag %d\n", getFlag()); read(fd, &flag_ST, 1); int flag = getFlag(); //fprintf(stderr, "option %d, flag_ST %x flag %d\n",option, flag_ST,flag); if(flag && flag != -1){ alarm(0); setFlag(-1); STOP_UA = TRUE; } switch (option){ case START: if (flag_ST == F){ option = FLAG_RCV; UA[0] = flag_ST; } else option = START; break; case FLAG_RCV: if (flag_ST == F){ option = FLAG_RCV; UA[0] = flag_ST; } else if (flag_ST == A){ option = A_RCV; UA[1] = flag_ST; } else option = START; break; case A_RCV: if (flag_ST == F){ option = FLAG_RCV; UA[0] = flag_ST; } else if (flag_ST == C_UA){ option = C_RCV; UA[2] = flag_ST; } else option = START; break; case C_RCV: if (flag_ST == F){ option = FLAG_RCV; UA[0] = flag_ST; } else if (flag_ST == BCC_UA){ option = BCC_OK; UA[3] = flag_ST; } else option = START; break; case BCC_OK: if (flag_ST == F){ option = STOP_ST; STOP_UA = TRUE; UA[4] = flag_ST; } else option = START; break; case STOP_ST: STOP_UA = TRUE; break; default: break; } } }
/*! * Constructs a new QQuickFramebufferObject with parent \a parent. */ QQuickFramebufferObject::QQuickFramebufferObject(QQuickItem *parent) : QQuickItem(*new QQuickFramebufferObjectPrivate, parent) { setFlag(ItemHasContents); }
Fingering::Fingering(Score* s) : Text(s) { setTextStyle(s->textStyle(TEXT_STYLE_FINGERING)); setFlag(ELEMENT_HAS_TAG, true); }
void Tile::setTileFlags(const Item* item) { if (!hasFlag(TILESTATE_FLOORCHANGE)) { const ItemType& it = Item::items[item->getID()]; if (it.floorChange != 0) { setFlag(it.floorChange); } } if (item->hasProperty(CONST_PROP_IMMOVABLEBLOCKSOLID)) { setFlag(TILESTATE_IMMOVABLEBLOCKSOLID); } if (item->hasProperty(CONST_PROP_BLOCKPATH)) { setFlag(TILESTATE_BLOCKPATH); } if (item->hasProperty(CONST_PROP_NOFIELDBLOCKPATH)) { setFlag(TILESTATE_NOFIELDBLOCKPATH); } if (item->hasProperty(CONST_PROP_IMMOVABLENOFIELDBLOCKPATH)) { setFlag(TILESTATE_IMMOVABLENOFIELDBLOCKPATH); } if (item->getTeleport()) { setFlag(TILESTATE_TELEPORT); } if (item->getMagicField()) { setFlag(TILESTATE_MAGICFIELD); } if (item->getMailbox()) { setFlag(TILESTATE_MAILBOX); } if (item->getTrashHolder()) { setFlag(TILESTATE_TRASHHOLDER); } if (item->hasProperty(CONST_PROP_BLOCKSOLID)) { setFlag(TILESTATE_BLOCKSOLID); } if (item->getBed()) { setFlag(TILESTATE_BED); } const Container* container = item->getContainer(); if (container && container->getDepotLocker()) { setFlag(TILESTATE_DEPOT); } if (item->hasProperty(CONST_PROP_SUPPORTHANGABLE)) { setFlag(TILESTATE_SUPPORTS_HANGABLE); } }
LabelItem::LabelItem ( const QString& str, QGraphicsItem* parent, QGraphicsScene* scene ) : QGraphicsTextItem ( parent, scene ) { setPlainText ( str ); setFlag ( QGraphicsItem::ItemIsMovable, false ); setFlag ( QGraphicsItem::ItemIsSelectable, false ); }
PieSlice::PieSlice(QDeclarativeItem *parent) : QDeclarativeItem(parent) { // need to disable this flag to draw inside a QDeclarativeItem setFlag(QGraphicsItem::ItemHasNoContents, false); }
MyItem::MyItem() { setAcceptHoverEvents(true); setFlag(QGraphicsItem::ItemIsMovable, true); // installSceneEventFilter(this); }
void UserConnection::on(BufferedSocketListener::Line, const string& aLine) throw () { if(aLine.length() < 2) return; if(aLine[0] == 'C' && !isSet(FLAG_NMDC)) { dispatch(aLine); return; } else if(aLine[0] == '$') { setFlag(FLAG_NMDC); } else { // We shouldn't be here? dcdebug("Unknown UserConnection command: %.50s\n", aLine.c_str()); return; } string cmd; string param; string::size_type x; if( (x = aLine.find(' ')) == string::npos) { cmd = aLine; } else { cmd = aLine.substr(0, x); param = aLine.substr(x+1); } if(cmd == "$MyNick") { if(!param.empty()) fire(UserConnectionListener::MyNick(), this, Text::acpToUtf8(param)); } else if(cmd == "$Direction") { x = param.find(" "); if(x != string::npos) { fire(UserConnectionListener::Direction(), this, param.substr(0, x), param.substr(x+1)); } } else if(cmd == "$Error") { if(Util::stricmp(param.c_str(), FILE_NOT_AVAILABLE) == 0 || param.rfind(/*path/file*/" no more exists") != string::npos) { fire(UserConnectionListener::FileNotAvailable(), this); } else { fire(UserConnectionListener::Failed(), this, param); } } else if(cmd == "$FileLength") { if(!param.empty()) fire(UserConnectionListener::FileLength(), this, Util::toInt64(param)); } else if(cmd == "$GetListLen") { fire(UserConnectionListener::GetListLength(), this); } else if(cmd == "$Get") { notSupported(); disconnect(); StringMap params; params["user"] = getUser()->getNick(); params["hub"] = getUser()->getClientUrl(); params["ip"] = getRemoteIp(); string tmp = Util::formatParams(STRING(OLD_CLIENT), params, false); LogManager::getInstance()->message(tmp); } else if(cmd == "$GetZBlock" || cmd == "$UGetZBlock" || cmd == "$UGetBlock") { notSupported(); disconnect(); StringMap params; params["user"] = getUser()->getNick(); params["hub"] = getUser()->getClientUrl(); params["ip"] = getRemoteIp(); string tmp = Util::formatParams(STRING(OLD_CLIENT), params, false); LogManager::getInstance()->message(tmp); } else if(cmd == "$Key") { if(!param.empty()) fire(UserConnectionListener::Key(), this, param); } else if(cmd == "$Lock") { if(!param.empty()) { x = param.find(" Pk="); if(x != string::npos) { fire(UserConnectionListener::CLock(), this, param.substr(0, x), param.substr(x + 4)); } else { // Workaround for faulty linux clients... x = param.find(' '); if(x != string::npos) { setFlag(FLAG_INVALIDKEY); fire(UserConnectionListener::CLock(), this, param.substr(0, x), Util::emptyString); } else { fire(UserConnectionListener::CLock(), this, param, Util::emptyString); } } } } else if(cmd == "$Send") { fire(UserConnectionListener::Send(), this); } else if(cmd == "$Sending") { int64_t bytes = -1; if(!param.empty()) bytes = Util::toInt64(param); fire(UserConnectionListener::Sending(), this, bytes); } else if(cmd == "$MaxedOut") { fire(UserConnectionListener::MaxedOut(), this); } else if(cmd == "$Supports") { if(!param.empty()) { fire(UserConnectionListener::Supports(), this, StringTokenizer<string>(param, ' ').getTokens()); } } else if(cmd.compare(0, 4, "$ADC") == 0) { dispatch(aLine, true); } else { dcdebug("Unknown NMDC command: %.50s\n", aLine.c_str()); } }
GameWindow::GameWindow(int sizeX, int sizeY, int minesNumber) : QMainWindow(), ui(new Ui::GameWindow) { ui->setupUi(this); QPixmap background(":/resources/images/options_background.jpg"); QPalette qPalette; qPalette.setBrush(this->backgroundRole(),QBrush(background)); this->setPalette(qPalette); sizeOfFieldX = sizeX; sizeOfFieldY = sizeY; minesInTheField = minesNumber; core = new Field(sizeOfFieldX, sizeOfFieldY, minesInTheField); fieldLayout = new QGridLayout; backButton = new QPushButton("Back to menu"); backButton->setStyleSheet(QPushButtonStyle); backButton->setFixedSize(175,50); refreshButton = new QPushButton("Refresh game"); refreshButton->setStyleSheet(QPushButtonStyle); refreshButton->setFixedSize(175,50); QObject::connect(backButton, SIGNAL(clicked(bool)), this, SLOT(backToMenu())); QObject::connect(refreshButton, SIGNAL(clicked(bool)), this, SLOT(refreshGame())); mainFieldLayout = new QVBoxLayout; panelLayout = new QVBoxLayout; mainLayout = new QHBoxLayout; vector<QMyPushButton*> tmpVect; for (int i = 0; i < core->getSizeX(); i++) { for (int j = 0; j < core->getSizeY(); j++) { QMyPushButton* newButton; tmpVect.push_back(newButton); } buttons.push_back(tmpVect); } QLabel *fieldHeight = new QLabel("Height of field: "); fieldHeight->setStyleSheet(QLabelStyle); QLabel *fieldLength = new QLabel("Length of field: "); fieldLength->setStyleSheet(QLabelStyle); QLabel *allCells = new QLabel("Cells in the field:"); allCells->setStyleSheet(QLabelStyle); QLabel *cellsLeft = new QLabel("Cells left: "); cellsLeft->setStyleSheet(QLabelStyle); QLabel *minesLeft = new QLabel("Mines left: "); minesLeft->setStyleSheet(QLabelStyle); QLabel *flagsLeft = new QLabel("You have flags: "); flagsLeft->setStyleSheet(QLabelStyle); fieldHeightNumber = new QLabel(QString::number(core->getSizeX())); fieldHeightNumber->setStyleSheet(QLabelStyle); fieldLengthNumber = new QLabel(QString::number(core->getSizeY())); fieldLengthNumber->setStyleSheet(QLabelStyle); allCellsNumber = new QLabel(QString::number(core->getSizeX() * core->getSizeY())); allCellsNumber->setStyleSheet(QLabelStyle); cellsLeftNumber = new QLabel(QString::number(core->cellsLeft)); cellsLeftNumber->setStyleSheet(QLabelStyle); minesLeftNumber = new QLabel(QString::number(core->minesLeft)); minesLeftNumber->setStyleSheet(QLabelStyle); flagsLeftNumber = new QLabel(QString::number(core->flagsLeft)); flagsLeftNumber->setStyleSheet(QLabelStyle); QHBoxLayout *panelHorizontal1 = new QHBoxLayout; panelHorizontal1->addWidget(fieldHeight); panelHorizontal1->addWidget(fieldHeightNumber); QHBoxLayout *panelHorizontal2 = new QHBoxLayout; panelHorizontal2->addWidget(fieldLength); panelHorizontal2->addWidget(fieldLengthNumber); QHBoxLayout *panelHorizontal3 = new QHBoxLayout; panelHorizontal3->addWidget(allCells); panelHorizontal3->addWidget(allCellsNumber); QHBoxLayout *panelHorizontal4 = new QHBoxLayout; panelHorizontal4->addWidget(cellsLeft); panelHorizontal4->addWidget(cellsLeftNumber); QHBoxLayout *panelHorizontal5 = new QHBoxLayout; panelHorizontal5->addWidget(minesLeft); panelHorizontal5->addWidget(minesLeftNumber); QHBoxLayout *panelHorizontal6 = new QHBoxLayout; panelHorizontal6->addWidget(flagsLeft); panelHorizontal6->addWidget(flagsLeftNumber); //timer = new QTimer; //timer->start(10000); panelLayout = new QVBoxLayout; mainPanelLayout = new QVBoxLayout; panelBox = new QGroupBox; panelLayout->addSpacing(5); panelLayout->addLayout(panelHorizontal1); panelLayout->addLayout(panelHorizontal2); panelLayout->addLayout(panelHorizontal3); panelLayout->addLayout(panelHorizontal4); panelLayout->addLayout(panelHorizontal5); panelLayout->addLayout(panelHorizontal6); panelBox->setLayout(panelLayout); mainPanelLayout->addWidget(panelBox); //mainPanelLayout->addWidget(timer); mainPanelLayout->addStretch(1); mainPanelLayout->addWidget(refreshButton); mainPanelLayout->addWidget(backButton); mainPanelLayout->setSpacing(20); for (int i = 0; i < core->getSizeX(); i++) for (int j = 0; j < core->getSizeY(); j++) { buttons[i][j] = new QMyPushButton; fieldButtonSize = new QSize(32,32); buttons[i][j]->setStyleSheet(QFieldButtonStyle); buttons[i][j]->setFixedSize(*fieldButtonSize); //buttons[i][j]->setText("Do it!"); fieldLayout->addWidget(buttons[i][j], i, j, 1, 1); buttons[i][j]->setProperty("coordinates", i * 1000 + j); connect(buttons[i][j], SIGNAL(pressed()), this, SLOT(clickedLeft())); connect(buttons[i][j], SIGNAL(rClicked()), this, SLOT(setFlag())); //QMyPushButton *but = new QMyPushButton; //connect(but, SIGNAL()) } //mainFieldLayout->addSpacing(15); fieldLayout->setSpacing(0); mainFieldLayout->addLayout(fieldLayout); //mainLayout->addSpacing(15); mainLayout->addLayout(mainFieldLayout); mainLayout->addSpacing(25); mainLayout->addLayout(mainPanelLayout); //mainLayout->addSpacing(15); QWidget *centralWidget = new QWidget; centralWidget->setLayout(mainLayout); this->setCentralWidget(centralWidget); this->setWindowTitle("Minesweeper TOP Game"); this->setWindowIcon(QIcon(":/resources/images/icon.png")); connect(this, SIGNAL(allCellsOpen()), this, SLOT(winGame())); connect(this, SIGNAL(allah_BABAH()), this, SLOT(loseGame())); }
AbstractContent::AbstractContent(QGraphicsScene *scene, bool fadeIn, bool noRescale, QGraphicsItem * parent) : AbstractDisposeable(fadeIn, parent) , m_contentRect(-100, -75, 200, 150) , m_frame(0) , m_frameTextItem(0) , m_controlsVisible(false) , m_dirtyTransforming(false) , m_transformRefreshTimer(0) , m_gfxChangeTimer(0) , m_mirrorItem(0) #if QT_VERSION < 0x040600 , m_rotationAngle(0) #endif , m_fxIndex(0) { // the buffered graphics changes timer m_gfxChangeTimer = new QTimer(this); m_gfxChangeTimer->setInterval(0); m_gfxChangeTimer->setSingleShot(true); // customize item's behavior setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsSelectable); #if QT_VERSION >= 0x040600 setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); #endif // allow some items (eg. the shape controls for text) to be shown setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); setAcceptHoverEvents(true); // create child controls createCorner(Qt::TopLeftCorner, noRescale); createCorner(Qt::TopRightCorner, noRescale); createCorner(Qt::BottomLeftCorner, noRescale); createCorner(Qt::BottomRightCorner, noRescale); //ButtonItem * bFront = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-order-front.png"), this); //bFront->setToolTip(tr("Raise")); //connect(bFront, SIGNAL(clicked()), this, SLOT(slotStackRaise())); //addButtonItem(bFront); ButtonItem * bConf = new ButtonItem(ButtonItem::Control, Qt::green, QIcon(":/data/action-configure.png"), this); bConf->setToolTip(tr("Change properties...")); connect(bConf, SIGNAL(clicked()), this, SLOT(slotConfigure())); addButtonItem(bConf); ButtonItem * bPersp = new ButtonItem(ButtonItem::Control, Qt::red, QIcon(":/data/action-perspective.png"), this); bPersp->setToolTip(tr("Drag around to change the perspective.\nHold SHIFT to move faster.\nUse CTRL to cancel the transformations.")); connect(bPersp, SIGNAL(dragging(const QPointF&,Qt::KeyboardModifiers)), this, SLOT(slotSetPerspective(const QPointF&,Qt::KeyboardModifiers))); connect(bPersp, SIGNAL(doubleClicked()), this, SLOT(slotClearPerspective())); addButtonItem(bPersp); ButtonItem * bDelete = new ButtonItem(ButtonItem::Control, Qt::red, QIcon(":/data/action-delete.png"), this); bDelete->setSelectsParent(false); bDelete->setToolTip(tr("Remove")); connect(bDelete, SIGNAL(clicked()), this, SIGNAL(requestRemoval())); addButtonItem(bDelete); // create default frame Frame * frame = FrameFactory::defaultPictureFrame(); setFrame(frame); // hide and layoutChildren buttons layoutChildren(); // add to the scene scene->addItem(this); // display mirror #if QT_VERSION >= 0x040600 // WORKAROUND with Qt 4.6-tp1 there are crashes activating a mirror before setting the scene // need to rethink this anyway setMirrored(false); #else setMirrored(RenderOpts::LastMirrored); #endif }