TabToolbar icon indicating copy to clipboard operation
TabToolbar copied to clipboard

Dual Screen Crash

Open haknkayaa opened this issue 3 years ago • 0 comments

Hi, I have a TabToolbar that works fine when using a single screen. But when I open the project with a dual screen attached to my computer, it crashes.

I found that the crash happens in this function when opened with debug mode. (StyleTools.cpp)

float GetScaleFactor(const QWidget& widget)
{
#if (QT_VERSION <= QT_VERSION_CHECK(5, 10, 0))
    auto scrNumber = QApplication::desktop()->screenNumber(widget.mapToGlobal(QPoint(0,0)));
    auto screens = QGuiApplication::screens();
    QScreen* scr = screens.at(scrNumber);
#else
    QScreen* scr = QGuiApplication::screenAt(widget.mapToGlobal(QPoint(0,0)));
#endif
    const float defaultDpi = 96.0f;
    return scr->logicalDotsPerInchY() / defaultDpi;
}

By the way, my screens have different resolutions.

1st screen: 1920x1080 (16.9) 2nd screen: 2560x1440 (16:9)

Anyone have any ideas about the problem? Thanks.

haknkayaa avatar Aug 06 '21 07:08 haknkayaa