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


C++ QRectF::moveTop方法代码示例

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


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

示例1: doLayout

/**
 * 功能
 *      当前单元格子元素布局
 */
void WinDigitalDelegate::doLayout(const QStyleOptionViewItem & option, QRectF &valRect, QRectF &unitRect, QRectF &tagRect, QRectF &alarmRect, qreal &alarmSpan) const
{
    /***********测量值***********/
    valRect = option.rect;
    valRect.setHeight(valRect.height()/3);
    valRect.moveTop(valRect.bottom());
    valRect.setRight(valRect.right() - valRect.width()/18- 3);

    /************标记**********/
    tagRect = valRect;
    tagRect.moveBottom(tagRect.top());
    tagRect.setTop(tagRect.top() + option.rect.height()/10);

    /************单位***********/
    unitRect = valRect;
    unitRect.moveTop(unitRect.bottom());
    unitRect.setRight(unitRect.right() - 15);

    /*************报警标记**********/
    alarmRect = unitRect;
    alarmRect.setHeight(alarmRect.height()/3);
    alarmRect.moveTop(alarmRect.bottom());
    alarmRect.setLeft(alarmRect.center().x() - 4*alarmRect.height());
    alarmRect.setWidth(alarmRect.height());
    alarmSpan = alarmRect.width() * 2;
}
开发者ID:urielyan,项目名称:F270,代码行数:30,代码来源:windigitaldelegate.cpp

示例2: clone_marker

// The draw function for unspecified is so easy, just calculate the clone marker without a singleShape() drawing function
QPainterPath SimpleChemEPN::clone_marker() const
{
    QPainterPath p_front, p_back, p_clone;

    // this glyph has to be cirular:
    qreal draw_width = width();
    if ( height() < width()) draw_width = height();
    QRectF cloneRect = QRectF( -draw_width/2, -draw_width/2, draw_width, draw_width*0.7 );

    if (this->multimer == true) {
      QPainterPath p_front2, p_back2;

      p_clone.setFillRule(Qt::WindingFill);

      p_front.addEllipse( -draw_width/2, -draw_width/2, draw_width-GLYPH_PADDING, draw_width-GLYPH_PADDING );
      p_back.addRect(cloneRect);
      p_clone.addPath(p_front.subtracted(p_back));

      cloneRect.moveTop( -draw_width/2+GLYPH_PADDING );
      p_front2.addEllipse( -draw_width/2+GLYPH_PADDING, -draw_width/2+GLYPH_PADDING, draw_width-GLYPH_PADDING, draw_width-GLYPH_PADDING );
      p_back2.addRect(cloneRect);
      p_clone.addPath(p_front2.subtracted(p_back2));
    }
    else {
      p_front.addEllipse( -draw_width/2, -draw_width/2, draw_width, draw_width );
      p_back.addRect(cloneRect);
      p_clone = p_front.subtracted(p_back);
    }

    return p_clone;
}
开发者ID:SiteView,项目名称:NNMQT,代码行数:32,代码来源:pdsimplechemepn.cpp

示例3: printAreaMoved

// slot
void PrintWidget::printAreaMoved()
{
	QRectF area = map_printer->getPrintArea();
	area.moveLeft(left_edit->value());
	area.moveTop(-top_edit->value()); // Flip sign!
	map_printer->setPrintArea(area);
}
开发者ID:02JanDal,项目名称:mapper,代码行数:8,代码来源:print_widget.cpp

示例4: clone_marker

QPainterPath ComplexEPN::clone_marker() const
{
    QPainterPath p_clone, p_front, p_back;
    int indent = 10; // indent on the width/height for the cut-off corners

    QRectF cloneRect = QRectF( -width()/2, -height()/2, width(), height()*0.7 );

    if (this->multimer == true) {
        p_front = ComplexEPN::frontMultimerShape( width(), height(), indent );
        p_back.addRect(cloneRect);
        p_clone = p_front.subtracted(p_back);

        QPainterPath p_front2, p_back2;
        p_front2 = ComplexEPN::backMultimerShape( width(), height(), indent );
        cloneRect.moveTop( -height()/2+GLYPH_PADDING );
        p_back2.addRect(cloneRect);
        p_clone.setFillRule(Qt::WindingFill);
        p_clone.addPath(p_front2.subtracted(p_back2));
    }
    else {
        p_front = ComplexEPN::singleShape( width(), height(), indent );
        p_back.addRect(cloneRect);
        p_clone = p_front.subtracted(p_back);
    }

    return p_clone;
}
开发者ID:SiteView,项目名称:NNMQT,代码行数:27,代码来源:pdcomplexepn.cpp

示例5: mouseMoveEvent

void EditorView::mouseMoveEvent(QMouseEvent *event)
{
	if (mWheelPressed) {
		if (mMouseOldPosition != QPointF()) {
			QRectF rect = sceneRect();
			qreal dx = (event->posF().x() - mMouseOldPosition.x());
			qreal dy = (event->posF().y() - mMouseOldPosition.y());
			rect.moveLeft(rect.left() - dx);
			rect.moveTop(rect.top() - dy);
			setSceneRect(rect);
		}
		mMouseOldPosition = event->posF();
	}
	QGraphicsView::mouseMoveEvent(event);
	if (event->buttons() & Qt::RightButton) {
		setDragMode(NoDrag);
	} else {
		if (event->buttons() & Qt::LeftButton ) {
			UML::EdgeElement *newEdgeEl = dynamic_cast<UML::EdgeElement *>(itemAt(event->pos()));
			if (newEdgeEl == NULL) {
				setDragMode(RubberBandDrag);
			} else {
				if (newEdgeEl->isBreakPointPressed()) {
					newEdgeEl->breakPointUnpressed();
					setDragMode(NoDrag);
				}
			}
		}
	}
	if (mScene->getNeedDrawGrid())
		mScene->invalidate();
}
开发者ID:nfrey,项目名称:qreal,代码行数:32,代码来源:editorview.cpp

示例6: mouseMoveEvent

void EditorView::mouseMoveEvent(QMouseEvent *event)
{
	if (mWheelPressed) {
		if (mMouseOldPosition != QPointF()) {
			QRectF rect = sceneRect();
			qreal dx = (event->localPos().x() - mMouseOldPosition.x());
			qreal dy = (event->localPos().y() - mMouseOldPosition.y());
			rect.moveLeft(rect.left() - dx);
			rect.moveTop(rect.top() - dy);
			setSceneRect(rect);
			translate(dx, dy);
		}
		mMouseOldPosition = event->localPos();
	}
	QGraphicsView::mouseMoveEvent(event);
	if (event->buttons() & Qt::RightButton) {
		setDragMode(NoDrag);
	} else {
		if ((event->buttons() & Qt::LeftButton) && (event->modifiers() & Qt::ControlModifier)) {
			setDragMode(RubberBandDrag);
			mScene->itemSelectUpdate();
		/*} else 	if ((event->buttons() & Qt::LeftButton) && (event->modifiers() & Qt::ShiftModifier)) {
			setDragMode(ScrollHandDrag); //  (see #615)
			mScene->itemSelectUpdate();*/
		} else if (event->buttons() & Qt::LeftButton ) {
			EdgeElement *newEdgeEl = dynamic_cast<EdgeElement *>(itemAt(event->pos()));
			if (newEdgeEl && newEdgeEl->isBreakPointPressed()) {
				newEdgeEl->breakPointUnpressed();
				setDragMode(NoDrag);
			}
		}
	}
	if (mScene->getNeedDrawGrid())
		mScene->invalidate();
}
开发者ID:Esenin,项目名称:qreal,代码行数:35,代码来源:editorView.cpp

示例7: paint

void NodeInspector::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
                       QWidget *widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);

    const auto r = boundingRect().adjusted(border, border, -border, -border);

    if (glow)
    {
        painter->setBrush(Qt::NoBrush);
        painter->setPen(QPen(QColor(255, 255, 255, Colors::base02.red()), 20));
        painter->drawRoundedRect(r, 8, 8);
    }

    painter->setBrush(Colors::base01);
    painter->setPen(Qt::NoPen);
    painter->drawRoundedRect(r, 8, 8);

    painter->setBrush(Colors::base03);
    QRectF br = title_row->boundingRect();
    br.setWidth(r.width());
    br.setHeight(br.height() + 2);
    painter->drawRoundedRect(br, 8, 8);
    br.setHeight(br.height()/2);
    br.moveTop(br.height());
    painter->drawRect(br);

    painter->setBrush(Qt::NoBrush);
    if (isSelected())
        painter->setPen(QPen(Colors::base05, 2));
    else
        painter->setPen(QPen(Colors::base03, 2));
    painter->drawRoundedRect(r, 8, 8);
}
开发者ID:CreativeLabs0X3CF,项目名称:antimony,代码行数:35,代码来源:inspector.cpp

示例8: itemChange

QVariant PixmapItem::itemChange(GraphicsItemChange change,
                                const QVariant &value)
{
    if (change == ItemPositionChange)
    {
        // value is the new position.
        QPointF newPos = value.toPointF();
        QRectF rect = parentItem()->boundingRect();

        rect.moveLeft(boundingRect().width()*3/4*-1);
        rect.setWidth(rect.width() + boundingRect().width()*2/4 );

        rect.moveTop(boundingRect().height()*3/4*-1);
        rect.setHeight(rect.height() + boundingRect().height()*2/4 );

        CardItem *card = qgraphicsitem_cast<CardItem *>(parentItem());

        if (!rect.contains(newPos))
        {
            // Keep the item inside the scene rect.
            int newX = (int)qMin(rect.right(), qMax(newPos.x(), rect.left()));
            int newY = (int)qMin(rect.bottom(), qMax(newPos.y(), rect.top()));



            if(card->isAlign())
            {
                int gridSize = card->getGridSize();
                newX = (newX/(10*gridSize))*(10*gridSize);
                newY = (newY/(10*gridSize))*(10*gridSize);
            }

            newPos.setX(newX);
            newPos.setY(newY);
            return newPos;
        }
        else
        {
            int newX =  newPos.x();
            int newY = newPos.y();

            if(card->isAlign())
            {
                int gridSize = card->getGridSize();
                newX = newPos.x()/(10*gridSize);
                newX = newX * (10*gridSize);
                newY = newPos.y()/(10*gridSize);
                newY = newY*(10*gridSize);

            }

            newPos.setX(newX);
            newPos.setY(newY);
            return newPos;

        }
    }

    return QGraphicsItem::itemChange(change, value);
}
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:60,代码来源:pixmapitem.cpp

示例9: PaintPage

	void TextDocumentAdapter::PaintPage (QPainter *painter, int page)
	{
		const auto& size = Doc_->pageSize ();

		QRectF rect (QPointF (0, 0), size);
		rect.moveTop (rect.height () * page);
		Doc_->drawContents (painter, rect);
	}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:8,代码来源:textdocumentadapter.cpp

示例10: onYChanged

void ShapeSideBar::onYChanged(int y)
{
	if (d->rectLayer)
	{
		QRectF rect = d->rectLayer->rect();
		rect.moveTop(y);
		layerScene()->setLayerProperty(d->rectLayer, rect, RoleRect, tr("Change Rectangle y"));
	}
}
开发者ID:h2so5,项目名称:PaintField,代码行数:9,代码来源:shapesidebar.cpp

示例11: relayoutExtender

    void relayoutExtender()
    {
        if (!m_extenders.contains(q->scene())
            || !m_extenders[q->scene()]
            || q != m_extenders[q->scene()]->parentItem()) return;
        QRectF geometry = QRectF(QPointF(0, 0), q->size());

        // extender()->borders = Plasma::FrameSvg::AllBorders;
        borders = Plasma::FrameSvg::AllBorders;

        switch (extenderPosition) {
        case TopExtender:
            geometry.setHeight(EXTENDER_SIZE);
            geometry.moveTop(- EXTENDER_SIZE);
            // borders &= ~ Plasma::FrameSvg::TopBorder;
            // extender()->borders &= ~ Plasma::FrameSvg::BottomBorder;
            break;
        case BottomExtender:
            geometry.moveTop(geometry.bottom());
            geometry.setHeight(EXTENDER_SIZE);
            // borders &= ~ Plasma::FrameSvg::BottomBorder;
            // extender()->borders &= ~ Plasma::FrameSvg::TopBorder;
            break;
        case LeftExtender:
            geometry.setWidth(EXTENDER_SIZE);
            geometry.moveLeft(- EXTENDER_SIZE);
            // borders &= ~ Plasma::FrameSvg::LeftBorder;
            // extender()->borders &= ~ Plasma::FrameSvg::RightBorder;
            break;
        case RightExtender:
            geometry.moveLeft(geometry.right());
            geometry.setWidth(EXTENDER_SIZE);
            // borders &= ~ Plasma::FrameSvg::RightBorder;
            // extender()->borders &= ~ Plasma::FrameSvg::LeftBorder;
            break;
        case NoExtender:
            break;
        }
        extender()->setGeometry(geometry);
        extender()->setPreferredSize(geometry.size());

        // qreal left, top, right, bottom;
        // q->getContentsMargins(&left, &top, &right, &bottom);
    }
开发者ID:fluxer,项目名称:kde-extraapps,代码行数:44,代码来源:ExtenderButton.cpp

示例12: back

// QtPluginIconPalletTool Interface
void
dmz::QtPluginIconPalletTool::_add_type (const ObjectType &Type) {

   const String IconResource = config_to_string (
      get_plugin_name () + ".resource",
      Type.get_config());

   const String IconName = _rc.find_file (IconResource);

   if (IconName) {

      const String Name = Type.get_name ();

      if (Name) {

         QImage back (
            (int)_iconExtent,
            (int)_iconExtent,
            QImage::Format_ARGB32_Premultiplied);
         QPainter painter (&back);
         painter.setCompositionMode (QPainter::CompositionMode_Source);
         painter.fillRect (back.rect (), Qt::transparent);
         painter.setCompositionMode (QPainter::CompositionMode_SourceOver);
         QSvgRenderer qsr (QString (IconName.get_buffer ()));
         QRectF size = qsr.viewBoxF ();
         qreal width = size.width ();
         qreal height = size.height ();
         qreal scale = (width > height) ? width : height;
         if (scale <= 0.0f) { scale = 1.0f; }
         scale = _iconExtent / scale;
         width *= scale;
         height *= scale;
         size.setWidth (width);
         size.setHeight (height);
         if (height < _iconExtent) { size.moveTop ((_iconExtent - height) * 0.5f); }
         if (width < _iconExtent) { size.moveLeft ((_iconExtent - width) * 0.5f); }
         qsr.render (&painter, size);
         painter.end ();
         QIcon icon;
         icon.addPixmap (QPixmap::fromImage (back));
         QStandardItem *item = new QStandardItem (icon, Name.get_buffer ());
         item->setEditable (false);
         _model.appendRow (item);
      }
   }
   else if (IconResource) {

      _log.error << "Unable to find icon resource: " << IconResource
          << " for object type: " << Type.get_name () << endl;
   }

   RuntimeIterator it;
   ObjectType next;

   while (Type.get_next_child (it, next)) { _add_type (next); }
}
开发者ID:sbhall,项目名称:dmz,代码行数:57,代码来源:dmzQtPluginIconPalletTool.cpp

示例13: setCenter

void GraphNode::setCenter(const QPointF& pt)
{
    cx = pt.x();
    cy = pt.y();

    QRectF newRect = rect();
    newRect.moveLeft(cx - r);
    newRect.moveTop(cy - r);
    setRect(newRect);
}
开发者ID:zdonato,项目名称:GraphGUI,代码行数:10,代码来源:graphnode.cpp

示例14: sizeby

    foreach(QReportWidgetBase  *widget, _selectedWidgets) {
        QRectF widgetRect = _widgetRects[widget];
        QSizeF sizeby(
            rc.width()  / selectionRect.width(),
            rc.height() / selectionRect.height());

        widgetRect.moveTop(widgetRect.top()  - selectionRect.top());
        widgetRect.moveLeft(widgetRect.left() - selectionRect.left());

        widgetRect.setTop(widgetRect.top()     *sizeby.height());
        widgetRect.setBottom(widgetRect.bottom()  *sizeby.height());
        widgetRect.setLeft(widgetRect.left()    *sizeby.width());
        widgetRect.setRight(widgetRect.right()   *sizeby.width());

        widgetRect.moveTop(widgetRect.top()  + rc.top());
        widgetRect.moveLeft(widgetRect.left() + rc.left());

        widgetRect.moveTopLeft(widget->parentItem()->mapFromScene(widgetRect.topLeft()));

        widget->setPos(widgetRect.topLeft());
        widget->setSize(widgetRect.width(), widgetRect.height());

    }
开发者ID:HamedMasafi,项目名称:QtReport,代码行数:23,代码来源:qreportwidgetresizer.cpp

示例15:

QList<QRectF> Mode4::locate()
{
	QList<QRectF> results;
	if (rect.height() > 360){
		return results;
	}
	QSize size = ARender::instance()->getActualSize();
	QRectF init = rect;
	init.moveCenter(QPointF(size.width() / 2.0, 0));
	init.moveBottom(size.height()*(Config::getValue("/Danmaku/Protect", false) ? 0.85 : 1));
	int stp = Config::getValue("/Danmaku/Grating", 10);
	for (int height = init.top(); height >= 0; height -= stp){
		init.moveTop(height);
		results.append(init);
	}
	return results;
}
开发者ID:LethargicTamias,项目名称:BiliLocal,代码行数:17,代码来源:Mode4.cpp


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