UbuntuのQtで下記の様なプログラムを作成しています。
これは、QtCreatorのウイジェットアプリケーションの多少変形です。
Q1) 『this->setLayout(main);』のthisの代わりに、書くことができるコードはありますか?
//main.cpp
/* /#include "dialog.h"
/ */#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Dialog w;
w.show();
return a.exec();
}
//dialog.cpp
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
int w=600, h=400;
ui->setupUi(this);
setGeometry(0,0,w,h);
QVBoxLayout *VBLayoutA=new QVBoxLayout;
VBLayoutA->addWidget(ui->graphicsView);
VBLayoutA->addWidget(ui->label);
QHBoxLayout *HBLayoutB=new QHBoxLayout;
HBLayoutB->addWidget(ui->pushButton1);
HBLayoutB->addWidget(ui->pushButton2);
HBLayoutB->addWidget(ui->checkBox);
QVBoxLayout *main=new QVBoxLayout;
main->addLayout(VBLayoutA);
main->addLayout(HBLayoutB);
this->setLayout(main);//<ーーーここです。
...
}
以上、宜しくお願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。