2010-01-18 4 views
1

Qt Designer 4.6에서 새로운 Qt 위젯을 사용할 때 세그먼트 오류가 발생했습니다. 새로운 위젯을 미리 볼 때 문제가 발생합니다. GDB를 사용할 때커스텀 위젯이 포함 된 Qt Designer 4.6의 세그먼트 오류

나는 문제가있는 것을 발견 qdesigner_internal :: WidgetFactory :: applyStyleToTopLevel :

 

Program received signal SIGSEGV, Segmentation fault. 
qdesigner_internal::WidgetFactory::applyStyleToTopLevel (style=0x0, widget=0x1829df0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/widgetfactory.cpp:777 
777 /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/widgetfactory.cpp: No such file or directory. 
in /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/widgetfactory.cpp 
(gdb) bt 
#0 qdesigner_internal::WidgetFactory::applyStyleToTopLevel (style=0x0, widget=0x1829df0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/widgetfactory.cpp:777 
#1 0x00007ffff7475bed in qdesigner_internal::QDesignerFormBuilder::createPreview (fw=, styleName=..., appStyleSheet=..., deviceProfile=, scriptErrors= 
    0x7fffffffbee0, errorMessage=0x7fffffffc3f0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp:404 
#2 0x00007ffff7476773 in qdesigner_internal::QDesignerFormBuilder::createPreview (fw=0x0, styleName=..., appStyleSheet=..., deviceProfile=..., errorMessage=0x0) 
    at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp:439 
#3 0x00007ffff7532b27 in qdesigner_internal::PreviewManager::createPreview (this=0x837f20, fw=0x1879200, pc=..., deviceProfileIndex=-1, errorMessage=0x7fffffffc3f0, initialZoom=-1) 
    at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/previewmanager.cpp:686 
#4 0x00007ffff75343cf in qdesigner_internal::PreviewManager::showPreview (this=0x837f20, fw=0x1879200, pc=..., deviceProfileIndex=-1, errorMessage=0x7fffffffc3f0) 
    at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/previewmanager.cpp:760 
#5 0x00007ffff753472f in qdesigner_internal::PreviewManager::showPreview (this=0x837f20, fw=0x1879200, style=..., deviceProfileIndex=-1, errorMessage=0x7fffffffc3f0) 
    at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/previewmanager.cpp:659 

널 포인터가 전달 되었기 때문에 :

 

void WidgetFactory::applyStyleToTopLevel(QStyle *style, QWidget *widget) 
{ 
    const QPalette standardPalette = style->standardPalette(); 
    if (widget->style() == style && widget->palette() == standardPalette) 
     return; 
//.... 
} 
 

을 내가 Qt를 새로운 해요 이것이 제 첫 번째 맞춤 위젯입니다. 아무도 이것을 해결할 수있는 단서가 없습니다.

여기 applyStyleToTopLevel 기능에

 

MBICInput::MBICInput(QWidget *parent) : QStackedWidget(parent){ 
    displayPage = new QWidget(); 
    displayPage->setObjectName(QString::fromUtf8("displayPage")); 

    inputLB = new QLabel(displayPage); 
    inputLB->setObjectName(QString::fromUtf8("inputLabel")); 
    inputLB->setCursor(QCursor(Qt::PointingHandCursor)); 

    addWidget(displayPage); 

    EditPage = new QWidget(); 
    EditPage->setProperty("EditInputLine", QVariant(true)); 
    EditPage->setObjectName(QString::fromUtf8("EditPage")); 

    inputInput = new QLineEdit(EditPage); 
    inputInput->setGeometry(QRect(5, 10, 231, 25)); 
    inputInput->setObjectName(QString::fromUtf8("input")); 

    addWidget(EditPage); 

    _animation = new QString(""); 
    _message = new QString("Message"); 
    _validator = new QRegExpValidator(QRegExp("[a-zA-Z]+"), this); 

} 

MBICInput::~MBICInput() { 
} 

QValidator::State MBICInput::validate(QString &text, int &pos) const{ 
    return _validator->validate(text, pos); 
} 

void MBICInput::paintEvent(QPaintEvent *) { 
    QPainter painter(this); 
    painter.setRenderHint(QPainter::Antialiasing); 
} 


QSize MBICInput::minimumSizeHint() const{ 
    return QSize(200, 40); 
} 

QSize MBICInput::sizeHint() const{ 
    return QSize(200, 40); 
} 

void MBICInput::setAnimation(const QString &animation){ 
    *_animation = animation; 
    update(); 
} 

QString MBICInput::animation() const{ 
    return *_animation; 
} 

void MBICInput::setMessage(const QString &message){ 
    *_message = message; 
    update(); 
} 

QString MBICInput::message() const{ 
    return *_message; 
} 

void MBICInput::mousePressEvent(QMouseEvent *event){ 
    if(currentIndex()==0){ 
    setCurrentIndex(1); 
    }else{ 
    setCurrentIndex(0); 
    } 
    update(); 
} 
 
+1

위젯을 미리 볼 때 어떤 스타일을 사용하고 있습니까? 디자이너를 실행중인 운영 체제는 무엇입니까? –

답변

0

, 당신은 유효한 포인터의 검증하지 않고 위젯 포인터를 사용하여 내 위젯 코드입니다. 따라서 을 NULL 위젯 포인터로 처리하면 충돌이 발생합니다.

+0

그래, 그 문제는 applyStyleToTopLevel 함수가 내 것이 아니라 Qt Designer 소스 코드라는 것입니다. 내 질문은, 내 코드에서 그런 오류를 일으켰습니다 무엇입니까 ?? – chedi

0

방금 ​​정보를 얻으려면 Qt 버전 4.5.3-9에서 동일한 코드를 컴파일하고 4.5 디자이너와 잘 작동해야합니다. Qt 4.6 버그 일 수 있습니다 ...