stdware / qwindowkit

Cross-platform frameless window framework for Qt. Support Windows, macOS, Linux.
Apache License 2.0
442 stars 67 forks source link

Fix Qt6 Widget Compilation Warnings on Windows & Complete the README. #73

Closed SeaYJ closed 3 months ago

SeaYJ commented 3 months ago

修复 Qt6 Widget 的编译警告

请参考 https://doc.qt.io/qt-6.5/qexposeevent.html 'const QRegion &QExposeEvent::region() const' This function is deprecated since 6.0. We strongly advise against using it in new code. Use QPaintEvent instead. Returns the window area that has been exposed. The region is given in local coordinates.

这个函数已经在 Qt6.0 中被废弃,所以我增加了版本判断并修复了在 Qt6 中的问题。

README 完善

  1. 在 Import - CMake Project 部分添加了更加详细的说明,帮助使用者理解。
  2. 改了一处可能的笔误: image
SineStriker commented 3 months ago

感谢你的pr,但是expose event那部分没法接受,因为qt源码里就是直接使用的,qwk得保持一致。README 里那些问题我手动改掉了。

// qwidgetwindow.cpp

void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
{
    // ...
    if (exposed) {
        // QTBUG-39220, QTBUG-58575: set all (potentially fully obscured parent widgets) mapped.
        m_widget->setAttribute(Qt::WA_Mapped);
        for (QWidget *p = m_widget->parentWidget(); p && !p->testAttribute(Qt::WA_Mapped); p = p->parentWidget())
            p->setAttribute(Qt::WA_Mapped);
        if (!event->m_region.isNull()) // 此处
            wPriv->syncBackingStore(event->m_region);
    } else {
        m_widget->setAttribute(Qt::WA_Mapped, false);
    }
}