int main(int argc, char *argv[]) { QApplication a(argc, argv); MyGLWidget w; w.show(); return a.exec(); }
int main(int argc, char **argv) { Q_INIT_RESOURCE(texture); QApplication app(argc, argv); QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); MyGLWidget myglWidget; myglWidget.show(); return app.exec(); }
MyWidget::MyWidget(QWidget *parent):QWidget(parent) { MyGLWidget *win = new MyGLWidget(); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(win,Qt::AlignLeft); win->grabKeyboard(); win->grabMouse(); setLayout(layout); }
void MainWindow::on_action3D_triggered() { QString dataDir; dataDir = QFileDialog::getExistingDirectory( this, tr("Open Directory"), "/", QFileDialog::ShowDirsOnly|QFileDialog::DontResolveSymlinks ); QDir dir(dataDir); QFileInfoList infoList = dir.entryInfoList(QDir::Files|QDir::NoDotAndDotDot); if (infoList.size() > 0 && infoList[0].absoluteFilePath().right(4) == "pmpl") { MyGLWidget *w = new MyGLWidget(dataDir); w->get3DDataParam(infoList); //这句之后w->data3D赋值完毕 w->resize(1000,800); w->setWindowTitle("3D扫描图"); w->show(); } }