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


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

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


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

示例1: enterEvent

void ToolButton::enterEvent( QEvent * _e )
{
	m_mouseOver = true;
	if( !s_toolTipsDisabled && !m_title.isEmpty() && !m_descr.isEmpty() )
	{
		QPoint p = mapToGlobal( QPoint( 0, 0 ) );
		int scr = QApplication::desktop()->isVirtualDesktop() ?
				QApplication::desktop()->screenNumber( p ) :
				QApplication::desktop()->screenNumber( this );

#ifdef Q_WS_MAC
		QRect screen = QApplication::desktop()->availableGeometry(
									scr );
#else
		QRect screen = QApplication::desktop()->screenGeometry( scr );
#endif

		ToolButtonTip * tbt = new ToolButtonTip( m_pixmap, m_title,
							m_descr,
				QApplication::desktop()->screen( scr ), this );
		connect( this, SIGNAL( mouseLeftButton() ),
							tbt, SLOT( close() ) );

		if( p.x() + tbt->width() > screen.x() + screen.width() )
			p.rx() -= 4;// + tbt->width();
		if( p.y() + tbt->height() > screen.y() + screen.height() )
			p.ry() -= 30 + tbt->height();
		if( p.y() < screen.y() )
			p.setY( screen.y() );
		if( p.x() + tbt->width() > screen.x() + screen.width() )
			p.setX( screen.x() + screen.width() - tbt->width() );
		if( p.x() < screen.x() )
			p.setX( screen.x() );
		if( p.y() + tbt->height() > screen.y() + screen.height() )
			p.setY( screen.y() + screen.height() - tbt->height() );
		tbt->move( p += QPoint( -4, height() ) );
		tbt->show();
	}

	QToolButton::enterEvent( _e );
}
开发者ID:EmebedQtsoft,项目名称:italc2,代码行数:41,代码来源:ToolButton.cpp

示例2: paint

void MemcheckErrorDelegate::paint(QPainter *painter, const QStyleOptionViewItem &basicOption,
                                  const QModelIndex &index) const
{
    QStyleOptionViewItemV4 opt(basicOption);
    initStyleOption(&opt, index);

    const QListView *const view = qobject_cast<const QListView *>(parent());
    const bool isSelected = view->selectionModel()->currentIndex() == index;

    QFontMetrics fm(opt.font);
    QPoint pos = opt.rect.topLeft();

    painter->save();

    const QColor bgColor = isSelected ? opt.palette.highlight().color() : opt.palette.background().color();
    painter->setBrush(bgColor);

    // clear background
    painter->setPen(Qt::NoPen);
    painter->drawRect(opt.rect);

    pos.rx() += s_itemMargin;
    pos.ry() += s_itemMargin;

    const Error error = index.data(ErrorListModel::ErrorRole).value<Error>();

    if (isSelected) {
        // only show detailed widget and let it handle everything
        QTC_ASSERT(m_detailsIndex == index, qt_noop());
        QTC_ASSERT(m_detailsWidget, return); // should have been set in sizeHint()
        m_detailsWidget->move(pos);
        // when scrolling quickly, the widget can get stuck in a visible part of the scroll area
        // even though it should not be visible. therefore we hide it every time the scroll value
        // changes and un-hide it when the item with details widget is paint()ed, i.e. visible.
        m_detailsWidget->show();

        const int viewportWidth = view->viewport()->width();
        const int widthExcludingMargins = viewportWidth - 2 * s_itemMargin;
        QTC_ASSERT(m_detailsWidget->width() == widthExcludingMargins, qt_noop());
        QTC_ASSERT(m_detailsWidgetHeight == m_detailsWidget->height(), qt_noop());
    } else {
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:41,代码来源:memcheckerrorview.cpp

示例3: qrand

KDiamond::Board::Board(KGameRenderer* renderer)
	: m_difficultyIndex(Kg::difficultyLevel() / 10 - 2)
	, m_size(boardSizes[m_difficultyIndex])
	, m_colorCount(boardColorCounts[m_difficultyIndex])
	, m_paused(false)
	, m_renderer(renderer)
	, m_diamonds(m_size * m_size, 0)
{
	for (QPoint point; point.x() < m_size; ++point.rx())
		for (point.ry() = 0; point.y() < m_size; ++point.ry())
		{
			//displacement vectors needed for the following algorithm
			const QPoint dispY1(0, -1), dispY2(0, -2);
			const QPoint dispX1(-1, 0), dispX2(-2, 0);
			//roll the dice to get a color, but ensure that there are not three of a color in a row from the start
			int color;
			while (true)
			{
				color = qrand() % m_colorCount + 1; // +1 because numbering of enum KDiamond::Color starts at 1
				//condition: no triplet in y axis (attention: only the diamonds above us are defined already)
				if (point.y() >= 2) //no triplet possible for i = 0, 1
				{
					const int otherColor1 = diamond(point + dispY1)->color();
					const int otherColor2 = diamond(point + dispY2)->color();
					if (otherColor1 == color && otherColor2 == color)
						continue; //roll the dice again
				}
				//same condition on x axis
				if (point.x() >= 2)
				{
					const int otherColor1 = diamond(point + dispX1)->color();
					const int otherColor2 = diamond(point + dispX2)->color();
					if (otherColor1 == color && otherColor2 == color)
						continue;
				}
				break;
			}
			rDiamond(point) = spawnDiamond(color);
			diamond(point)->setPos(point);
		}
}
开发者ID:avneenathani,项目名称:gsoc2012-kdiamond,代码行数:41,代码来源:board.cpp

示例4: tr

void
AnimationModule::renameSelectedNode()
{
    const std::list<NodeAnimPtr >& selectedNodes = _imp->selectionModel->getCurrentNodesSelection();
    if ( selectedNodes.empty() || (selectedNodes.size() > 1) ) {
        Dialogs::errorDialog( tr("Rename node").toStdString(), tr("You must select exactly 1 node to rename.").toStdString() );
        return;
    }

    EditNodeNameDialog* dialog = new EditNodeNameDialog(selectedNodes.front()->getNodeGui(), _imp->editor);
    QPoint global = QCursor::pos();
    QSize sizeH = dialog->sizeHint();
    global.rx() -= sizeH.width() / 2;
    global.ry() -= sizeH.height() / 2;
    QPoint realPos = global;
    QObject::connect( dialog, SIGNAL(rejected()), this, SLOT(onNodeNameEditDialogFinished()) );
    QObject::connect( dialog, SIGNAL(accepted()), this, SLOT(onNodeNameEditDialogFinished()) );
    dialog->move( realPos.x(), realPos.y() );
    dialog->raise();
    dialog->show();
}
开发者ID:kcotugno,项目名称:Natron,代码行数:21,代码来源:AnimationModule.cpp

示例5: mouseMoveEvent

void FormEditorGraphicsView::mouseMoveEvent(QMouseEvent *event)
{
    if (rect().contains(event->pos())) {
        QGraphicsView::mouseMoveEvent(event);
    } else {
        QPoint position = event->pos();
        QPoint topLeft = rect().topLeft();
        QPoint bottomRight = rect().bottomRight();
        position.rx() = qMax(topLeft.x(), qMin(position.x(), bottomRight.x()));
        position.ry() = qMax(topLeft.y(), qMin(position.y(), bottomRight.y()));
        QMouseEvent *mouseEvent = QMouseEvent::createExtendedMouseEvent(event->type(), position, mapToGlobal(position), event->button(), event->buttons(), event->modifiers());

        QGraphicsView::mouseMoveEvent(mouseEvent);
        delete mouseEvent;
    }

    // Keeps the feedback bubble within screen boundraries
    int tx = qMin(width() - 114,  qMax(16, event->pos().x() + 50));
    int ty = qMin(height() - 45, qMax(10, event->pos().y() - 70));
    m_feedbackOriginPoint = QPoint(tx, ty);
}
开发者ID:yinyunqiao,项目名称:qtcreator,代码行数:21,代码来源:formeditorgraphicsview.cpp

示例6: mouseMoveEvent

void CMoveWidget::mouseMoveEvent(QMouseEvent *mouseEvent)
{
    QPoint p = mouseEvent->globalPos() - dragStartMousePosition;
    if (p.manhattanLength() < QApplication::startDragDistance())
        return;
    QPoint r = dragStartWidgetPosition + p;
    if (r.x() < 0)
        r.setX(0);
    if (r.y() < 0)
    r.setY(0);
    int maxW = this->parentWidget()->geometry().width() - this->geometry().width();
    int maxH = this->parentWidget()->geometry().height() - this->geometry().height();
    if (r.rx() > maxW)
        r.setX(maxW);
    if (r.ry() > maxH)
        r.setY(maxH);

    move(r);

    QWidget::mouseMoveEvent(mouseEvent);
}
开发者ID:bonkor,项目名称:MonopolNet,代码行数:21,代码来源:cmovewidget.cpp

示例7: toLeft

uint VirtualDesktopManager::toLeft(uint id, bool wrap) const
{
    if (id == 0) {
        id = current();
    }
    QPoint coords = m_grid.gridCoords(id);
    Q_ASSERT(coords.x() >= 0);
    while (true) {
        coords.rx()--;
        if (coords.x() < 0) {
            if (wrap) {
                coords.setX(m_grid.width() - 1);
            } else {
                return id; // Already at the left-most desktop
            }
        }
        const uint desktop = m_grid.at(coords);
        if (desktop > 0) {
            return desktop;
        }
    }
}
开发者ID:8l,项目名称:kwin,代码行数:22,代码来源:virtualdesktops.cpp

示例8: moveToAppropriatePos

void DJGameUserContext::moveToAppropriatePos()
{
	QDesktopWidget desktop;
	
	QRect	availableRect	= desktop.availableGeometry();
	QPoint	currentPos	= QCursor::pos();
	QSize	contextSize	= size();
	QRect	contextRect( currentPos, contextSize );	
	
	if ( !availableRect.contains( contextRect ) ) {
		QPoint	rightTop	= QPoint( currentPos.x() + contextSize.width(), currentPos.y() );
		QPoint	leftBottom	= QPoint( currentPos.x(), currentPos.y() + contextSize.height() );
	
		if ( !availableRect.contains(rightTop) ) {
			currentPos.rx()	-= contextSize.width();
		}
		if ( !availableRect.contains(leftBottom) ) {
			currentPos.ry()	-= contextSize.height();
		}
	}
	move( currentPos );
}
开发者ID:CecilHarvey,项目名称:BlueDJGames,代码行数:22,代码来源:DJGameUserContext.cpp

示例9: prepare

void PopupWidget::prepare(PlayListTrack *item, QPoint pos)
{
    pos += QPoint(15,10);

    m_url = item->url();
    hide();
    if(!item)
    {
        m_timer->stop();
        return;
    }

    m_label1->setText(m_formatter.format(item));
    qApp->processEvents();
    updateGeometry ();
    resize(sizeHint());
    qApp->processEvents();
    m_timer->start();
    QRect rect = QApplication::desktop()->availableGeometry(this);
    if(pos.x() + width() > rect.x() + rect.width())
        pos.rx() -= width();
    move(pos);
}
开发者ID:Greedysky,项目名称:qmmp,代码行数:23,代码来源:popupwidget.cpp

示例10: getEditorScene

void Cocos2dxView::attachSpriteToMouse()
{
	ListWidgetItem *item = (ListWidgetItem*)m_listwidget->currentItem();
	if (!item) return;
	EditorScene *scene = getEditorScene();
	if (scene)
	{
		QRect r = this->geometry();
		if (!m_mouseSprite)
		{
			m_mouseSprite = CCSprite::create(item->getAbsoluteFilePath().toLatin1().data());
			m_mouseSprite->setOpacity(128);
			scene->addChild(m_mouseSprite);
		}
		QPoint	pos = mapFromGlobal(QCursor::pos());
		m_mouseSprite->setPosition(ccp(pos.rx(), r.height() - pos.ry()));	//qt的ui y轴坐标转换为opengl的y轴坐标

		m_mouseTimer.setParent(this);
		connect(&m_mouseTimer, SIGNAL(timeout()), this, SLOT(mouseMoveInView()));
		
		m_mouseTimer.start(20);
	}
}
开发者ID:cubemoon,项目名称:SceneEditor-1,代码行数:23,代码来源:Cocos2dxView.cpp

示例11: QDialog

LockedDialog::LockedDialog(QWidget *parent, const QString &text, bool unlockButton)
  : QDialog(parent)
  , ui(new Ui::LockedDialog)
  , m_UnlockClicked(false)
{
  ui->setupUi(this);

  this->setWindowFlags(this->windowFlags() | Qt::ToolTip | Qt::FramelessWindowHint);

  if (parent != nullptr) {
    QPoint position = parent->mapToGlobal(QPoint(parent->width() / 2, parent->height() / 2));
    position.rx() -= this->width() / 2;
    position.ry() -= this->height() / 2;
    move(position);
  }

  if (text.length() > 0) {
    ui->label->setText(text);
  }
  if (!unlockButton) {
    ui->unlockButton->hide();
  }
}
开发者ID:ChristopherC71,项目名称:modorganizer,代码行数:23,代码来源:lockeddialog.cpp

示例12: doProblem

void MathTest::doProblem()
{
    TESTPARM *pt = &testMatrix[testIndex];
    QString opStr = mt::opStrings[testIndex];
    QPoint ops;

    if(pt->bFirst) {
        pt->bFirst = false;
        pt->opLimits.setRect(0, pt->maxops.iaLop[iGradeLevel],
                             0, pt->maxops.iaRop[iGradeLevel]);
        rnd.setMinMax(pt->opLimits);
    }

    switch((int)pt->eOp) {
        case op_add:
            rnd.getPair(ops);
            pt->iAnswer = ops.x() + ops.y();
            break;
        case op_sub:
            rnd.getPair(ops, true );
            pt->iAnswer = ops.x() - ops.y();
            break;
        case op_mul:
            rnd.getPair(ops);
            pt->iAnswer = ops.x() * ops.y();
            break;
        case op_div:
            ops.ry() = rnd.getOneUnique(1, pt->maxops.iaRop[iGradeLevel]);
            ops.rx() = rnd.getOne(1, pt->maxops.iaLop[iGradeLevel])
                     * ops.y();
            pt->iAnswer = ops.x() / ops.y();
            break;
    }

    printProb(ops, opStr);
}
开发者ID:TemanS,项目名称:mathtest,代码行数:36,代码来源:mathtest.cpp

示例13: DrawXAxisLabel

//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
QRect tWindPlotGraph::DrawXAxisLabel(QPainter* pPainter, eGraphType graphType, qreal value, eXAxisLabel labelType, QRect& avoidRect)
{
    QFontMetrics fm = QFontMetrics(pPainter->font());

    QPoint textPoint = GraphToPixel(graphType, 0, value).toPoint();

    textPoint.ry() -= (m_GraphConfig.topMarginHeight );

    QString label;

    if(graphType == eGraphType_TWD)
    {
        if(value < 0.0F)
        {
            label = QString("%1").arg( static_cast<int>( m_GraphConfig.circularLimit[graphType] ) + ( static_cast<int>(value) % static_cast<int>( m_GraphConfig.circularLimit[graphType] ) ), 3, 10, QChar( '0' ) );
        }
        else
        {
            label = QString("%1").arg( static_cast<int>( value ) % static_cast<int>( m_GraphConfig.circularLimit[graphType] ), 3, 10, QChar( '0' ) );
        }

        if( "360" == label )
        {
            label = "000";
        }
    }
    else
    {
        label = QString("%1").arg(value, 0, 'f', 1);
    }

    QRect boundingRect = fm.boundingRect( " " + label + " " );

    // Determine the X position depending on the label type
    int labelXPos;

    switch(labelType)
    {
        case eXAxisLabel_Left :
            // Start label at the left hand axis
            labelXPos = textPoint.rx();
            break;

        case eXAxisLabel_Average :
            // Put centre of label where average value is
            labelXPos = textPoint.rx() - (boundingRect.width() / 2);

            // Check the label doesn't go past either axis
            if(labelXPos < m_GraphConfig.originX[graphType])
            {
                labelXPos = m_GraphConfig.originX[graphType];
            }

            if((labelXPos + boundingRect.width()) > (m_GraphConfig.originX[graphType] + m_GraphConfig.extentX[graphType]))
            {
                labelXPos = m_GraphConfig.originX[graphType] + m_GraphConfig.extentX[graphType] - boundingRect.width();
            }
            break;

        case eXAxisLabel_Right :
            // Put right of label at the right hand axis
            labelXPos = textPoint.rx() - boundingRect.width();
            break;

        default :
            Q_ASSERT(0);
            labelXPos = textPoint.rx() - (boundingRect.width() / 2);
            break;
    }

    QRect textRect = QRect(labelXPos, textPoint.ry(), boundingRect.width(), boundingRect.height() );

    if ( labelType == eXAxisLabel_Average )
    {
        QColor averageColor( Qt::red );
        pPainter->save();
        pPainter->setPen( averageColor );
        pPainter->drawText(textRect, Qt::AlignCenter, label );
        averageColor.setAlpha(128);
        pPainter->setPen( averageColor );
        pPainter->drawLine( textPoint.rx(), m_GraphConfig.originY, textPoint.rx(), (m_GraphConfig.originY + m_GraphConfig.extentY) );
        pPainter->restore();
    }
    else
    {
        // Check if this text will avoid the average text already displayed
        if(textRect.intersects(avoidRect) == false)
        {
            pPainter->drawText(textRect, Qt::AlignCenter, label );
        }
    }

    // Return the rect containing the text with a bit of a margin
    textRect.adjust(-10, 0, 10, 0);
    return textRect;
}
开发者ID:dulton,项目名称:53_hero,代码行数:99,代码来源:tWindPlotGraph.cpp

示例14: drawTileLayer

void IsometricRenderer::drawTileLayer(QPainter *painter,
                                      const TileLayer *layer,
                                      const QRectF &exposed) const
{
    const int tileWidth = map()->tileWidth();
    const int tileHeight = map()->tileHeight();

    if (tileWidth <= 0 || tileHeight <= 1)
        return;

    QRect rect = exposed.toAlignedRect();
    if (rect.isNull())
        rect = boundingRect(layer->bounds());

    QMargins drawMargins = layer->drawMargins();
    drawMargins.setTop(drawMargins.top() - tileHeight);
    drawMargins.setRight(drawMargins.right() - tileWidth);

    rect.adjust(-drawMargins.right(),
                -drawMargins.bottom(),
                drawMargins.left(),
                drawMargins.top());

    // Determine the tile and pixel coordinates to start at
    QPointF tilePos = pixelToTileCoords(rect.x(), rect.y());
    QPoint rowItr = QPoint((int) std::floor(tilePos.x()),
                           (int) std::floor(tilePos.y()));
    QPointF startPos = tileToPixelCoords(rowItr);
    startPos.rx() -= tileWidth / 2;
    startPos.ry() += tileHeight;

    // Compensate for the layer position
    rowItr -= QPoint(layer->x(), layer->y());

    /* Determine in which half of the tile the top-left corner of the area we
     * need to draw is. If we're in the upper half, we need to start one row
     * up due to those tiles being visible as well. How we go up one row
     * depends on whether we're in the left or right half of the tile.
     */
    const bool inUpperHalf = startPos.y() - rect.y() > tileHeight / 2;
    const bool inLeftHalf = rect.x() - startPos.x() < tileWidth / 2;

    if (inUpperHalf) {
        if (inLeftHalf) {
            --rowItr.rx();
            startPos.rx() -= tileWidth / 2;
        } else {
            --rowItr.ry();
            startPos.rx() += tileWidth / 2;
        }
        startPos.ry() -= tileHeight / 2;
    }

    // Determine whether the current row is shifted half a tile to the right
    bool shifted = inUpperHalf ^ inLeftHalf;

    QTransform baseTransform = painter->transform();

    for (int y = startPos.y(); y - tileHeight < rect.bottom();
         y += tileHeight / 2)
    {
        QPoint columnItr = rowItr;

        for (int x = startPos.x(); x < rect.right(); x += tileWidth) {
            if (layer->contains(columnItr)) {
                const Cell &cell = layer->cellAt(columnItr);
                if (!cell.isEmpty()) {
                    const QPixmap &img = cell.tile->image();
                    const QPoint offset = cell.tile->tileset()->tileOffset();

                    qreal m11 = 1;      // Horizontal scaling factor
                    qreal m12 = 0;      // Vertical shearing factor
                    qreal m21 = 0;      // Horizontal shearing factor
                    qreal m22 = 1;      // Vertical scaling factor
                    qreal dx = offset.x() + x;
                    qreal dy = offset.y() + y - img.height();

                    if (cell.flippedAntiDiagonally) {
                        // Use shearing to swap the X/Y axis
                        m11 = 0;
                        m12 = 1;
                        m21 = 1;
                        m22 = 0;

                        // Compensate for the swap of image dimensions
                        dy += img.height() - img.width();
                    }
                    if (cell.flippedHorizontally) {
                        m11 = -m11;
                        m21 = -m21;
                        dx += cell.flippedAntiDiagonally ? img.height()
                                                         : img.width();
                    }
                    if (cell.flippedVertically) {
                        m12 = -m12;
                        m22 = -m22;
                        dy += cell.flippedAntiDiagonally ? img.width()
                                                         : img.height();
                    }

//.........这里部分代码省略.........
开发者ID:Fourth-Doug-Coders,项目名称:4dquest,代码行数:101,代码来源:isometricrenderer.cpp

示例15: QDialog

NodeCreationDialog::NodeCreationDialog(const QString& initialFilter,
                                       QWidget* parent)
    : QDialog(parent)
    , _imp( new NodeCreationDialogPrivate() )
{
    setWindowTitle( tr("Node Creation Tool") );
    setWindowFlags(Qt::Window | Qt::CustomizeWindowHint);
    setObjectName( QString::fromUtf8("nodeCreationDialog") );
    setAttribute(Qt::WA_DeleteOnClose, false);
    _imp->layout = new QVBoxLayout(this);
    _imp->layout->setContentsMargins(0, 0, 0, 0);


    CompleterLineEdit::PluginsNamesMap pluginsMap;
    QString initialFilterName;
    std::string stdInitialFilter = initialFilter.toStdString();
    int i = 0;
    for (PluginsMap::iterator it = _imp->items.begin(); it != _imp->items.end(); ++it) {
        if ( it->second.empty() ) {
            continue;
        }


        if (it->second.size() == 1) {
            std::pair<QString, QString> idNamePair;
            Plugin* p = ( *it->second.begin() );
            if ( !p->getIsUserCreatable() ) {
                continue;
            }

            idNamePair.second = p->generateUserFriendlyPluginID();

            int indexOfBracket = idNamePair.second.lastIndexOf( QString::fromUtf8("  [") );
            if (indexOfBracket != -1) {
                idNamePair.first = idNamePair.second.left(indexOfBracket);
            }

            int weight = getPluginWeight( p->getPluginID(), p->getMajorVersion() );
            pluginsMap.insert( std::make_pair(weight, idNamePair) );

            if (it->first == stdInitialFilter) {
                initialFilterName = idNamePair.first;
            }
            ++i;
        } else {
            QString bestMajorName;
            for (PluginMajorsOrdered::reverse_iterator it2 = it->second.rbegin(); it2 != it->second.rend(); ++it2) {
                if ( !(*it2)->getIsUserCreatable() ) {
                    continue;
                }
                std::pair<QString, QString> idNamePair;
                if ( it2 == it->second.rbegin() ) {
                    idNamePair.second = (*it2)->generateUserFriendlyPluginID();
                    bestMajorName = idNamePair.second;
                } else {
                    idNamePair.second = (*it2)->generateUserFriendlyPluginIDMajorEncoded();
                }


                int indexOfBracket = idNamePair.second.lastIndexOf( QString::fromUtf8("  [") );
                if (indexOfBracket != -1) {
                    idNamePair.first = idNamePair.second.left(indexOfBracket);
                }

                ++i;

                int weight = getPluginWeight( (*it2)->getPluginID(), (*it2)->getMajorVersion() );
                pluginsMap.insert( std::make_pair(weight, idNamePair) );
            }
            if (it->first == stdInitialFilter) {
                initialFilterName = bestMajorName;
            }
        }
    }

    _imp->textEdit = new CompleterLineEdit(pluginsMap, true, this);
    if ( !initialFilterName.isEmpty() ) {
        _imp->textEdit->setText(initialFilterName);
    }

    QPoint global = QCursor::pos();
    QSize sizeH = sizeHint();
    global.rx() -= sizeH.width() / 2;
    global.ry() -= sizeH.height() / 2;
    move( global.x(), global.y() );

    _imp->layout->addWidget(_imp->textEdit);
    _imp->textEdit->setFocus();
    _imp->textEdit->selectAll();
    QTimer::singleShot( 20, _imp->textEdit, SLOT(showCompleter()) );
}
开发者ID:ChristianHeckl,项目名称:Natron,代码行数:91,代码来源:NodeCreationDialog.cpp


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