void QgsTileScaleWidget::showTileScale( QMainWindow *mainWindow )
{
  QDockWidget *dock = mainWindow->findChild<QDockWidget *>( "theTileScaleDock" );
  if ( dock )
  {
    dock->setVisible( dock->isHidden() );
    return;
  }

  QgsMapCanvas *canvas = mainWindow->findChild<QgsMapCanvas *>( "theMapCanvas" );
  QgsDebugMsg( QString( "canvas:%1 [%2]" ).arg(( ulong ) canvas, 0, 16 ).arg( canvas ? canvas->objectName() : "" ) );
  if ( !canvas )
  {
    QgsDebugMsg( "map canvas theMapCanvas not found" );
    return;
  }

  QgsTileScaleWidget *tws = new QgsTileScaleWidget( canvas );
  tws->setObjectName( "theTileScaleWidget" );

  QObject *legend = mainWindow->findChild<QObject*>( "theLayerTreeView" );
  if ( legend )
  {
    connect( legend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
             tws, SLOT( layerChanged( QgsMapLayer* ) ) );
  }
  else
  {
    QgsDebugMsg( "legend not found" );
  }

  //create the dock widget
  dock = new QDockWidget( tr( "Tile Scale Panel" ), mainWindow );
  dock->setObjectName( "theTileScaleDock" );
  dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
  mainWindow->addDockWidget( Qt::RightDockWidgetArea, dock );

  // add to the Panel submenu
  QMenu *panelMenu = mainWindow->findChild<QMenu *>( "mPanelMenu" );
  if ( panelMenu )
  {
    // add to the Panel submenu
    panelMenu->addAction( dock->toggleViewAction() );
  }
  else
  {
    QgsDebugMsg( "panel menu not found" );
  }

  dock->setWidget( tws );

  connect( dock, SIGNAL( visibilityChanged( bool ) ), tws, SLOT( scaleEnabled( bool ) ) );

  QSettings settings;
  dock->setVisible( settings.value( "/UI/tileScaleEnabled", false ).toBool() );
}
Beispiel #2
0
MainWindow::MainWindow()
{
	AddressInput* addressInput = new AddressInput( this );
	this->addToolBar( addressInput );

	QDockWidget* motor0Dock = new QDockWidget( "Motor 0", this );
	motor0Dock->setWidget( new MotorWidget( this, 0 ) );
	motor0Dock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
	addDockWidget(Qt::BottomDockWidgetArea, motor0Dock );
	motor0Dock->setFloating( false );
	motor0Dock->setVisible( true );

	QDockWidget* motor1Dock = new QDockWidget( "Motor 1", this );
	motor1Dock->setWidget( new MotorWidget( this, 1 ) );
	motor1Dock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
	addDockWidget(Qt::BottomDockWidgetArea, motor1Dock );
	motor1Dock->setFloating( false );
	motor1Dock->setVisible( true );

	QDockWidget* motor2Dock = new QDockWidget( "Motor 2", this );
	motor2Dock->setWidget( new MotorWidget( this, 2 ) );
	motor2Dock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
	addDockWidget(Qt::BottomDockWidgetArea, motor2Dock );
	motor2Dock->setFloating( false );
	motor2Dock->setVisible( true );

	QDockWidget* odometryDock = new QDockWidget( "Odometry", this );
	odometryDock->setWidget( new OdometryWidget( this ) );
	odometryDock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
	addDockWidget(Qt::BottomDockWidgetArea, odometryDock );
	odometryDock->setFloating( false );
	odometryDock->setVisible( true );

	setCentralWidget( new ControlPanelWidget( this ) );
}
void PogadeMainWindow::closeProject() {
  //TODO: finish it
  QListIterator<QDockWidget*> i(_dockSourceEditorList);
  while (i.hasNext()) {
    PogadeSourceCodeEditor* w = (PogadeSourceCodeEditor*) i.next()->widget();

    bool saveall = false;
    //TODO: check changed and ask user
    if(w->fileChanged()) {
      if(saveall) {
        w->saveFile();
      }
      else {
        QMessageBox msgBox;
        msgBox.setText(tr("The File %1 revision %2 ( %3 ) has been modified and not saved").arg(w->sourceFile()->name()).arg(w->sourceFile()->getRevInUse()).arg(w->sourceFile()->getRevisionName(w->sourceFile()->getRevInUse())));
        msgBox.setInformativeText(tr("Do you want to save your changes before changing revision?"));
        msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::SaveAll | QMessageBox::Discard | QMessageBox::Cancel);
        msgBox.setDefaultButton(QMessageBox::SaveAll);
        int ret = msgBox.exec();
        switch (ret) {
          case QMessageBox::SaveAll:
            saveall = true;
          case QMessageBox::Save:
            w->saveFile();
            break;
          case QMessageBox::Discard:
            break;
          case QMessageBox::Cancel:
            return;
            break;
          default:
            // should never be reached
            break;
        }
      }
    }
  }

  //TODO: clean the project stuff
  _dockProjectViewer->setVisible(false);
  delete _dockProjectViewer->widget();
  delete _dockProjectViewer;
  _dockProjectViewer = nullptr;

  while(!_dockSourceEditorList.isEmpty()) {
      QDockWidget* dock = _dockSourceEditorList.takeFirst();
      dock->setVisible(false);
      PogadeSourceCodeEditor* w = (PogadeSourceCodeEditor*) dock->widget();
      delete w;
    }

  _dockSourceEditorList.clear();
  _allCorrect = true;
  _validProject = false;
  delete _project;
  _project = nullptr;

  this->setUpProject();
}
Beispiel #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    SettingsObserver(Settings::Category::Layout),
    ui(new Ui::MainWindow),
    m_treeView(0),
    m_graphicsItemView(0),
    m_graphicsScene(0),
    m_proxyModel(0),
    m_model(0),
    m_addSymbolsDialog(0),
    m_aboutDialog(0),
    m_settingsDialog(0),
    m_smuflLoader(0),
    m_commonApplication(0)
{
    ui->setupUi(this);

    m_commonApplication = new CommonApplication();
    m_sharedApplication = Application(m_commonApplication);

    LayoutSettings::registerObserver(this);

    QDir pluginsDir(QCoreApplication::applicationDirPath());
    if (!pluginsDir.exists(pluginsDirName)) {
        pluginsDir.mkdir(pluginsDirName);
    }
    pluginsDir.cd(pluginsDirName);

    initMusicFont();

    m_addSymbolsDialog = new AddSymbolsDialog(this);
    m_aboutDialog = new AboutDialog(this);
    m_settingsDialog = new SettingsDialog(this);

    CommonPluginManager *pluginManager = new CommonPluginManager(pluginsDir);
    m_pluginManager = PluginManager(pluginManager);
    pluginManager->setSharedPluginManager(m_pluginManager);
    pluginManager->setMusicFont(m_musicFont);

    createModelAndView();
    createMenusAndToolBars();
    createAndPopulateSymbolPalettes();
    createConnections();
    // Show at least first instrument palette
    if (m_pluginManager->instrumentNames().count()) {
        QString instrumentName = m_pluginManager->instrumentNames().at(0);
        QDockWidget *instrumentDock = m_symbolDockWidgets.value(instrumentName);
        if (instrumentDock) {
            instrumentDock->setVisible(true);
        }
    }
    createObjectNames();

    setWindowTitle(tr("%1 [*]")
                   .arg(QApplication::applicationName()));
    updateUi();
}
Beispiel #5
0
void MainWindow::createModelAndView()
{
    m_treeView = new TreeView(this);
    m_treeView->setPluginManager(m_pluginManager);
    QDockWidget *treeViewDock = new QDockWidget("Tree View", this);
    treeViewDock->setWidget(m_treeView);
    treeViewDock->setWindowTitle("Tree View");
    addDockWidget(Qt::RightDockWidgetArea, treeViewDock);
    treeViewDock->setVisible(false);
    connect(ui->viewTreeViewAction, &QAction::triggered,
            [this, treeViewDock] (bool checked) {
        treeViewDock->setVisible(checked);
    });
    connect(treeViewDock, &QDockWidget::visibilityChanged,
            [this] (bool visible) {
        ui->viewTreeViewAction->setChecked(visible);
    });
    m_graphicsItemView = new GraphicsItemView(this);
    m_graphicsItemView->setPluginManager(m_pluginManager);
    m_graphicsItemView->setApplication(m_sharedApplication);

    MusicModel *musicModel = new MusicModel(this);
    musicModel->setPluginManager(m_pluginManager);

    m_model = musicModel;

    MusicProxyModel *proxyModel = new MusicProxyModel(this);
    proxyModel->setPluginManager(m_pluginManager);
    proxyModel->setSourceModel(m_model);
    m_proxyModel = proxyModel;

    m_treeView->setModel(m_proxyModel);

    m_graphicsItemView->setModel(m_model);
    setCentralWidget(m_graphicsItemView);
}
void ControlSingleton::showDialog(Gui::TaskView::TaskDialog *dlg)
{
    // only one dialog at a time
    assert(!ActiveDialog || ActiveDialog==dlg);
    Gui::DockWnd::CombiView* pcCombiView = qobject_cast<Gui::DockWnd::CombiView*>
        (Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
    // should return the pointer to combo view
    if (pcCombiView) {
        pcCombiView->showDialog(dlg);
        // make sure that the combo view is shown
        QDockWidget* dw = qobject_cast<QDockWidget*>(pcCombiView->parentWidget());
        if (dw) {
            dw->setVisible(true);
            dw->toggleViewAction()->setVisible(true);
            dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
        }

        if (ActiveDialog == dlg)
            return; // dialog is already defined
        ActiveDialog = dlg;
        connect(dlg, SIGNAL(destroyed()), this, SLOT(closedDialog()));
    }
    // not all workbenches have the combo view enabled
    else if (!_taskPanel) {
        QDockWidget* dw = new QDockWidget();
        dw->setWindowTitle(tr("Task panel"));
        dw->setFeatures(QDockWidget::DockWidgetMovable);
        _taskPanel = new Gui::TaskView::TaskView(dw);
        dw->setWidget(_taskPanel);
        _taskPanel->showDialog(dlg);
        getMainWindow()->addDockWidget(Qt::LeftDockWidgetArea, dw);
        connect(dlg, SIGNAL(destroyed()), dw, SLOT(deleteLater()));

        // if we have the normal tree view available then just tabify with it
        QWidget* treeView = Gui::DockWindowManager::instance()->getDockWindow("Tree view");
        QDockWidget* par = treeView ? qobject_cast<QDockWidget*>(treeView->parent()) : 0;
        if (par && par->isVisible()) {
            getMainWindow()->tabifyDockWidget(par, dw);
            qApp->processEvents(); // make sure that the task panel is tabified now
            dw->show();
            dw->raise();
        }
    }
}
Beispiel #7
0
void QStaticWidgetSwitchable3D::beforeOpen()
{
    m_StaticImage = QPixmap(m_pWidget->size()/*, QImage::Format_RGB32*/);
    if(!m_pWidget->isVisible())
    {
        m_pWidget->show();
        m_pWidget->hide();
    }
    m_pWidget->render(&m_StaticImage);
    m_pOwner->setFocus();
    /*QGLWidget* qgl = NULL;
    Q_FOREACH(qgl, m_QGLWidgetsToRender)
    {
    if(qgl->isVisible())
    {
    QWidget* parent = (QWidget*)m_pOwner;
    QPoint screenQGLCoords = qgl->mapTo(m_pWidget, QPoint(0,0));
    float w = float(qgl->width());
    float h = float(qgl->height());
    QRectF glRectF(0,0,w,h);
    QPainter painter(&m_StaticImage);
    painter.drawImage(glRectF, qgl->grabFrameBuffer(true));
    }
    }*/

    if(m_pWidget->inherits("QMainWindow"))
    {
        QMainWindow* pMainWindow = (QMainWindow*)m_pWidget;
        QList<QDockWidget*> docks = pMainWindow->findChildren<QDockWidget*>();
        QDockWidget* dock = NULL;
        Q_FOREACH(dock, docks)
        {
            if(dock->isFloating() && !dock->isHidden())
            {
                if(!m_FloatingVisibleDockWidgets.contains(dock))
                {
                    m_FloatingVisibleDockWidgets.append(dock);
                    dock->setVisible(false);
                }
            }
        }
    }
PointViewerMainWindow::PointViewerMainWindow(const QGLFormat& format)
    : m_progressBar(0),
    m_pointView(0),
    m_shaderEditor(0),
    m_helpDialog(0),
    m_logTextView(0),
    m_maxPointCount(200*1000*1000), // 200 million
    m_geometries(0),
    m_ipcServer(0),
    m_hookManager(0)
{
#ifndef _WIN32
    setWindowIcon(QIcon(":resource/icons/hicolor/256x256/apps/displaz.png"));
#else
    // On windows, application icon is set via windows resource file
#endif
    setWindowTitle("Displaz");
    setAcceptDrops(true);

    m_helpDialog = new HelpDialog(this);

    m_geometries = new GeometryCollection(this);
    connect(m_geometries, SIGNAL(layoutChanged()), this, SLOT(updateTitle()));
    connect(m_geometries, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(updateTitle()));
    connect(m_geometries, SIGNAL(rowsInserted(QModelIndex,int,int)),    this, SLOT(updateTitle()));
    connect(m_geometries, SIGNAL(rowsRemoved(QModelIndex,int,int)),     this, SLOT(updateTitle()));

    //--------------------------------------------------
    // Set up file loader in a separate thread
    //
    // Some subtleties regarding qt thread usage are discussed here:
    // http://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation
    //
    // Main point: each QObject has a thread affinity which determines which
    // thread its slots will execute on, when called via a connected signal.
    QThread* loaderThread = new QThread();
    m_fileLoader = new FileLoader(m_maxPointCount);
    m_fileLoader->moveToThread(loaderThread);
    connect(loaderThread, SIGNAL(finished()), m_fileLoader, SLOT(deleteLater()));
    connect(loaderThread, SIGNAL(finished()), loaderThread, SLOT(deleteLater()));
    //connect(m_fileLoader, SIGNAL(finished()), this, SIGNAL(fileLoadFinished()));
    connect(m_fileLoader, SIGNAL(geometryLoaded(std::shared_ptr<Geometry>, bool, bool)),
            m_geometries, SLOT(addGeometry(std::shared_ptr<Geometry>, bool, bool)));
    connect(m_fileLoader, SIGNAL(geometryMutatorLoaded(std::shared_ptr<GeometryMutator>)),
            m_geometries, SLOT(mutateGeometry(std::shared_ptr<GeometryMutator>)));
    loaderThread->start();

    //--------------------------------------------------
    // Menus
    menuBar()->setNativeMenuBar(false); // OS X doesn't activate the native menu bar under Qt5

    // File menu
    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    QAction* openAct = fileMenu->addAction(tr("&Open"));
    openAct->setToolTip(tr("Open a data set"));
    openAct->setShortcuts(QKeySequence::Open);
    connect(openAct, SIGNAL(triggered()), this, SLOT(openFiles()));
    QAction* addAct = fileMenu->addAction(tr("&Add"));
    addAct->setToolTip(tr("Add a data set"));
    connect(addAct, SIGNAL(triggered()), this, SLOT(addFiles()));
    QAction* reloadAct = fileMenu->addAction(tr("&Reload"));
    reloadAct->setStatusTip(tr("Reload point files from disk"));
    reloadAct->setShortcut(Qt::Key_F5);
    connect(reloadAct, SIGNAL(triggered()), this, SLOT(reloadFiles()));

    fileMenu->addSeparator();
    QAction* screenShotAct = fileMenu->addAction(tr("Scree&nshot"));
    screenShotAct->setStatusTip(tr("Save screen shot of 3D window"));
    screenShotAct->setShortcut(Qt::Key_F9);
    connect(screenShotAct, SIGNAL(triggered()), this, SLOT(screenShot()));

    fileMenu->addSeparator();
    QAction* quitAct = fileMenu->addAction(tr("&Quit"));
    quitAct->setStatusTip(tr("Exit the application"));
    quitAct->setShortcuts(QKeySequence::Quit);
    connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));

    // View menu
    QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
    QAction* trackballMode = viewMenu->addAction(tr("Use &Trackball camera"));
    trackballMode->setCheckable(true);
    trackballMode->setChecked(false);
    // Background sub-menu
    QMenu* backMenu = viewMenu->addMenu(tr("Set &Background"));
    QSignalMapper* mapper = new QSignalMapper(this);
    // Selectable backgrounds (svg_names from SVG standard - see QColor docs)
    const char* backgroundNames[] = {/* "Display Name", "svg_name", */
                                        "Default",      "#3C3232",
                                        "Black",        "black",
                                        "Dark Grey",    "dimgrey",
                                        "Slate Grey",   "#858C93",
                                        "Light Grey",   "lightgrey",
                                        "White",        "white" };
    for(size_t i = 0; i < sizeof(backgroundNames)/sizeof(const char*); i+=2)
    {
        QAction* backgroundAct = backMenu->addAction(tr(backgroundNames[i]));
        QPixmap pixmap(50,50);
        QString colName = backgroundNames[i+1];
        pixmap.fill(QColor(colName));
        QIcon icon(pixmap);
        backgroundAct->setIcon(icon);
        mapper->setMapping(backgroundAct, colName);
        connect(backgroundAct, SIGNAL(triggered()), mapper, SLOT(map()));
    }
    connect(mapper, SIGNAL(mapped(QString)),
            this, SLOT(setBackground(QString)));
    backMenu->addSeparator();
    QAction* backgroundCustom = backMenu->addAction(tr("&Custom"));
    connect(backgroundCustom, SIGNAL(triggered()),
            this, SLOT(chooseBackground()));
    // Check boxes for drawing various scene elements by category
    viewMenu->addSeparator();
    QAction* drawBoundingBoxes = viewMenu->addAction(tr("Draw Bounding bo&xes"));
    drawBoundingBoxes->setCheckable(true);
    drawBoundingBoxes->setChecked(false);
    QAction* drawCursor = viewMenu->addAction(tr("Draw 3D &Cursor"));
    drawCursor->setCheckable(true);
    drawCursor->setChecked(true);
    QAction* drawAxes = viewMenu->addAction(tr("Draw &Axes"));
    drawAxes->setCheckable(true);
    drawAxes->setChecked(true);
    QAction* drawGrid = viewMenu->addAction(tr("Draw &Grid"));
    drawGrid->setCheckable(true);
    drawGrid->setChecked(false);
    QAction* drawAnnotations = viewMenu->addAction(tr("Draw A&nnotations"));
    drawAnnotations->setCheckable(true);
    drawAnnotations->setChecked(true);

    // Shader menu
    QMenu* shaderMenu = menuBar()->addMenu(tr("&Shader"));
    QAction* openShaderAct = shaderMenu->addAction(tr("&Open"));
    openShaderAct->setToolTip(tr("Open a shader file"));
    connect(openShaderAct, SIGNAL(triggered()), this, SLOT(openShaderFile()));
    QAction* editShaderAct = shaderMenu->addAction(tr("&Edit"));
    editShaderAct->setToolTip(tr("Open shader editor window"));
    QAction* saveShaderAct = shaderMenu->addAction(tr("&Save"));
    saveShaderAct->setToolTip(tr("Save current shader file"));
    connect(saveShaderAct, SIGNAL(triggered()), this, SLOT(saveShaderFile()));
    shaderMenu->addSeparator();

    // Help menu
    QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
    QAction* helpAct = helpMenu->addAction(tr("User &Guide"));
    connect(helpAct, SIGNAL(triggered()), this, SLOT(helpDialog()));
    helpMenu->addSeparator();
    QAction* aboutAct = helpMenu->addAction(tr("&About"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutDialog()));


    //--------------------------------------------------
    // Point viewer
    m_pointView = new View3D(m_geometries, format, this);
    setCentralWidget(m_pointView);
    connect(drawBoundingBoxes, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawBoundingBoxes()));
    connect(drawCursor, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawCursor()));
    connect(drawAxes, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawAxes()));
    connect(drawGrid, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawGrid()));
    connect(drawAnnotations, SIGNAL(triggered()),
            m_pointView, SLOT(toggleDrawAnnotations()));
    connect(trackballMode, SIGNAL(triggered()),
            m_pointView, SLOT(toggleCameraMode()));
    connect(m_geometries, SIGNAL(rowsInserted(QModelIndex,int,int)),
            this, SLOT(geometryRowsInserted(QModelIndex,int,int)));

    //--------------------------------------------------
    // Docked widgets
    // Shader parameters UI
    QDockWidget* shaderParamsDock = new QDockWidget(tr("Shader Parameters"), this);
    shaderParamsDock->setFeatures(QDockWidget::DockWidgetMovable |
                                  QDockWidget::DockWidgetClosable);
    QWidget* shaderParamsUI = new QWidget(shaderParamsDock);
    shaderParamsDock->setWidget(shaderParamsUI);
    m_pointView->setShaderParamsUIWidget(shaderParamsUI);

    // Shader editor UI
    QDockWidget* shaderEditorDock = new QDockWidget(tr("Shader Editor"), this);
    shaderEditorDock->setFeatures(QDockWidget::DockWidgetMovable |
                                  QDockWidget::DockWidgetClosable |
                                  QDockWidget::DockWidgetFloatable);
    QWidget* shaderEditorUI = new QWidget(shaderEditorDock);
    m_shaderEditor = new ShaderEditor(shaderEditorUI);
    QGridLayout* shaderEditorLayout = new QGridLayout(shaderEditorUI);
    shaderEditorLayout->setContentsMargins(2,2,2,2);
    shaderEditorLayout->addWidget(m_shaderEditor, 0, 0, 1, 1);
    connect(editShaderAct, SIGNAL(triggered()), shaderEditorDock, SLOT(show()));
    shaderEditorDock->setWidget(shaderEditorUI);

    shaderMenu->addAction(m_shaderEditor->compileAction());
    connect(m_shaderEditor->compileAction(), SIGNAL(triggered()),
            this, SLOT(compileShaderFile()));

    // TODO: check if this is needed - test shader update functionality
    //connect(m_shaderEditor, SIGNAL(sendShader(QString)),
    //        &m_pointView->shaderProgram(), SLOT(setShader(QString)));

    // Log viewer UI
    QDockWidget* logDock = new QDockWidget(tr("Log"), this);
    logDock->setFeatures(QDockWidget::DockWidgetMovable |
                         QDockWidget::DockWidgetClosable);
    QWidget* logUI = new QWidget(logDock);
    m_logTextView = new LogViewer(logUI);
    m_logTextView->setReadOnly(true);
    m_logTextView->setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
    m_logTextView->connectLogger(&g_logger); // connect to global logger
    m_progressBar = new QProgressBar(logUI);
    m_progressBar->setRange(0,100);
    m_progressBar->setValue(0);
    m_progressBar->hide();
    connect(m_fileLoader, SIGNAL(loadStepStarted(QString)),
            this, SLOT(setProgressBarText(QString)));
    connect(m_fileLoader, SIGNAL(loadProgress(int)),
            m_progressBar, SLOT(setValue(int)));
    connect(m_fileLoader, SIGNAL(resetProgress()),
            m_progressBar, SLOT(hide()));
    QVBoxLayout* logUILayout = new QVBoxLayout(logUI);
    //logUILayout->setContentsMargins(2,2,2,2);
    logUILayout->addWidget(m_logTextView);
    logUILayout->addWidget(m_progressBar);
    //m_logTextView->setLineWrapMode(QPlainTextEdit::NoWrap);
    logDock->setWidget(logUI);

    // Data set list UI
    QDockWidget* dataSetDock = new QDockWidget(tr("Data Sets"), this);
    dataSetDock->setFeatures(QDockWidget::DockWidgetMovable |
                              QDockWidget::DockWidgetClosable |
                              QDockWidget::DockWidgetFloatable);
    DataSetUI* dataSetUI = new DataSetUI(this);
    dataSetDock->setWidget(dataSetUI);
    QAbstractItemView* dataSetOverview = dataSetUI->view();
    dataSetOverview->setModel(m_geometries);
    connect(dataSetOverview, SIGNAL(doubleClicked(const QModelIndex&)),
            m_pointView, SLOT(centerOnGeometry(const QModelIndex&)));
    m_pointView->setSelectionModel(dataSetOverview->selectionModel());

    // Set up docked widgets
    addDockWidget(Qt::RightDockWidgetArea, shaderParamsDock);
    addDockWidget(Qt::LeftDockWidgetArea, shaderEditorDock);
    addDockWidget(Qt::RightDockWidgetArea, logDock);
    addDockWidget(Qt::RightDockWidgetArea, dataSetDock);
    tabifyDockWidget(logDock, dataSetDock);
    logDock->raise();
    shaderEditorDock->setVisible(false);

    // Add dock widget toggles to view menu
    viewMenu->addSeparator();
    viewMenu->addAction(shaderParamsDock->toggleViewAction());
    viewMenu->addAction(logDock->toggleViewAction());
    viewMenu->addAction(dataSetDock->toggleViewAction());

    // Create custom hook events from CLI at runtime
    m_hookManager = new HookManager(this);
}
Beispiel #9
0
MainWindow::MainWindow()
{
  setupUi(this);

  // add window for tool parameters
  QDockWidget *dockWidget_toolParams = new QDockWidget(this);
  dockWidget_toolParams->setWindowTitle("Parameters");
  QWidget *dockWidgetContent_toolParams = new QWidget();
  dockWidget_toolParams->setWidget(dockWidgetContent_toolParams);

  QGridLayout * gridLayout_toolParams = new QGridLayout(dockWidgetContent_toolParams);

  int indRow=1;
  QDoubleSpinBox * radiusSpinBox = addDoubleParameter("radius",  dockWidgetContent_toolParams, gridLayout_toolParams, indRow);
  QSpinBox * nbPointsSpinBox = addIntParameter("nb points",  dockWidgetContent_toolParams, gridLayout_toolParams, indRow);
  
  QSpacerItem * verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
  //QPushButton * pushButton_ok = new QPushButton("OK", dockWidgetContent_toolParams);
  
  int indCol=0, rowSpan=1, colSpan=1;
  //gridLayout_toolParams->addWidget(pushButton_ok,indRow, indCol, rowSpan, 2);
  //indRow++;
  gridLayout_toolParams->addItem(verticalSpacer, indRow, indCol, rowSpan, colSpan);

  addDockWidget(static_cast<Qt::DockWidgetArea>(1), dockWidget_toolParams);
  //QMainWindow::splitDockWidget(dockWidget_toolParams, layersWidget, static_cast<Qt::Orientation>(2));

  m_matParametersView = new MaterialParametersView();
  setCentralWidget(m_matParametersView);

  m_reducedCoordinatesView = new ReducedCoordinatesView();
  QDockWidget *dockWidget = new QDockWidget(this);
  dockWidget->setWidget(m_reducedCoordinatesView);
  //dockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
  dockWidget->setObjectName(QString::fromUtf8("family plot"));
  dockWidget->setVisible(true);
  addDockWidget(static_cast<Qt::DockWidgetArea>(2), dockWidget);
  dockWidget->setFloating(true);
  dockWidget->setAllowedAreas(Qt::NoDockWidgetArea);

  setAcceptDrops(true);

  std::vector<QString> materialParameterStrings((int)exProject::UndefinedType);
  materialParameterStrings[exProject::EXType] = "EX";
  materialParameterStrings[exProject::EYType] = "EY";
  materialParameterStrings[exProject::EZType] = "EZ";
  materialParameterStrings[exProject::NuXYType] = "NuXY";
  materialParameterStrings[exProject::NuXZType] = "NuXZ";
  materialParameterStrings[exProject::NuYZType] = "NuYZ";
  materialParameterStrings[exProject::MuXYType] = "MuXY";
  materialParameterStrings[exProject::MuXZType] = "MuXZ";
  materialParameterStrings[exProject::MuYZType] = "MuYZ";
  materialParameterStrings[exProject::DensityType] = "Density";
  materialParameterStrings[exProject::StrengthType] = "Strength";

  addMaterialParameterOptions(*m_x_comboBox, materialParameterStrings);
  addMaterialParameterOptions(*m_y_comboBox, materialParameterStrings);
  addMaterialParameterOptions(*m_z_comboBox, materialParameterStrings);
  addMaterialParameterOptions(*m_col_comboBox, materialParameterStrings);

  m_action2D->setChecked(true);
  m_actionRegionSelection->setChecked(false);

  std::vector<QString> typeStrings;
  typeStrings.push_back("Cubic");
  typeStrings.push_back("Orthotropic");

  addMaterialParameterOptions(*m_type_comboBox, typeStrings);

  m_x_comboBox->setCurrentIndex((int)exProject::EXType);
  m_y_comboBox->setCurrentIndex((int)exProject::NuXYType);
  m_z_comboBox->setCurrentIndex((int)exProject::DensityType);
  m_col_comboBox->setCurrentIndex((int)exProject::MuXYType);

  m_project = new exProject();
  m_project->setFileDirectory("..//..//Output//");

  setDim();
  setType();
  setParamToVisualize(0, m_x_comboBox->currentIndex());
  setParamToVisualize(1, m_y_comboBox->currentIndex());
  setParamToVisualize(2, m_z_comboBox->currentIndex());
  setParamToVisualize(3, m_col_comboBox->currentIndex());

  m_matParametersView->setProject(m_project);
  m_materialStructureView->setProject(m_project);
  m_reducedCoordinatesView->setProject(m_project);

  connect(radiusSpinBox, SIGNAL(valueChanged(double)), m_matParametersView, SLOT(onRadiusValueChanged(double)));
  connect(nbPointsSpinBox, SIGNAL(valueChanged(int)), m_matParametersView, SLOT(onNbPointsValueChanged(int)));
}