Use Qt::Alignment instead of the AlignmentFlag enum to represent flags

Because from Qt 5.12, the the right operator| is found in the Qt namespace
instead of in the global namespace.

One must still add the 'using' statement so this patch can be integrated
using a previous qtbase. But the statement can be removed once qtbase is
updated.

Task-number: QTBUG-67582
Change-Id: Ib79c4623e858988bb55a87ad4fb0c1e0ceee81cf
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Olivier Goffart 2018-04-09 23:25:51 +02:00 committed by Liang Qi
parent 1212170af2
commit da3c5925d5
5 changed files with 11 additions and 9 deletions

View File

@ -844,7 +844,7 @@ void Bars3DRenderer::drawSlicedScene()
viewMatrix, projectionMatrix, positionComp, totalSliceLabelRotation,
0, m_cachedSelectionMode, m_labelShader,
m_labelObj, activeCamera, false, false, Drawer::LabelMid,
Qt::AlignmentFlag(Qt::AlignLeft | Qt::AlignTop), true);
Qt::AlignLeft | Qt::AlignTop, true);
}
if (!sliceGridLabels) {

View File

@ -306,7 +306,7 @@ void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelIte
GLfloat itemHeight, QAbstract3DGraph::SelectionFlags mode,
ShaderHelper *shader, ObjectHelper *object,
const Q3DCamera *camera, bool useDepth, bool rotateAlong,
LabelPosition position, Qt::AlignmentFlag alignment, bool isSlicing,
LabelPosition position, Qt::Alignment alignment, bool isSlicing,
bool isSelecting)
{
// Draw label

View File

@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
using QT_PREPEND_NAMESPACE(operator|); // Get the operator|(Qt::AlignmentFlag,Qt::AlignmentFlag) for Qt < 5.12
class ShaderHelper;
class ObjectHelper;
class AbstractObjectHelper;
@ -98,7 +100,7 @@ public:
QAbstract3DGraph::SelectionFlags mode, ShaderHelper *shader, ObjectHelper *object,
const Q3DCamera *camera, bool useDepth = false, bool rotateAlong = false,
LabelPosition position = LabelOver,
Qt::AlignmentFlag alignment = Qt::AlignCenter, bool isSlicing = false,
Qt::Alignment alignment = Qt::AlignCenter, bool isSlicing = false,
bool isSelecting = false);
void generateSelectionLabelTexture(Abstract3DRenderer *item);

View File

@ -1839,7 +1839,7 @@ void Scatter3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa
else
labelZTrans = m_scaleZWithBackground + labelMargin;
Qt::AlignmentFlag alignment = (m_xFlipped != m_zFlipped) ? Qt::AlignLeft : Qt::AlignRight;
Qt::Alignment alignment = (m_xFlipped != m_zFlipped) ? Qt::AlignLeft : Qt::AlignRight;
QVector3D labelRotation;
if (m_zFlipped)
labelZTrans = -labelZTrans;
@ -1963,7 +1963,7 @@ void Scatter3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa
hAlignment = m_zFlipped ? Qt::AlignLeft : Qt::AlignRight;
if (m_yFlippedForGrid && vAlignment != Qt::AlignCenter)
vAlignment = (vAlignment == Qt::AlignTop) ? Qt::AlignBottom : Qt::AlignTop;
alignment = Qt::AlignmentFlag(vAlignment | hAlignment);
alignment = vAlignment | hAlignment;
} else {
labelTrans.setX(m_axisCacheX.labelPosition(label));
}

View File

@ -1076,7 +1076,7 @@ void Surface3DRenderer::drawSlicedScene()
positionComp, totalRotation, 0, QAbstract3DGraph::SelectionRow,
m_labelShader, m_labelObj, activeCamera,
false, false, Drawer::LabelBelow,
Qt::AlignmentFlag(Qt::AlignLeft | Qt::AlignTop), true);
Qt::AlignLeft | Qt::AlignTop, true);
}
labelNbr++;
}
@ -1972,7 +1972,7 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa
if (m_radialLabelOffset < 1.0f)
labelYTrans += gridLineOffset + gridLineWidth;
}
Qt::AlignmentFlag alignment = (m_xFlipped == m_zFlipped) ? Qt::AlignLeft : Qt::AlignRight;
Qt::Alignment alignment = (m_xFlipped == m_zFlipped) ? Qt::AlignLeft : Qt::AlignRight;
QVector3D labelRotation;
if (m_xFlipped)
labelXTrans = -labelXTrans;
@ -2128,7 +2128,7 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa
else
labelZTrans = m_scaleZWithBackground + labelMargin;
Qt::AlignmentFlag alignment = (m_xFlipped != m_zFlipped) ? Qt::AlignLeft : Qt::AlignRight;
Qt::Alignment alignment = (m_xFlipped != m_zFlipped) ? Qt::AlignLeft : Qt::AlignRight;
QVector3D labelRotation;
if (m_zFlipped)
labelZTrans = -labelZTrans;
@ -2256,7 +2256,7 @@ void Surface3DRenderer::drawLabels(bool drawSelection, const Q3DCamera *activeCa
hAlignment = m_zFlipped ? Qt::AlignLeft : Qt::AlignRight;
if (m_yFlippedForGrid && vAlignment != Qt::AlignCenter)
vAlignment = (vAlignment == Qt::AlignTop) ? Qt::AlignBottom : Qt::AlignTop;
alignment = Qt::AlignmentFlag(vAlignment | hAlignment);
alignment = vAlignment | hAlignment;
} else {
labelTrans.setX(m_axisCacheX.labelPosition(label));
}