Skip to content

Window crash when installing Arabic translator (RightToLeft) #9

@MCA4213

Description

@MCA4213

Hello, my application crash when I install the translator (in Arabic, layout rightToLeft) before creating the toolbar. it crash on :
group->AddAction(QToolButton::DelayedPopup, ui.actionAddImage);

After digging in the code I found a null screen has been returned in GetScaleFactor . removing the else, by changing the function as follow has fix the problem:

float GetScaleFactor( const QWidget& widget)
{
    auto scrNumber = QApplication::desktop()->screenNumber(&widget);
    auto screens = QGuiApplication::screens();
    QScreen* scr = screens.at(scrNumber);
    const float defaultDpi = 96.0f;
    return scr->logicalDotsPerInchY() / defaultDpi;
}

I am running on Qt 5.14, MSVC 2019 on Windows 10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions