当前位置: 首页>>代码示例>>C++>>正文


C++ QPoint::setY方法代码示例

本文整理汇总了C++中QPoint::setY方法的典型用法代码示例。如果您正苦于以下问题:C++ QPoint::setY方法的具体用法?C++ QPoint::setY怎么用?C++ QPoint::setY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPoint的用法示例。


在下文中一共展示了QPoint::setY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GLToClient

/**
*Converts OpenGL Viewport coordinates to client coordinates
*@param x the viewport x-coordinate.
*@param y the viewport y-coordinate.
*@param point the client coordinates.
*/
void ThreeDWidget::GLToClient(double const &x, double const &y, QPoint &point)
{
    //
    //converts an opengl 2D vector to screen client coordinates
    //
    static double dx, dy, h2, w2;

    h2 = m_GLViewRect.height() /2.0;
    w2 = m_GLViewRect.width()  /2.0;

    dx = ( x + w2)/2.0;
    dy = (-y + h2)/2.0;

    if(w2>h2)
    {
        point.setX((int)(dx * (double)geometry().width()));
        point.setY((int)(dy * (double)geometry().width()));
    }
    else
    {
        point.setX((int)(dx * (double)geometry().height()));
        point.setY((int)(dy * (double)geometry().height()));
    }
}
开发者ID:subprotocol,项目名称:xflr5,代码行数:30,代码来源:threedwidget.cpp

示例2: mousePressEvent

void Keyswitch::mousePressEvent(QMouseEvent *event)
{
	if (xkbConf->status==DONT_USE_XKB ||xkbConf->status==ONLY_INDICATION)
		return;
	if (event->button() == Qt::LeftButton) {
		setNextGroupe();
	}
	if (event->button() == Qt::RightButton) {
		QPoint p = mapToGlobal(QPoint(0, 0));
		QSize s(contextMenu->sizeHint());
		p.setY(p.y()-s.height());
		contextMenu->exec(p);
	}

}
开发者ID:sollidsnake,项目名称:qxkb,代码行数:15,代码来源:keyswitch.cpp

示例3: mapItemToWidget

QPolygon ControlRuler::mapItemToWidget(QPolygonF *poly)
{
//    double xscale = width() / m_pannedRect.width();
//    double yscale = height();

    QPolygon newpoly;
    QPoint newpoint;
    for (QPolygonF::iterator it = poly->begin(); it != poly->end(); ++it) {
        newpoint.setX(mapXToWidget((*it).x()));
        newpoint.setY(mapYToWidget((*it).y()));
        newpoly.push_back(newpoint);
    }

    return newpoly;
}
开发者ID:EQ4,项目名称:RosegardenW,代码行数:15,代码来源:ControlRuler.cpp

示例4: getPointObject

/**
 * Takes a string with komma seperated integer values.
 * These values are put into a QPoint object.
 * @param input     A string with to integer values komma seperated.
 * @return          A QPoint object containing these values. Or (-1,-1) if string was invalid.
 */
QPoint Battleships::getPointObject(const QString input)
{
    QStringList value = input.split(',');
    if (value.size() < 2) {
        return QPoint(-1, -1);
    }
    QPoint point;
    bool ok;
    int x = value[0].toInt(&ok);
    point.setX( (ok) ? x : -1 ) ;
    int y = value[1].toInt(&ok);
    point.setY( (ok) ? y : -1 );

    return point;
}
开发者ID:Kri-7-q,项目名称:Battleships,代码行数:21,代码来源:battleships.cpp

示例5: lineIntersect

bool lineIntersect(
  qreal a1, qreal b1, qreal c1,
  qreal a2, qreal b2, qreal c2,
  QPoint &intersect)
{
  qreal det = a1*b2 - a2*b1;
  if (fabs(det) < 1e-6) {
    return false;
  } else {
    qreal dinv = 1.0/det;
    intersect.setX((b1*c2 - b2*c1)*dinv);
    intersect.setY((a2*c1 - a1*c2)*dinv);
    return true;
  }
}
开发者ID:nathaneltitane,项目名称:lpub,代码行数:15,代码来源:pointeritem.cpp

示例6: mouseMoveEvent

void ProfilePictureWindow::mouseMoveEvent(QMouseEvent *event)
{
    if (origin != QPoint(-1,-1))
    {

        QPoint newPos = rubberBand->pos() + (event->globalPos() - origin);

        if (newPos.x() < screenPhotoRect.left())
            newPos.setX(screenPhotoRect.left());

        if (newPos.y() < screenPhotoRect.top())
            newPos.setY(screenPhotoRect.top());

        if (newPos.x() + rubberBandRect.width() > screenPhotoRect.right())
            newPos.setX(screenPhotoRect.right() - rubberBandRect.width());

        if (newPos.y() + rubberBandRect.height() > screenPhotoRect.bottom())
            newPos.setY(screenPhotoRect.bottom() - rubberBandRect.height());

        rubberBandRect.moveTo(newPos);
        rubberBand->setGeometry(rubberBandRect);
        origin = event->globalPos();
    }
}
开发者ID:0xaaa,项目名称:yappari,代码行数:24,代码来源:profilepicturewindow.cpp

示例7: move

void BalloonTip::move(QPoint pos)
{
    QWidget::move(pos);
    switch (my_arrowPos) {
    case BottomLeft:
        pos.setY(pos.y() - my_popupRect.height() - 60);
        break;
    case TopLeft:
        pos.setX(pos.x() - 30);
        break;
    case BottomRight:
        pos.setY(pos.y() - my_popupRect.height() - 60);
        break;
    case TopRight:
        pos.setX(pos.x() - my_popupRect.width() + 30);
        break;
    case LeftTop:
        pos.setX(pos.x() + 10);
        pos.setY(pos.y() - int(my_popupRect.height() * 0.63));
        break;
    }
    QWidget::move(pos);
    update();
}
开发者ID:WPN-XM,项目名称:server-control-panel,代码行数:24,代码来源:BalloonTip.cpp

示例8: restoreWindowGeometry

void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSize, QWidget *parent)
{
    QSettings settings;
    QPoint pos = settings.value(strSetting + "Pos").toPoint();
    QSize size = settings.value(strSetting + "Size", defaultSize).toSize();

    if (!pos.x() && !pos.y()) {
        QRect screen = QApplication::desktop()->screenGeometry();
        pos.setX((screen.width() - size.width()) / 2);
        pos.setY((screen.height() - size.height()) / 2);
    }

    parent->resize(size);
    parent->move(pos);
}
开发者ID:envycointeam,项目名称:envycoin,代码行数:15,代码来源:guiutil.cpp

示例9: mouseMoveEvent

void ImageCanvasWidget::mouseMoveEvent(QMouseEvent *event) {
  QPoint pos = event->pos();
  if (!rect().contains(event->pos())) {
    pos.setX(qMin(rect().right() - 1, qMax(rect().left(), pos.x())));
    pos.setY(qMin(rect().bottom() - 1, qMax(rect().top(), pos.y())));
  }

  QRect current_cursor = options_cache_->PosToGrid(pos);
  if (anchor_down_) {
    options_cache_->set_tile_selection(current_cursor.united(anchor_));
  } else {
    options_cache_->MoveSelection(current_cursor.center());
  }
  update();
}
开发者ID:RicardoBusta,项目名称:PixelBooster,代码行数:15,代码来源:image_canvas_widget.cpp

示例10: wheelEvent

void CGLWidget::wheelEvent(QWheelEvent *event)
{
	QPoint point = event->pos();

	int y = (-(cy + 0.0f) / (cy- 1.0f) * (point.y() + 0.0f) + (cy + 0.0f) / 2.0f);
	int x = ((cx + 0.0f) / (cx- 1.0f) * (point.x() + 0.0f) - (cx + 0.0f) / 2.0f);
	point.setY(y);
	point.setX(x);

	int delta = event->delta();

	INPUTMGR->OnMouseWheel( delta, point);

	updateGL();
}
开发者ID:cleonro,项目名称:VRPMapEditorQt,代码行数:15,代码来源:GLWidget.cpp

示例11: move

void VCWidget::move(QPoint p)
{
	// Grid settings
	if (_app->virtualConsole()->isGridEnabled())
	{
		p.setX(p.x() - (p.x() % _app->virtualConsole()->gridX()));
		p.setY(p.y() - (p.y() % _app->virtualConsole()->gridY()));
	}

	// Don't move beyond left or right
	if (p.x() < 0)
		p.setX(0);
	else if (p.x() + rect().width() > parentWidget()->width())
		p.setX(parentWidget()->width() - rect().width());

	// Don't move beyond top or bottom
	if (p.y() < 0)
		p.setY(0);
	else if (p.y() + rect().height() > parentWidget()->height())
		p.setY(parentWidget()->height() - rect().height());

	// Do the move
	QFrame::move(p);
}
开发者ID:speakman,项目名称:qlc,代码行数:24,代码来源:vcwidget.cpp

示例12: getOrientationInformation

QPoint RotationDaemon::getOrientationInformation()
{
    QPoint p;

    // rewind
    m_accelerometer.seek(0);

    QByteArray bytes = m_accelerometer.readAll();
    QList<QByteArray> tokens = bytes.split(' ');

    p.setX(tokens[0].toInt());
    p.setY(tokens[1].toInt());

    return p;
}
开发者ID:mornage,项目名称:rotatedaemon,代码行数:15,代码来源:rotationdaemon.cpp

示例13: adjustSize

void Smb4KToolTip::show(const QPoint &pos)
{
  // Get the geometry of the screen where the cursor is
  const QRect screenRect = QApplication::desktop()->screenGeometry(pos);
  
  // Adjust the size
  adjustSize();

  // The position where the tooltip is to be shown
  QPoint tooltipPos;  
  
  // Correct the position of the tooltip, so that it is completely 
  // shown.
  if (pos.x() + width() + 5 >= screenRect.x() + screenRect.width())
  {
    tooltipPos.setX(pos.x() - width() - 5);
  }
  else
  {
    tooltipPos.setX(pos.x() + 5);
  }
  
  if (pos.y() + height() + 5 >= screenRect.y() + screenRect.height())
  {
    tooltipPos.setY(pos.y() - height() - 5);
  }
  else
  {
    tooltipPos.setY(pos.y() + 5);
  }

  move(tooltipPos);
  setVisible(true);
  
  QTimer::singleShot(10000, this, SLOT(slotHideToolTip()));
}
开发者ID:KDE,项目名称:smb4k,代码行数:36,代码来源:smb4ktooltip.cpp

示例14: toggleCalendar

void KBinaryClock::toggleCalendar()
{
	if (_calendar && !_disableCalendar) {
		// calls slotCalendarDeleted which does the cleanup for us
		_calendar->close();
		return;
	}
	if (_calendar || _disableCalendar){
		return;
	}
	_calendar = new DatePicker(this, QDateTime::currentDateTime().date());
	connect( _calendar, SIGNAL( destroyed() ), SLOT( slotCalendarDeleted() ));

	// some extra spacing is included if aligned on a desktop edge
	QPoint c = mapToGlobal(QPoint(0,0));

	int w = _calendar->sizeHint().width() + 28;
															// Added 28 px. to size poperly as said in API
	int h = _calendar->sizeHint().height();

	switch (position()) {
	case KPanelApplet::pLeft:	c.setX(c.x()+width()+2);	break;
	case KPanelApplet::pRight:	c.setX(c.x()-w-2);		break;
	case KPanelApplet::pTop:	c.setY(c.y()+height()+2);	break;
	case KPanelApplet::pBottom:	c.setY(c.y()-h-2);		break;
		}

		// make calendar fully visible
		QRect deskR = KGlobalSettings::desktopGeometry(QPoint(0,0));

		if (c.y()+h > deskR.bottom())	c.setY(deskR.bottom()-h-1);
		if (c.x()+w > deskR.right())				c.setX(deskR.right()-w-1);

		_calendar->move(c);
		_calendar->show();
}
开发者ID:iegor,项目名称:kdesktop,代码行数:36,代码来源:kbinaryclock.cpp

示例15: showContextMenu

void UTableRecycleBin::showContextMenu(QPoint p)
{
    if(visibleContextMenu)
    {
        QMenu menu(this);
        menu.addAction(actionDeleteItem);
        menu.addAction(actionRestoreItem);

        p.setX(p.x() + 18);
        p.setY(p.y() + 22);
        menu.exec(this->mapToGlobal(p));

        visibleContextMenu = false;
    }
}
开发者ID:gil9red,项目名称:Note,代码行数:15,代码来源:TablesManager.cpp


注:本文中的QPoint::setY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。