Skip to content
mainwindow.cpp 1.33 KiB
Newer Older
raoul's avatar
raoul committed
#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::keyPressEvent(QKeyEvent* event)
{
    // TODO manage program-level shortcuts
    // else forward to active document key handler
    ui->openGLWidget->keyPressEvent(event);
}

void MainWindow::keyReleaseEvent(QKeyEvent* event)
{
    // TODO manage program-level shortcuts
    // else forward to active document key handler
    ui->openGLWidget->keyReleaseEvent(event);
}

void MainWindow::addTab(QWidget *widget, QString name)
{
    ui->tabWidget->addTab(widget, name);

    auto newtab = new QWidget();
    newtab->setObjectName(QStringLiteral("tab_2"));
    auto gridLayout = new QGridLayout(newtab);
    gridLayout->setSpacing(6);
    gridLayout->setContentsMargins(11, 11, 11, 11);
    gridLayout->setObjectName(QStringLiteral("gridLayout_2"));
    //openGLWidget = new QOpenGLWidget(newtab);
    widget->setParent(newtab);
    widget->setObjectName(QStringLiteral("openGLWidget"));

    gridLayout->addWidget(widget, 0, 0, 1, 1);

    ui->tabWidget->addTab(newtab, QString());

    ui->gridLayout->addWidget(ui->tabWidget, 0, 0, 1, 1);
}

OE_interfaceDisplay* MainWindow::getItfDisplay()
{
    return ui->openGLWidget;
}