Пример #1
0
void PixmapItem::setName(const QString &n)
{
    if(n != name)
        emit itemChange();

    name = n;
}
Пример #2
0
void PixmapItem::sourceChanged(const int &s)
{
    if(s!=source)
        emit itemChange();

    source = s;

}
QVariant  QGraphicsEllipseItem_QtDShell::__override_itemChange(int  change0, const QVariant&  value1, bool static_call)
{
    if (static_call) {
        return QGraphicsItem::itemChange((QGraphicsItem::GraphicsItemChange )change0, (const QVariant& )value1);
    } else {
        return itemChange((QGraphicsItem::GraphicsItemChange )change0, (const QVariant& )value1);
    }
}
Пример #4
0
void PixmapItem::leftChanged(const QString &left)
{
    if(left.toInt() != pos().x())
        emit itemChange();

    QPointF p = pos();
    p.setX(left.toInt());
    setPos(p);

}
Пример #5
0
void PixmapItem::topChanged(const QString &top)
{
    if(top.toInt() != pos().y())
        emit itemChange();

    QPointF p = pos();
    p.setY(top.toInt());
    setPos(p);

}
Пример #6
0
/*
  function: exeAction
  Input: 1. action: Name of the transaction being performed.
         2. code: Code of item involed in transaction
         3. line: Original line form transaction file
         4. linepos: The position in line of the data for transaction.
                     (The point in the line after transaction name and item code)

  Return: 0 on complete (value not used)

  Based on action uses switch statement to call correct function
  to perform action. 
 */
int exeAction(char *action, char *code, char *line, int linepos){

    int j;
    int act = -1;

    char* acts[5];
    acts[0] = "SALE";
    acts[1] = "DELIVERY";
    acts[2] = "NEWPRODUCT";
    acts[3] = "DELETE";
    acts[4] = "PRICE";

    //locate index of user command in opts array for switch
    for (j = 0; j < 5; j++){
        if (strcmp(action, acts[j]) == 0){
            act = j;
        }
    }

    switch(act){
        case 0:
            itemChange(action, code, line, linepos);
            break;
        case 1:
            itemChange(action, code, line, linepos);
            break;
        case 2: 
            addItem(line);
            break;
        case 3:      
            deleteItem(code);
            break;
        case 4:      
            itemChange(action, code, line, linepos);

            break;
    }
  
  return 0;

}
Пример #7
0
int ShowEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: actRemove(); break;
        case 1: actPopTop(); break;
        case 2: actPopDown(); break;
        case 3: actSizeOrig(); break;
        case 4: actSizeHalf(); break;
        case 5: actSizeAuto(); break;
        case 6: actNew(); break;
        case 7: actOpen(); break;
        case 8: actSave(); break;
        case 9: actRun(); break;
        case 10: actExit(); break;
        case 11: actSceSet(); break;
        case 12: actLineCheck(); break;
        case 13: actHelixSqrCheck(); break;
        case 14: actHelixCirCheck(); break;
        case 15: actSqrCheck(); break;
        case 16: actCubicCheck(); break;
        case 17: actCircleCheck(); break;
        case 18: actCylinderCheck(); break;
        case 19: actHalfCirCheck(); break;
        case 20: actAlbumACheck(); break;
        case 21: actArrayEditorCheck(); break;
        case 22: actTextPix((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 23: actPage(); break;
        case 24: actJpge(); break;
        case 25: actText(); break;
        case 26: actMusic(); break;
        case 27: actBuildAlbum(); break;
        case 28: actFont(); break;
        case 29: actColor(); break;
        case 30: actSetting(); break;
        case 31: actAbout(); break;
        case 32: fontChange((*reinterpret_cast< QFont(*)>(_a[1]))); break;
        case 33: activetext((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 34: itemChange((*reinterpret_cast< QListWidgetItem*(*)>(_a[1])),(*reinterpret_cast< QListWidgetItem*(*)>(_a[2]))); break;
        case 35: pageItemRemove(); break;
        default: ;
        }
        _id -= 36;
    }
    return _id;
}
Пример #8
0
void PixmapItem::setLocked(int flag) {

    if((bool)flag != isLocked)
        emit itemChange();

    isLocked = (bool)flag;

    if(isLocked) {
        setFlag(QGraphicsItem::ItemIsMovable, false);
    } else {
        setFlag(QGraphicsItem::ItemIsMovable, true);
    }


}
Пример #9
0
void PixmapItem::setPixmapFile(QString pixmapFile)
{
    if(source==1) return;

    if(pixmapFile != file)
        emit itemChange();


    file = pixmapFile;
    setPixmap(QPixmap(file));
    update();


    size.setWidth(QPixmap(file).width());
    size.setHeight(QPixmap(file).height());
}
Пример #10
0
void PixmapItem::setHeight(const QString &h)
{
    if(h.toInt() != size.height())
        emit itemChange();

    QString f = file == "" ? ":/images/gadu.png" : file;
    QPixmap p(f);

    if(source == 1)
        p = pHorux;

    size.setHeight(h.toInt());

    p = p.scaledToHeight(h.toInt(), Qt::SmoothTransformation);

    setPixmap(p);
    update();

    size.setWidth(boundingRect().width());

}
Пример #11
0
QVariant DhQGraphicsItemGroup::DvhitemChange(long x1, const QVariant& x2) {
  return itemChange((QGraphicsItem::GraphicsItemChange)x1, x2);
}
Пример #12
0
CoilItem::CoilItem(SlotItem *fromSlot, SlotItem * toSlot, WindingItem *winding, int _turns, double _x1, double _y1)
    : KoilItem(winding){


    pen           = winding->getPen();

    normalColor   = pen.color().lighter(125);
    brushColor    = normalColor;
    hoverColor    = normalColor.lighter(150);
    selectedColor = normalColor.darker(200);

    x1 = _x1;
    y1 = _y1;

    slot2 = fromSlot;
    slot1 = toSlot;
//    slot1->setL2(negative);
//    slot2->setL1(positive);
    slot1->setL2(negative, winding->getPen());
    slot2->setL1(positive, winding->getPen());

    setFlags( ItemIsSelectable | ItemIsFocusable /*| ItemIsMovable*/);
    setAcceptHoverEvents ( true );
    setZValue(-1); // The coil is behind the slots

    turns = _turns;
//    label = new QGraphicsTextItem(this);

    path = new QPainterPath();

    QPointF P1 = slot1->P2(); // recover the outer layer of slot 1
    xs1 = P1.x();
    ys1 = P1.y();
    QPointF P2 = slot2->P1(); // recover the inner layer of slot 2
    xs2 = P2.x();
    ys2 = P2.y();



    width = sqrt((xs2-xs1)*(xs2-xs1)+(ys2-ys1)*(ys2-ys1));
    if (x1<0) x1 = -width/2; // set the default values
    if (y1<0) y1 = -width/2;
    cp1 = new ControlPointItem(x1,y1,this);
    connect(cp1,SIGNAL(pointMoved(qreal,qreal)),this,SLOT(cp1Moved(qreal,qreal)));

    itemChange(ItemSelectedHasChanged, false);

    center.setX((xs1+xs2)/2);
    center.setY((ys2+ys1)/2);

    setPath();

//    // move and rotate the coil on the two slots and rotate the label
    moveBy(center.x(),center.y());
    angle = atan2(ys2-ys1,xs2-xs1)*180/pi;
    setRotation(angle);

//    //set the default incidence for the coil
    incidence = _pos;
    info = tr("Coil with %1 turns").arg(turns);
}