qt中把txt文件转换为pdf格式文件出错,高人帮忙,该如何处理

qt中把txt文件转换为pdf格式文件出错,高人帮忙
C/C++ code

void TextEdit::on_action_Font_triggered()
{
    if(activeChildWindow()==NULL)return;
    bool ok;
    QFont font = QFontDialog::getFont(&ok,activeChildWindow()->font(),this);
    if(ok)
    {
        activeChildWindow()->setCurrentFont(font);//current可以undo
        //activeChildWindow()->setFont(font);
    }
}


每次执行此函数都会导致程序终止退出,希望大家帮帮忙。

------解决方案--------------------
检查下activeChildWindow()->font() 有没有取得东西
------解决方案--------------------
你先debug看看到哪一行出错再说
------解决方案--------------------
activeChildWindow()做了什么, 有没有可能返回空指针。