コード例 #1
0
	bool ScriptEditorWindow::internal_isPointerHovering(ScriptEditorWindow* thisPtr)
	{
		if (!thisPtr->isDestroyed())
		{
			EditorWidgetBase* widget = thisPtr->getEditorWidget();
			EditorWindowBase* window = widget->getParentWindow();
			if (window == nullptr)
				return false;

			SPtr<RenderWindow> renderWindow = window->getRenderWindow();

			Vector2I pointerPos = gInput().getPointerPosition();
			if(Platform::isPointOverWindow(*renderWindow, pointerPos))
			{
				Rect2I bounds = thisPtr->getEditorWidget()->getBounds();

				Vector2I widgetPos(bounds.x, bounds.y);
				Vector2I screenPos = widget->widgetToScreenPos(widgetPos);

				bounds.x = screenPos.x;
				bounds.y = screenPos.y;

				return bounds.contains(pointerPos);
			}
		}

		return false;
	}
コード例 #2
0
	void ScriptEditorWindow::internal_getBounds(ScriptEditorWindow* thisPtr, Rect2I* bounds)
	{
		if (!thisPtr->isDestroyed())
		{
			EditorWidgetBase* widget = thisPtr->getEditorWidget();
			*bounds = thisPtr->getEditorWidget()->getBounds();
			
			Vector2I widgetPos(0, 0);
			Vector2I screenPos = widget->widgetToScreenPos(widgetPos);

			bounds->x = screenPos.x;
			bounds->y = screenPos.y;
		}
		else
			*bounds = Rect2I();
	}
コード例 #3
0
ファイル: GTUtilsProject.cpp プロジェクト: ugeneunipro/ugene
void GTUtilsProject::openFilesDrop(HI::GUITestOpStatus &os, const QList<QUrl>& urls) {

    QWidget* widget = AppContext::getMainWindow()->getQMainWindow();
    QPoint widgetPos(widget->width()/2, widget->height()/2);

    QMimeData *mimeData = new QMimeData();
    mimeData->setUrls(urls);

    Qt::DropActions dropActions = Qt::DropActions(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction);
    Qt::MouseButtons mouseButtons = Qt::LeftButton;

    if (urls.size() > 1) {
        GTUtilsDialog::waitForDialog(os, new GTSequenceReadingModeDialogUtils(os));
    }

    QDragEnterEvent* dragEnterEvent = new QDragEnterEvent(widgetPos, dropActions, mimeData, mouseButtons, 0);
    GTGlobals::sendEvent(widget, dragEnterEvent);

    QDropEvent* dropEvent = new QDropEvent(widgetPos, dropActions, mimeData, mouseButtons, 0);
    GTGlobals::sendEvent(widget, dropEvent);
}
コード例 #4
0
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
tSmartTowSaveCreatePage::tSmartTowSaveCreatePage( QSize size, tMercuryDataUpdateTimer* pUpdateTimer, QGraphicsItem* pParent )
    :   tContextPage( size, "", pUpdateTimer, pParent )
    ,   m_CurrentFocusIndex( 0 )
    ,   m_SpinnerHeight( 0 )
    ,   m_pSetPointSpinner( 0 )
    ,   m_pSetPointModel( 0 )
    ,   m_pRampModel( 0 )
    ,   m_pOvershootModel( 0 )
    ,   m_pOvershotDurationModel( 0 )
{
    QRect availableRect = AvailableRect();
    static const int cPadding = 2;
    int singleLineSpinnerHeight = availableRect.height() / 5;
    m_SpinnerHeight = (availableRect.height() - (2 * singleLineSpinnerHeight)) / 2;
    QPoint widgetPos(AvailableRect().topLeft());
    
    //Set Point
    CreateInputSpinner();
    m_pSetPointSpinner->setPos(widgetPos);
    widgetPos.setY(widgetPos.y() + cPadding + m_SpinnerHeight);

    //Ramp
    m_pRampModel = new tInputSpinnerNumericalModel<float>(m_Profile.Ramp, 1, 5, 0.2f, tr(""));
    tInputSpinner* pRamp = new tInputSpinnerLabeled( tr("RAMP"), 
                                                     m_pRampModel, 
                                                     QSize(AvailableRect().width(), singleLineSpinnerHeight), 
                                                     this);
    pRamp->setPos(widgetPos);
    Connect( m_pRampModel, SIGNAL( ValueChanged() ), this, SLOT( RampChanged() ) );
    AddInteractiveItem(pRamp);

    widgetPos.setY(widgetPos.y() + cPadding + singleLineSpinnerHeight );

    //Overshoot
    m_pOvershootModel = new tInputSpinnerNumericalModel<int>(m_Profile.Overshoot, 0, 20, 1, tr("%"));
    tInputSpinner* pOvershoot = new tInputSpinnerLabeled( tr("OVERSHOOT"), 
                                                     m_pOvershootModel, 
                                                     QSize(AvailableRect().width(), singleLineSpinnerHeight), 
                                                     this);
    pOvershoot->setPos(widgetPos);
    Connect( m_pOvershootModel, SIGNAL( ValueChanged() ), this, SLOT( OvershootChanged() ) );
    AddInteractiveItem(pOvershoot);
    widgetPos.setY(widgetPos.y() + cPadding + singleLineSpinnerHeight);

    //Overshoot duration
    m_pOvershotDurationModel = new tInputSpinnerNumericalModel<float>(m_Profile.OvershootDuration, 0, 4, 0.1f, tr("SEC"));
    tInputSpinner* pOvershootDuration = new tInputSpinnerLabeled( tr("OVERSHOOT DURATION"), 
                                                     m_pOvershotDurationModel, 
                                                     QSize(AvailableRect().width(), m_SpinnerHeight), 
                                                     this);
    pOvershootDuration->setPos(widgetPos);
    Connect( m_pOvershotDurationModel, SIGNAL( ValueChanged() ), this, SLOT( OvershootDurationChanged() ) );
    AddInteractiveItem(pOvershootDuration);

    Connect(pUpdateTimer, SIGNAL(Timeout100ms()), this, SLOT(PollCruiseData()));

    Connect( tMercurySettings::Instance(), SIGNAL( CruiseSetpointTypeChanged() ), this, SLOT( OnSetpointTypeChanged() ) );
    Connect( tUnitsSettings::Instance(), SIGNAL( UnitsChanged( tUnitsType, int ) ), this, SLOT( OnUnitsChanged( tUnitsType, int ) ) );

    CalculatePaintSizingInfo();
    update();
}