Qt 中 this->size() this->rect() event->size() 三者差异

测试代码:

void OsgEarthGraphicsView::resizeEvent(QResizeEvent* event)
{
    //if (scene())
    //{
    //    scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
    //}

    QRect rect = this->rect();
    std::cout << "this->rect()" << std::endl;
    std::cout << rect.x() << ' ' << rect.y() << ' ' << rect.width() << ' ' << rect.height() << ' ' << std::endl;

    QSize thissize = this->size();
    std::cout << "this->size()" << std::endl;
    std::cout << thissize.width() << ' ' << thissize.height() << std::endl;

    QSize size = event->size();
    std::cout << "event->size()" << std::endl;
    std::cout << size.width() << ' ' <<  size.height() << std::endl;
}

结果:

Qt 中 this->size() this->rect() event->size() 三者差异

 

 event->size()要比前两者要小一点,估计是窗口边框的缘故。

上一篇:WebGL之Threejs概述


下一篇:自动存储管理ASM日常维护(一)