2011-12-31 2 views
2

인 QDialog ... 오류 메시지는 다음과 같습니다실행이 응용 프로그램을 실행하는 동안 나는 오류를 얻고있다

MAIN.CPP (11) : 오류 : 식을 클래스 유형 INT의 R = 대화가 있어야합니다. exec(); 왜 그런지 모르겠다. !!!

qmake를 사용하여 make 파일을 생성 중입니다 ... Dialog가 QDialog에서 상속 되었기 때문에 필요한 파일을 * .pro 파일에 추가했습니다. exec 함수에 액세스해야합니다!

#include <QtGui> 
#include <QDialog> 
#include <QtUtil.h> 
#include <Mathematics.h> 
#include <Pair.h> 
#include "View.h" 

class QMesseageBox; 
class QAction; 
class QDialogButtonBox; 
class QLabel; 
class QLineEdit; 
class QPushButton; 
class QTextEdit; 

class Dialog : public QDialog { 
    Q_OBJECT 
public: 
    Dialog() { 
     QHBoxLayout *layout = new QHBoxLayout; 
     // prevent left vertical box from growing when main window resized 
     layout->addStretch(1); 

     QLabel*  lab_Layers = new QLabel(tr("Layers")); 
     d_inline = new QLineEdit; 
     d_inline->setText("50"); 

     scene = new QGraphicsScene(0, 0, 500, 500); 
     view = new View; 

     layout->addWidget(view); 
     view->setScene(scene); 

     QVBoxLayout *mainLayout = new QVBoxLayout; 
     mainLayout->addLayout(layout); 
     setLayout(mainLayout); 
     setWindowTitle(tr("VI Smooth 0.4"));  
    } 

private slots: 
    // scroll the "after" window when "before" one is scrolled (so they 
    // remain in sync) 

private: 
    QAction* exitAction; 
    QtUtil qt; 
    QLineEdit* d_inline; 
    QGraphicsScene* scene; 
    QGraphicsView* view; 
}; 

메인 클래스

#include <QApplication> 
#include <QMessageBox> 
#include "Dialog.h" 

int 
main(int argc, char **argv) { 
    QApplication app(argc, argv); 
     argv++; 
    Dialog dialog(); 
// dialog.showMaximized(); 
    int r = dialog.exec(); 
    return 0; 
} 

답변

1

그것은 다음과 같이 보일 것이다. Dialog 개체를 만드는 경우 show()으로 전화해야합니다. 그리고 app.exec()main()에 반환해야합니다.

+0

대화 상자가 나타나지 않았습니다 ... – Eyad

+1

@turbonerd 아마도 'show()'를 호출해야합니다. – Arlen

+0

나는 시도했다 ... 나는 QDialog에서 어떤 함수도 호출 할 수 없다 : ( – Eyad

관련 문제