qboxlayout与qt布局(三)
来源:互联网 发布:c语言 __函数 编辑:程序博客网 时间:2024/06/05 08:01
呃,,,记性总是不大好。每次找Qlayout的入口点时都要重新断点,真是的。好吧,把一些东西记一下下的。
QLayout是在哪里开始影响使用它的控件的呢?
其实,是这样的,
首先Qt的消息都是要经过 QApplication::notify()预先处理的,而对于 QApplication::notify()未处理的消息,就会通过调用QApplicationPrivate::notify_helper()来把消息发送到接收者那里去的。不过,在QApplicationPrivate::notify_helper()发消息到接收者那里去之前,它是会尝试调用一下下QLayout的widgetEvent()函数的,这样,就会跑到QLayout里面去,结果是QLayout把放在它里面的控件的size一一重新计算一遍的。代码如下:
bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
{
// send to all application event filters
if (sendThroughApplicationEventFilters(receiver, e))
return true;
if (receiver->isWidgetType()) {
QWidget *widget = static_cast<QWidget *>(receiver);
#if !defined(Q_WS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))
// toggle HasMouse widget state on enter and leave
if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) &&
(!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window()))
widget->setAttribute(Qt::WA_UnderMouse, true);
else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave)
widget->setAttribute(Qt::WA_UnderMouse, false);
#endif
// 嗯,就是这个入口啦~
if (QLayout *layout=widget->d_func()->layout) {
layout->widgetEvent(e);
}
}
// send to all receiver event filters
if (sendThroughObjectEventFilters(receiver, e))
return true;
// deliver the event
bool consumed = receiver->event(e);
e->spont = false;
return consumed;
}
- qboxlayout与qt布局(三)
- qboxlayout与qt布局(二)
- qboxlayout与qt布局(一)
- Qt 布局之 QBoxLayout Class
- Qt之水平/垂直布局(QBoxLayout、QHBoxLayout、QVBoxLayout)
- Qt之水平/垂直布局(QBoxLayout、QHBoxLayout、QVBoxLayout)
- Qt之水平/垂直布局(QBoxLayout、QHBoxLayout、QVBoxLayout)
- Qt之水平/垂直布局(QBoxLayout、QHBoxLayout、QVBoxLayout)
- Qt垂直/水平布局管理器(QBoxLayout,QHBoxLayout, QVBoxLayout)
- QBoxLayout
- QtCreator 布局管理(QLayout,QBoxLayout,QGridLayout,QFormLayout,QStackedLayout)
- Qt designer 中的布局与打破布局
- 【转】QT布局与权重
- QT 多线程信号与槽(三)
- QT 多线程信号与槽(三)
- QT三种布局的使用方法
- 三栏布局与两栏布局
- pyqt QBoxLayout
- C# 中的委托和事件
- Android ApiDemo学习(三)activity(4)
- 【转】使用Flex 4.5 SDK和Flash Builder 4.5构建Web和移动参考应用程序
- 学习参考--“使用SeaJS实现模块化JavaScript开发”
- Java几款性能分析工具的对比
- qboxlayout与qt布局(三)
- VS2010中的自动化测试(4)——Web性能测试
- 新浪微博加载配置文件
- Factory方法解决网站应用不同数据库的问题
- 通过网络使用ADB ( Connect to android with ADB over TCP )
- BackTrack5 R2 KDE下Vmware tools的安装
- Win7 64位操作系统下CreateProcess函数运行System32文件夹下批处理文件出错的原因
- <<High Performance JavaScript>>读书笔记-10.Tools
- MRTG的配置(图)