コード例 #1
0
ファイル: arrowitem.cpp プロジェクト: DeanWay/Cockatrice
void ArrowAttachItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    if (!startItem)
        return;

    QPointF endPos = event->scenePos();

    QList<QGraphicsItem *> colliding = scene()->items(endPos);
    ArrowTarget *cursorItem = 0;
    qreal cursorItemZ = -1;
    for (int i = colliding.size() - 1; i >= 0; i--)
        if (qgraphicsitem_cast<CardItem *>(colliding.at(i)))
            if (colliding.at(i)->zValue() > cursorItemZ) {
                cursorItem = static_cast<ArrowTarget *>(colliding.at(i));
                cursorItemZ = cursorItem->zValue();
            }

            if ((cursorItem != targetItem) && targetItem)
                targetItem->setBeingPointedAt(false);
            if (!cursorItem) {
                fullColor = false;
                targetItem = 0;
                updatePath(endPos);
            } else {
                fullColor = true;
                if (cursorItem != startItem)
                    cursorItem->setBeingPointedAt(true);
                targetItem = cursorItem;
                updatePath();
            }
            update();
}
コード例 #2
0
ファイル: tool_draw_freehand.cpp プロジェクト: FEK10/mapper
bool DrawFreehandTool::mouseMoveEvent(QMouseEvent* event, MapCoordF map_coord, MapWidget* widget)
{
	Q_UNUSED(widget);
	
	bool mouse_down = containsDrawingButtons(event->buttons());
	
	if (!mouse_down)
	{
		if (!editingInProgress())
		{
			setPreviewPointsPosition(map_coord);
			setDirtyRect();
		}
	}
	else
	{
		if (!editingInProgress())
			return false;
		
		dragging = true;
		cur_pos = event->pos();
		cur_pos_map = map_coord;
		updatePath();
	}
	return true;
}
コード例 #3
0
ファイル: cluster.cpp プロジェクト: AndreaCensi/dvs_tracking
void Cluster::addEvent(Event e){
    // add to activity history (eventsPerInterval)
    int lastEventIndex = (lastEventTS/TIME_WINDOW)%NUM_TIMESLOTS;
    int index = (e.timeStamp/TIME_WINDOW)%NUM_TIMESLOTS;
    if(lastEventIndex == index){    // if belonging to same interval, add up
        int sum = eventsPerInterval->at(index);
        eventsPerInterval->set(index,sum+1);
    }
    else{   //else reset to 0 + 1
        eventsPerInterval->set(index,1);
    }

    //add event to cluster
    events->add(e);
    if(firstEventTS == 0)
        firstEventTS = e.timeStamp;
    lifeTime = e.timeStamp - firstEventTS;

    //extract current central moment
    extractMoments(&e);

    //update the cluster path and velocity
    updatePath(e.timeStamp);
    //updateVelocity();

    lastEventTS = e.timeStamp;
}
コード例 #4
0
ファイル: RectangleShape.cpp プロジェクト: KDE/calligra
bool RectangleShape::loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context)
{
    loadOdfAttributes(element, context, OdfMandatories | OdfGeometry | OdfAdditionalAttributes | OdfCommonChildElements);

    if (element.hasAttributeNS(KoXmlNS::svg, "rx") && element.hasAttributeNS(KoXmlNS::svg, "ry")) {
        qreal rx = KoUnit::parseValue(element.attributeNS(KoXmlNS::svg, "rx", "0"));
        qreal ry = KoUnit::parseValue(element.attributeNS(KoXmlNS::svg, "ry", "0"));
        m_cornerRadiusX = rx / (0.5 * size().width()) * 100;
        m_cornerRadiusY = ry / (0.5 * size().height()) * 100;
    } else {
        QString cornerRadius = element.attributeNS(KoXmlNS::draw, "corner-radius", "");
        if (! cornerRadius.isEmpty()) {
            qreal radius = KoUnit::parseValue(cornerRadius);
            m_cornerRadiusX = qMin<qreal>(radius / (0.5 * size().width()) * 100, qreal(100));
            m_cornerRadiusY = qMin<qreal>(radius / (0.5 * size().height()) * 100, qreal(100));
        }
    }

    updatePath(size());
    updateHandles();

    loadOdfAttributes(element, context, OdfTransformation);
    loadText(element, context);

    return true;
}
コード例 #5
0
ファイル: SpiralShape.cpp プロジェクト: woylaski/kexi
void SpiralShape::setFade(qreal fade)
{
    m_fade = fade;
    updateKindHandle();
    //updateAngleHandles();
    updatePath(size());
}
コード例 #6
0
ファイル: Utils.cpp プロジェクト: TENFIRE/spotyxbmc2
 void Utils::updatePlaylist(int index) {
   //TODO FIX!
   Logger::printOut("updating playlist view");
   CStdString path;
   path.Format("musicdb://3/spotify:playlist:%i/", index);
   updatePath(path);
 }
コード例 #7
0
void KoEnhancedPathShape::addCommand( const QString &command, bool triggerUpdate )
{
    if( command.isEmpty() )
        return;

    QString commandStr = command.simplified();
    if( commandStr.isEmpty() )
        return;

    // the first character is the command
    KoEnhancedPathCommand * cmd = new KoEnhancedPathCommand( commandStr[0], this );

    // strip command char
    commandStr = commandStr.mid( 1 );

    // now parse the command parameters
    if( commandStr.length() > 0 )
    {
        QStringList tokens = commandStr.simplified().split( ' ' );
        int tokenCount = tokens.count();
        for( int i = 0; i < tokenCount; ++i )
            cmd->addParameter( parameter( tokens[i] ) );
    }
    m_commands.append( cmd );

    if( triggerUpdate )
        updatePath( size() );
}
コード例 #8
0
ファイル: paths.cpp プロジェクト: LuigiBlood/bsnes-plus
PathSettingWidget::PathSettingWidget(string &pathValue_, const char *labelText, const char *pathDefaultLabel_, const char *pathBrowseLabel_, const char *pathDefaultValue_) : pathValue(pathValue_) {
  pathDefaultLabel = pathDefaultLabel_;
  pathBrowseLabel = pathBrowseLabel_;
  pathDefaultValue = pathDefaultValue_;

  layout = new QVBoxLayout;
  layout->setMargin(0);
  layout->setSpacing(0);
  setLayout(layout);

  label = new QLabel(labelText);
  layout->addWidget(label);

  controlLayout = new QHBoxLayout;
  controlLayout->setSpacing(Style::WidgetSpacing);
  layout->addLayout(controlLayout);

  path = new QLineEdit;
  path->setReadOnly(true);
  controlLayout->addWidget(path);

  pathSelect = new QPushButton("Select ...");
  controlLayout->addWidget(pathSelect);

  pathDefault = new QPushButton("Default");
  controlLayout->addWidget(pathDefault);

  connect(pathSelect, SIGNAL(released()), this, SLOT(selectPath()));
  connect(pathDefault, SIGNAL(released()), this, SLOT(defaultPath()));
  updatePath();
}
コード例 #9
0
ファイル: ame-job-man.cpp プロジェクト: arucard21/AniDB
void AmeJobMan::setPath(AmeJob *job, wxString &path, bool parent){
	//synchronized(job){
		if(job->check(jS_DOING)) return;
		//int status = jFAILED;
		
		wxFileName orig(job->getNewFilePath().Length()>0?job->getNewFilePath():job->getAbsolutePath());
		wxString name;
		if(parent){
			wxFileName pp = orig.GetPath();
			//pp = pp.GetPath();
			name += pp.GetFullName()+wxT(FILE_SEPARATOR);
		}
		name += orig.GetFullName();
		wxString file = path+wxT(FILE_SEPARATOR)+name;
		
		if(job->getHealth()==jH_MISSING){
			job->find(file);
			A.m_db->update(dJ, 1, job);
		} else if(updatePath(job, file)){
			if(job->getNewFilePath().Length()>0)
				job->setStatus(jMOVEWAIT, true);
			//	status = jMOVEWAIT;
			//else
			//	status = jFINISHED;
			A.m_db->update(dJ, 1, job);
		}
	//}
}
コード例 #10
0
ファイル: SpiralShape.cpp プロジェクト: woylaski/kexi
void SpiralShape::setClockWise(bool clockWise)
{
    m_clockwise = clockWise;
    updateKindHandle();
    //updateAngleHandles();
    updatePath(size());
}
コード例 #11
0
ファイル: newprogramdialog.cpp プロジェクト: aelliott/GP2
NewProgramDialog::NewProgramDialog(Project *proj, QWidget *parent)
    : QDialog(parent)
    , _ui(new Ui::NewProgramDialog)
    , _project(proj)
{
    _ui->setupUi(this);

    // Load the help stylesheet and apply it to this widget
    QFile fp(":/stylesheets/helpdialog.css");
    fp.open(QIODevice::ReadOnly | QIODevice::Text);
    QString style = fp.readAll();
    setStyleSheet(style);

    // Initialise form
    // Set a default rule name as "Program"
    _ui->programNameEdit->setText("Program");

    // Set the default directory as "${projectDir}/programs"
    QDir dir = proj->dir();
    dir.cd("programs");
    _ui->programDirEdit->setText(QDir::toNativeSeparators(dir.path()));

    // Update the path field
    updatePath();
}
コード例 #12
0
void KoConnectionShape::updateConnections()
{
    Q_D(KoConnectionShape);
    bool updateHandles = false;

    if (d->handleConnected(StartHandle)) {
        if (d->shape1->hasConnectionPoint(d->connectionPointId1)) {
            // map connection point into our shape coordinates
            QPointF p = documentToShape(d->shape1->absoluteTransformation(0).map(d->shape1->connectionPoint(d->connectionPointId1).position));
            if (d->handles[StartHandle] != p) {
                d->handles[StartHandle] = p;
                updateHandles = true;
            }
        }
    }
    if (d->handleConnected(EndHandle)) {
        if (d->shape2->hasConnectionPoint(d->connectionPointId2)) {
            // map connection point into our shape coordinates
            QPointF p = documentToShape(d->shape2->absoluteTransformation(0).map(d->shape2->connectionPoint(d->connectionPointId2).position));
            if (d->handles[EndHandle] != p) {
                d->handles[EndHandle] = p;
                updateHandles = true;
            }
        }
    }

    if (updateHandles || d->forceUpdate) {
        update(); // ugly, for repainting the connection we just changed
        updatePath(QSizeF());
        update(); // ugly, for repainting the connection we just changed
        d->forceUpdate = false;
    }
}
コード例 #13
0
ファイル: File.cpp プロジェクト: hmenn/GTU-2015-CSE241-OOP-HW
File::File(const File& orig) {
    updatePath(orig.path());
    setName(orig.getName());
    setOwner(orig.getOwner());
    setSize(orig.getSize());
    setTime(orig.getTime());
}
コード例 #14
0
NewGraphDialog::NewGraphDialog(Project *proj, QWidget *parent)
    : QDialog(parent)
    , _ui(new Ui::NewGraphDialog)
    , _project(proj)
{
    _ui->setupUi(this);

    // Load the help stylesheet and apply it to this widget
    QFile fp(":/stylesheets/helpdialog.css");
    fp.open(QIODevice::ReadOnly | QIODevice::Text);
    QString style = fp.readAll();
    setStyleSheet(style);

    // Initialise form
    // Set a default rule name as "Graph"
    // _ui->graphNameEdit->setText("Graph");
    _ui->graphNameEdit->setValidator(new QRegExpValidator(QRegExp("^(\\w|\\d|\\-|_|\\.)+$"), this));

    // Set the default directory as "${projectDir}/graphs"
    QDir dir = proj->dir();
    dir.cd("graphs");
    _ui->graphDirEdit->setText(QDir::toNativeSeparators(dir.path()));

    // Update the path field
    updatePath();
}
コード例 #15
0
void UBEditableGraphicsRegularShapeItem::updateHandle(UBAbstractHandle *handle)
{
    prepareGeometryChange();

    Delegate()->showFrame(false);

    QPointF diff = handle->pos() - path().boundingRect().topLeft();

    qreal maxSize = handle->radius() * 4;

    if(diff.x() < maxSize) {
        handle->setX(handle->pos().x() + (maxSize - diff.x()));
    }

    if(diff.y() < maxSize) {
        handle->setY(handle->pos().y() + (maxSize - diff.y()));
    }

    updatePath(handle->pos());

    if(hasGradient()) {
        QLinearGradient g(path().boundingRect().topLeft(), path().boundingRect().topRight());

        g.setColorAt(0, brush().gradient()->stops().at(0).second);
        g.setColorAt(1, brush().gradient()->stops().at(1).second);

        setBrush(g);
    }

}
コード例 #16
0
ファイル: rotation_dialog.cpp プロジェクト: chenhbzl/BooxApp
void RotationDialog::resizeEvent(QResizeEvent *)
{
    QPainterPath p;
    p.addRoundedRect(rect(), 20, 20);
    QRegion maskedRegion(p.toFillPolygon().toPolygon());
    setMask(maskedRegion);
    updatePath();
}
コード例 #17
0
ファイル: arrowitem.cpp プロジェクト: Cockatrice/Cockatrice
void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    // This ensures that if a mouse move event happens after a call to delArrow(),
    // the event will be discarded as it would create some stray pointers.
    if (!startItem)
        return;

    QPointF endPos = event->scenePos();

    QList<QGraphicsItem *> colliding = scene()->items(endPos);
    ArrowTarget *cursorItem = 0;
    qreal cursorItemZ = -1;
    for (int i = colliding.size() - 1; i >= 0; i--) {
        if (qgraphicsitem_cast<PlayerTarget *>(colliding.at(i)) || qgraphicsitem_cast<CardItem *>(colliding.at(i))) {
            if (colliding.at(i)->zValue() > cursorItemZ) {
                cursorItem = static_cast<ArrowTarget *>(colliding.at(i));
                cursorItemZ = cursorItem->zValue();
            }
        }
    }

    if ((cursorItem != targetItem) && targetItem) {
        targetItem->setBeingPointedAt(false);
        targetItem->removeArrowTo(this);
    }
    if (!cursorItem) {
        fullColor = false;
        targetItem = 0;
        updatePath(endPos);
    } else {
        if (cursorItem != targetItem) {
            fullColor = true;
            if (cursorItem != startItem) {
                cursorItem->setBeingPointedAt(true);
                cursorItem->addArrowTo(this);
            }
            targetItem = cursorItem;
        }
        updatePath();
    }
    update();

    for (int i = 0; i < childArrows.size(); ++i) {
        childArrows[i]->mouseMoveEvent(event);
    }
}
コード例 #18
0
ファイル: File.cpp プロジェクト: hmenn/GTU-2015-CSE241-OOP-HW
File::File(const string& newName, const string& newOwner, double newSize,
           const string& newTime, const string& newPath) {
    updatePath(newPath);
    setTime(newTime);
    setName(newName);
    setOwner(newOwner);
    setSize(newSize);
}
コード例 #19
0
ファイル: arrowitem.cpp プロジェクト: DeanWay/Cockatrice
void ArrowItem::updatePath()
{
    if (!targetItem)
        return;

    QPointF endPoint = targetItem->mapToScene(QPointF(targetItem->boundingRect().width() / 2, targetItem->boundingRect().height() / 2));
    updatePath(endPoint);
}
コード例 #20
0
ファイル: RectangleShape.cpp プロジェクト: KDE/calligra
void RectangleShape::setCornerRadiusY(qreal radius)
{
    if (radius >= 0.0 && radius <= 100.0) {
        m_cornerRadiusY = radius;
        updatePath(size());
        updateHandles();
    }
}
コード例 #21
0
//!
//! Sets the endnode of the connection.
//!
void ConnectionGraphicsItem::setEndNodeItem ( NodeGraphicsItem *item )
{
    m_endNodeItem = item;
    if (m_endNodeItem) {
        m_endNodeItem->addConnectionItem(this);
        updatePath();
    }
}
コード例 #22
0
	api_return FavoriteDirectoryApi::handleUpdateDirectory(ApiRequest& aRequest) {
		auto path = getPath(aRequest);


		auto info = updatePath(path, aRequest.getRequestBody());
		aRequest.setResponseBody(serializeDirectory(info));
		return websocketpp::http::status_code::ok;
	}
コード例 #23
0
GraphicsInterpolationItem::GraphicsInterpolationItem(AbstractInterpolator *interpolator_, double samplingInterval_, double xscale_, double yscale_, QGraphicsItem *parent) :
    QGraphicsPathItem(parent),
    interpolator(interpolator_),
    samplingInterval(samplingInterval_),
    xscale(xscale_),
    yscale(yscale_)
{
    updatePath();
}
コード例 #24
0
void CircleObject::setObjectDiameter(qreal diameter)
{
    QRectF circRect;
    circRect.setWidth(diameter);
    circRect.setHeight(diameter);
    circRect.moveCenter(QPointF(0,0));
    setRect(circRect);
    updatePath();
}
コード例 #25
0
void PolygonObject::gripEdit(const QPointF& before, const QPointF& after)
{
    gripIndex = findIndex(before);
    if(gripIndex == -1) return;
    QPointF a = mapFromScene(after);
    normalPath.setElementPositionAt(gripIndex, a.x(), a.y());
    updatePath(normalPath);
    gripIndex = -1;
}
コード例 #26
0
ファイル: qarclient.cpp プロジェクト: cfezequiel/mscs-thesis
void QArClient::getPathReceived(Points *path)
{
    // Correct for change in coordinate system (i.e. y = -y)
    for (list<Point>::iterator i = path->data.begin(); i != path->data.end(); i++)
    {
        i->y = -i->y;
    }
    emit updatePath(path);
}
コード例 #27
0
ファイル: qtriangle.cpp プロジェクト: livecv/livecv
void QTriangle::paint(QPainter *painter){
    if ( m_lastBoundingRect != boundingRect() ){
        m_lastBoundingRect.setRect( boundingRect().x(), boundingRect().y(), boundingRect().width(), boundingRect().height() );
        updatePath();
    }
    painter->setPen(QPen(m_color));
    painter->setBrush(QBrush(m_color));
    painter->drawPolygon(m_points, 3, Qt::OddEvenFill);
}
コード例 #28
0
ファイル: walk.cpp プロジェクト: Botje/residualvm
void Walk::start() {
	Movement::start();

	updatePath();
	changeItemAnim();

	Resources::Location *location = StarkGlobal->getCurrent()->getLocation();
	location->startFollowingCharacter();
}
コード例 #29
0
ファイル: scgpathitem.cpp プロジェクト: mcdir/sui
void SCgPathItem::popPoint()
{
    if (mPoints.isEmpty())
        return;

    mPoints.pop_back();
    updatePath();
    updateLastLine(mLastLine.line().p2());
}
コード例 #30
0
Commentaire::Commentaire(QWidget *parent,
                         int iC, int iP,
                         Produit *produit,
                         Data *d) :
    QWidget(parent),
    ui(new Ui::Commentaire),
    PageInterface(parent, iC, iP)
{
    ui->setupUi(this);
    currentProduit = produit;
    database = d;
    signalAndSlot();

    //on doit remplacer dans ce path les "/" par des "\" => "\\" caractére d'échapement
    //c'est qt qui les mets dans ce sens avec la méthode appicationDirPath()
    pathSyst = updatePath(QApplication::applicationDirPath()+database->getPathSyst());
    pathBA = updatePath(QApplication::applicationDirPath()+database->getPathBA());
}