简体   繁体   English

仅在MacOS中,QLineEdit构造器中的setupUi上的应用程序崩溃

[英]Application crashes on setupUi in QLineEdit consturctor only in MacOS

I have a Qt4.8 QWidget with generated Ui_ file 我有一个带有生成的Ui_文件的Qt4.8 QWidget

class QMyWidget: public QWidget
{
Q_OBJECT
public:
    Ui_MyGeneratedUi ui;
    ...
}

It works fine on Windows and Linux, but when I try to 它在Windows和Linux上都能正常工作,但是当我尝试

QMyWidget() {
    > ui.setupUi(this);
    ...
}

on MacOS (10.12) my application crashes with stack trace looking like this or this . 在MacOS(10.12)我与堆栈跟踪应用程序崩溃看上去像这样这样 There seems to be nothing particularly suspicious in UI. UI中似乎没有什么特别可疑的。 Moreover there are many other QWidgets in my application with generated UI and QLineEdit insed which work well on MacOS too. 此外,我的应用程序中还有许多其他QWidget,它们带有生成的UI和QLineEdit,它们在MacOS上也能很好地工作。

Mentioned bugs are closed and seem to be amended in Qt5 but I wonder what is the reason of these crashed and if there is any workaround. 提到的bug已关闭,似乎已在Qt5中进行了修改,但我想知道这些崩溃的原因是什么,是否有解决方法。

This bug is very cryptic. 此错误非常神秘。 In my case it was triggered by several QLabels in both parent and child QWidget with inside which were used as buttons 在我的情况下,它是由父级和子级QWidget中带有内部按钮的多个QLabel触发的

QLabel* sample = new QLabel("<a href=\"dothething\">Do thing</a>", ui.protoarea);
QObject::connect(
        sample, SIGNAL(linkActivated(QString)),
        this, SLOT(add_clicked(QString))
);

as soon as I replaced them with actual buttons everything started working. 一旦我用实际的按钮替换了它们,一切就开始起作用。 There seems to be a glitch in logic which element should be focused at adding new widget. 逻辑上似乎有一个小故障,哪个元素应专注于添加新的小部件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM