(참고 : 어제 Qt는을 배우기 시작하고 나는이를 요청하기 전에 내 검색을했다.) 표시되지Qt는 버튼을 메인 창에
Qt는 디자이너와 함께 연주의 비트가 내가 더 심각한 프로그램을하기로 결정하면 모든 프로그래밍 방식으로 이전에는 간단한 작업이 단순한 것처럼 보였지만, 이제는 버튼을 표시하는 것이 표시되지 않기 때문에 복잡합니다.
MAIN.CPP
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
PixelPeep p;
p.show();
return app.exec();
}
pixelpeep.h - 관련 부분
class PixelPeep : public QMainWindow
{
Q_OBJECT
public:
explicit PixelPeep(QWidget *parent = 0);
signals:
public slots:
private:
QToolBar * toolBar;
QHBoxLayout * toolbarLayout;
QToolButton * addButton; // add new image
QScrollBar * zoomBar;
};
pixelpeep.cpp - 관련 부분
PixelPeep::PixelPeep(QWidget *parent) :
QMainWindow(parent)
{
resize(600,375);
toolBar = new QToolBar;
addButton = new QToolButton;
addButton->setGeometry(20,20,20,20);
toolBar->addWidget(addButton);
toolbarLayout = new QHBoxLayout;
toolbarLayout->addWidget(addButton);
}
이 모든 후, 나는 빈 창을 얻는다.
가능한 원인, AFAIK :
- 버튼 클래스 생성자에서 생성 된 후 범위를 벗어난 갈 것 - 그것은 여기 그렇지 않다가 동적으로 할당하고, 개인 회원 addButton
- 하여 포인터가없는 있기 때문에 레이아웃에서 또는 크기가 0 인 경우 - 코드에서이 두 가지가 모두 처리 되었기 때문에 그렇지 않습니다.
그 밖의 다른 기능은 무엇입니까? 그런 멍청한 놈 질문 죄송합니다
...
도구 모음 –