SeriousAlexej / TabToolbar

A small library for creating tabbed toolbars
Other
284 stars 108 forks source link

Window crash when installing Arabic translator (RightToLeft) #9

Open MCA4213 opened 4 years ago

MCA4213 commented 4 years ago

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.