コード例 #1
0
ファイル: xmlLoader.cpp プロジェクト: nfrey/qreal
void XmlLoader::checkScale(QPair<QString, bool> pointX1, QPair<QString, bool> pointX2, QPair<QString, bool> pointY1, QPair<QString, bool> pointY2)
{
    if (pointX1.second)
        changeScaleColor(0);
    if (pointX2.second)
        changeScaleColor(3);
    if (pointY1.second)
        changeScaleColor(4);
    if (pointY2.second)
        changeScaleColor(7);
}
コード例 #2
0
ファイル: item.cpp プロジェクト: ArtemKopylov/qreal
void Item::setScalingPointColor()
{
	for (int i = 0; i < mListScalePoint.size(); ++i) {
		QPair<Item::ScalingPointState, QColor> point = mListScalePoint.at(i);
		if (point.first == mScalingState) {
			mListScalePoint.insert(i, QPair<Item::ScalingPointState, QColor>(mScalingState, changeScaleColor(point)));
			mListScalePoint.removeAt(i + 1);
			return;
		}
	}
}
コード例 #3
0
ファイル: xmlLoader.cpp プロジェクト: nfrey/qreal
QPair<QPointF, QPointF> XmlLoader::calcLineOfXandY(QPair<QString, bool> pointX1, QPair<QString, bool> pointX2, QPair<QString, bool> pointY1, QPair<QString, bool> pointY2)
{
    qreal x1 = pointX1.first.toDouble() + mDrift.x();
    qreal x2 = pointX2.first.toDouble() + mDrift.x();
    qreal y1 = pointY1.first.toDouble() + mDrift.y();
    qreal y2 = pointY2.first.toDouble() + mDrift.y();

    if (x2 > x1) {
        if (y2 > y1) {
            if (pointX1.second)
                changeScaleColor(0);
            if (pointX2.second)
                changeScaleColor(3);
            if (pointY1.second)
                changeScaleColor(4);
            if (pointY2.second)
                changeScaleColor(7);
        } else {
            if (pointX1.second)
                changeScaleColor(2);
            if (pointX2.second)
                changeScaleColor(1);
            if (pointY1.second)
                changeScaleColor(6);
            if (pointY2.second)
                changeScaleColor(5);
        }
    } else {
        if (y2 > y1) {
            if (pointX1.second)
                changeScaleColor(1);
            if (pointX2.second)
                changeScaleColor(2);
            if (pointY1.second)
                changeScaleColor(5);
            if (pointY2.second)
                changeScaleColor(6);
        } else {
            if (pointX1.second)
                changeScaleColor(3);
            if (pointX2.second)
                changeScaleColor(0);
            if (pointY1.second)
                changeScaleColor(7);
            if (pointY2.second)
                changeScaleColor(4);
        }
    }
    return QPair<QPointF, QPointF>(QPointF(x1, y1), QPointF(x2, y2));
}