本文整理汇总了C++中QWMatrix::m11方法的典型用法代码示例。如果您正苦于以下问题:C++ QWMatrix::m11方法的具体用法?C++ QWMatrix::m11怎么用?C++ QWMatrix::m11使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWMatrix
的用法示例。
在下文中一共展示了QWMatrix::m11方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintScheme
// -----------------------------------------------------------------------
void GraphicText::paintScheme(QPainter *p)
{
QWMatrix wm = p->worldMatrix();
QWMatrix Mat (wm.m11(), 0.0, 0.0, wm.m22(),
wm.dx() + double(cx) * wm.m11(),
wm.dy() + double(cy) * wm.m22());
p->setWorldMatrix(Mat);
p->rotate(-Angle);
p->drawRect(0, 0, x2, y2);
p->setWorldMatrix(wm);
}
示例2: trueMatrix
QWMatrix QPixmap::trueMatrix( const QWMatrix &matrix, int w, int h )
{
const double dt = (double)0.;
double x1,y1, x2,y2, x3,y3, x4,y4; // get corners
double xx = (double)w;
double yy = (double)h;
QWMatrix mat( matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), 0., 0. );
mat.map( dt, dt, &x1, &y1 );
mat.map( xx, dt, &x2, &y2 );
mat.map( xx, yy, &x3, &y3 );
mat.map( dt, yy, &x4, &y4 );
double ymin = y1; // lowest y value
if ( y2 < ymin ) ymin = y2;
if ( y3 < ymin ) ymin = y3;
if ( y4 < ymin ) ymin = y4;
double xmin = x1; // lowest x value
if ( x2 < xmin ) xmin = x2;
if ( x3 < xmin ) xmin = x3;
if ( x4 < xmin ) xmin = x4;
double ymax = y1; // lowest y value
if ( y2 > ymax ) ymax = y2;
if ( y3 > ymax ) ymax = y3;
if ( y4 > ymax ) ymax = y4;
double xmax = x1; // lowest x value
if ( x2 > xmax ) xmax = x2;
if ( x3 > xmax ) xmax = x3;
if ( x4 > xmax ) xmax = x4;
if ( xmax-xmin > 1.0 )
xmin -= xmin/(xmax-xmin);
if ( ymax-ymin > 1.0 )
ymin -= ymin/(ymax-ymin);
mat.setMatrix( matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), -xmin, -ymin );
return mat;
}
示例3: contentsMouseMoveEvent
void CNavigationDiagramView::contentsMouseMoveEvent(QMouseEvent * e){
QWMatrix matrix = inverseWorldMatrix();
double x = matrix.m11() * e->x() + matrix.m12() * e->y();
double y = matrix.m21() * e->x() + matrix.m22() * e->y();
if (! canvas()->onCanvas(x, y)) return;
if (m_pqActiveItem){
double dxPosLokal = e->pos().x() - m_qLastPos.x();
double dyPosLokal = e->pos().y() - m_qLastPos.y();
double dxPos = matrix.m11() * dxPosLokal + matrix.m12() * dyPosLokal;
double dyPos = matrix.m21() * dxPosLokal + matrix.m22() * dyPosLokal;
//int newIntX = (int) (x() + dxPos);
//int newIntY = (int) (y() + dyPos);
//if (! canvas()->onCanvas(newIntX, newIntY)) return;
m_pqActiveItem->moveBy(dxPos, dyPos);
m_qLastPos = e->pos();
canvas()->update();
if (m_pqActiveItem->rtti() == CFromDiagramMarker::RTTI){
CFromDiagramMarker *fromMarker = (CFromDiagramMarker*) m_pqActiveItem;
float fXPos = (float) fromMarker->GetCenterX();
float fYPos = (float) fromMarker->GetCenterY();
CNavigationProjectController::Instance()->SetNewFromPosition(fXPos, fYPos);
}else if (m_pqActiveItem->rtti() == CAtDiagramMarker::RTTI){
CAtDiagramMarker *atMarker = (CAtDiagramMarker*) m_pqActiveItem;
float fXPos = (float) atMarker->GetCenterX();
float fYPos = (float) atMarker->GetCenterY();
CNavigationProjectController::Instance()->SetNewAtPosition(fXPos, fYPos);
}
}
}
示例4: contentsMousePressEvent
void CNavigationDiagramView::contentsMousePressEvent(QMouseEvent * e){
QWMatrix matrix = inverseWorldMatrix();
int xPos = matrix.m11() * e->pos().x() + matrix.m12() * e->pos().y();
int yPos = matrix.m21() * e->pos().x() + matrix.m22() * e->pos().y();
QPoint p(xPos, yPos);
QCanvasItemList items = canvas()->collisions(p);
if (items.empty()){
setActiveItem(0);
}else{
setActiveItem(*items.begin());
}
m_qLastPos = e->pos();
}