Пример #1
0
VisualizerContainer::VisualizerContainer(QMdiArea *container, voxie::visualization::Visualizer *visualizer) :
    QWidget(nullptr),
    //icon(":/icons/application-blue.png"),
    icon(visualizer->icon()),
    visualizer(visualizer),
    container(container),
    window(nullptr)
{
    visualizer->setParent(this);
    this->setWindowTitle(this->visualizer->mainView()->windowTitle());
    this->setWindowIcon(icon);
    {
        QVBoxLayout *layout = new QVBoxLayout();
        layout->setMargin(0);
        layout->setSpacing(0);
        {
            QMenuBar *bar = new QMenuBar();
            bar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);

            QAction *popOutAction = bar->addAction("&Pop Out");
            connect(popOutAction, &QAction::triggered, this, &VisualizerContainer::switchPopState);

            layout->addWidget(bar);
            layout->addWidget(visualizer->mainView());
        }
        this->setLayout(layout);
    }

    this->moveToNewMdiChild();
}
Пример #2
0
void TestWidget::setupWidgets(void)
{
    setWindowTitle(this->title);
    QMenuBar *menubar = new QMenuBar(this);
    QMenu *menu = new QMenu(QString("Title: ") + this->title);
    QAction *action_reproduce = new QAction("Reproduce", this);
    menu->addAction(action_reproduce);
    menubar->addMenu(menu);
    setMenuBar(menubar);
    menubar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    setCentralWidget(new QWidget(this));
    centralWidget()->setLayout(new QVBoxLayout(centralWidget()));
    QPushButton *button = new QPushButton("Reproduce", this);
    button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    centralWidget()->layout()->setContentsMargins(0,0,0,0);
    centralWidget()->layout()->setSpacing(0);
    centralWidget()->layout()->addWidget(button);
    connect(action_reproduce, SIGNAL(triggered()), SLOT(reproduce()));
    connect(button, SIGNAL(clicked()), SLOT(reproduce()));
}