Beispiel #1
0
void MainWindow::new_model()
{
    VoxelEditor * ed = new VoxelEditor(this);
    QMdiSubWindow * w = mdi->addSubWindow(ed);
    ed->reset();
    w->showMaximized();
}
Beispiel #2
0
void MWMDIManagerImpl::addMDIWindow(MWMDIWindow* w) {
    bool contains = getWindowById(w->getId())!=NULL;
    if (contains) {
        assert(0); //must never happen
        return;
    }
    w->setParent(mdiArea);
    QMdiSubWindow* qw = mdiArea->addSubWindow(w);
    qw->setWindowTitle(w->windowTitle());
    QIcon icon = w->windowIcon();
    if (icon.isNull()) {
        icon = QIcon(":/ugene/images/ugene_16.png");
    }
    qw->setWindowIcon(icon);
    //qw->setAttribute(Qt::WA_NativeWindow);
    MDIItem* i = new MDIItem(w, qw);
    items.append(i);
    qw->installEventFilter(this);

    uiLog.trace(QString("Adding window: '%1'").arg(w->windowTitle()));

    updateState();

    emit si_windowAdded(w);

    if (items.count() == 1 && defaultIsMaximized) {
        qw->showMaximized();
    } else {
        qw->show();
    }
    qw->raise();
}
Beispiel #3
0
void MainWindow::clone_model()
{
    VoxelFile * voxel = get_voxel();
    if (voxel == NULL)
        return;
    VoxelEditor * ed = new VoxelEditor(this);
    QMdiSubWindow * w = mdi->addSubWindow(ed);
    ed->clone(voxel);
    w->showMaximized();
}
Beispiel #4
0
void MainWindow::open_model()
{
    QString name = get_model_name(this, false);
    if (name.isEmpty())
        return;
    VoxelEditor * ed = new VoxelEditor(this);
    QMdiSubWindow * w = mdi->addSubWindow(ed);
    ed->load(name);
    w->showMaximized();
}
Beispiel #5
0
void CodeArea::addCodeWindow(Revision *r, QString fileText, int cursorPos = 0)
{
    //setup the widget
    CodeEdit *edit = new CodeEdit(this);
    edit->setPlainText( fileText );
    edit->rev = r;

    //set highlighter no matter what language, dirty hack
    SuperWordHighlighter *wh =
            new SuperWordHighlighter(edit->document());

    //setup the subwindow
    QMdiSubWindow *subWindow = addSubWindow( edit );
    subWindow->showMaximized();
    subWindow->setWindowTitle( edit->rev->getBufferName() );

    //don't delete windows when closed
    subWindow->setAttribute(Qt::WA_DeleteOnClose, false);

    //add to subwindow maps
    subWindowMap[r] = subWindow;
    subWindowMap2[subWindow] = r;

    //save the position, so that it may be restored
    if ( cursorPos > 0 )
    {
        QTextCursor cursor = edit->textCursor();
        cursor.setPosition( cursorPos );
        edit->setTextCursor( cursor );
    }

    notifyNewRevision(r);

    //listen changes
    edit->listenChanges();

    //edit->focusWidget();
    setActiveSubWindow( subWindow );

    //listen to zoom changes
    connect( this, SIGNAL(updateZoom(int)), edit, SLOT(onZoomChanged(int)) );

}
Beispiel #6
0
int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments) {
  // load the scene.
  osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
  if (!loadedModel) {
    std::cerr << arguments[0] << ": No data loaded." << std::endl;
    std::cout << "usage: " << arguments[0] << " [--mdi] nodefile" << std::endl;
    return 1;
  }

  std::cout << "Using AdapterWidget - QGLWidget subclassed to integrate with "
               "osgViewer using its embedded graphics window support."
            << std::endl;

  if (arguments.read("--mdi")) {
    std::cout << "Using ViewetQT MDI version" << std::endl;
    /*
         Following problems are found here:
         - miminize causes loaded model to disappear (some problem with Camera
       matrix? - clampProjectionMatrix is invalid)
         */
    ViewerQT* viewerWindow = new ViewerQT;
    viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
    viewerWindow->setSceneData(loadedModel.get());

    QMainWindow* mw = new QMainWindow();
    QMdiArea* mdiArea = new QMdiArea(mw);
    mw->setCentralWidget(mdiArea);

    QMdiSubWindow* subWindow = mdiArea->addSubWindow(viewerWindow);
    subWindow->showMaximized();
    subWindow->setWindowTitle("New Window");
    mw->show();
  } else {
    ViewerQT* viewerWindow = new ViewerQT;
    viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
    viewerWindow->setSceneData(loadedModel.get());
    viewerWindow->show();
  }

  a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
  return a.exec();
}
void MainWindow::addEditorWindow() {
    _editor = new QsciScintilla;
    _luaLexer = new QsciLexerLua;
    _editor->setLexer(_luaLexer);
    _luaLexer->setFont(QFont("Courier New"));

    // symbols
    _editor->setMarginType(1, QsciScintilla::SymbolMargin);
    _editor->setMarginWidth(1, "xx");
    _editor->setMarginSensitivity (1, true);
    _editor->markerDefine(QsciScintilla::RightTriangle, BOOKMARK_MARKER);
    _editor->setMarkerBackgroundColor(QColor (0,0,232), BOOKMARK_MARKER);
    _editor->markerDefine(QsciScintilla::Circle, BREAKPOINT_MARKER);
    _editor->setMarkerBackgroundColor(QColor (192,0,0), BREAKPOINT_MARKER);
    _editor->markerDefine(QsciScintilla::RightTriangle, DEBUGGER_MARKER);
    _editor->setMarkerBackgroundColor(QColor (255,255,0), DEBUGGER_MARKER);

    // line numbers
    _editor->setMarginsForegroundColor(QColor (96, 96, 96));
    _editor->setMarginsBackgroundColor(QColor (232, 232, 220));
    _editor->setMarginType(2, QsciScintilla::TextMargin);
    _editor->setMarginWidth(2, "xxxx");
    _editor->setMarginLineNumbers(2, true);

    // other features
    _editor->setBraceMatching(QsciScintilla::StrictBraceMatch);
    _editor->setAutoIndent(true);
    _editor->setIndentationWidth(2);
    _editor->setIndentationsUseTabs(false);

    _editor->setCaretLineVisible(true);
    _editor->setCaretLineBackgroundColor(QColor (248, 248, 248));

    _editor->setUtf8(true);

    QMdiSubWindow *subWindow = ui->mdiArea->addSubWindow(_editor);
    subWindow->setWindowIcon(QIcon("://icons/text-x-generic-template.svg"));
    subWindow->showMaximized();
}
Beispiel #8
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::setWidthOfMdiWindow(QWidget* mdiWindowWidget, int newWidth)
{
    QMdiSubWindow* mdiWindow = findMdiSubWindow(mdiWindowWidget);
    if (mdiWindow)
    {
        QSize subWindowSize = mdiWindow->size();

        subWindowSize.setWidth(std::max(newWidth, 100));
        mdiWindow->resize(subWindowSize);

        if (mdiWindow->isMaximized())
        {
            // Set window temporarily to normal state and back to maximized
            // to redo layout so the whole window canvas is filled
            // Tried to activate layout, did not work as expected
            // Tested code:
            //   m_layout->activate();
            //   mdiWindow->layout()->activate();

            mdiWindow->showNormal();
            mdiWindow->showMaximized();
        }
    }
}
void MainWindow::openPage( int type, quint32 accountid )
{
    if( type <= 0 )
        return;

    QUuid id;
    PageWidgetMember *tab = NULL;
    QString header;

    //usual window
    if( type != 13 )
    {
        if( !hList.contains( type, id ) )
        {
            //create page
            tab = createPage( type, accountid, header );
        }
        else
        {
            //show page
            setPageActive( id, accountid );
            return;
        }
    }
    //transactions window
    else if( type == 13 && accountid > 0 )
    {
        if( !hList.trContains( accountid, id ) )
        {
            tab = createPage( type, accountid, header );
        }
        else
        {
            setPageActive( id );
            return;
        }
    }

    // -------
    // -------

    if( tab == NULL )
        return;

    connect( tab, SIGNAL( closeRequest( const QUuid & ) ), this, SLOT( closePage( const QUuid & ) ) );
    connect( tab, SIGNAL( closed( int ) ), this, SLOT( closedPage( int ) ) );
    connect( tab, SIGNAL( headerChanged( const QString & ) ), this, SLOT( changeHeader( const QString & ) ) );

    //create an empty tab on tabwidget
    disconnect( tabWidget, SIGNAL( currentChanged(int) ), this, SLOT( setPageActive(int) ) );

    tabWidget->addTab( new QWidget(), header );
    tabWidget->setCurrentIndex( tabWidget->count()-1 );
    if( tab->hasIcon() )
        tabWidget->setTabIcon( tabWidget->count()-1, *tab->icon() );

    connect( tabWidget, SIGNAL( currentChanged(int) ), this, SLOT( setPageActive(int) ) );
    // ----

    //create and show window in MDI Area
    QMdiSubWindow *subW = new QMdiSubWindow(this);
    subW->setWidget( tab );
    subW->setWindowTitle( header );
    subW->setAttribute( Qt::WA_DeleteOnClose );
    mdiArea->addSubWindow( subW );
    subW->showMaximized();
    subW->show();
    // -----


    //creating a handler for the tab
    Handler *h = new Handler();
    h->id = QUuid::createUuid();
    h->accountid = accountid;
    h->type = type;
    h->number = tabWidget->count()-1;
    // -----

    tab->setHandler( *h );
    hList.append( h );
}
Beispiel #10
0
int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments)
{
    // load the scene.
    osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
    if (!loadedModel)
        {
            std::cout << arguments[0] <<": No data loaded." << std::endl;
            return 1;
        }
    
    std::cout<<"Using AdapterWidget - QGLWidget subclassed to integrate with osgViewer using its embedded graphics window support."<<std::endl;
    
    if (arguments.read("--CompositeViewer"))
        {
            CompositeViewerQT* viewerWindow = new CompositeViewerQT;

            unsigned int width = viewerWindow->width();
            unsigned int height = viewerWindow->height();
        
            {
                osgViewer::View* view1 = new osgViewer::View;
                view1->getCamera()->setGraphicsContext(viewerWindow->getGraphicsWindow());
                view1->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0);
                view1->getCamera()->setViewport(new osg::Viewport(0,0,width,height/2));
                view1->setCameraManipulator(new osgGA::TrackballManipulator);
                view1->setSceneData(loadedModel.get());
            
                viewerWindow->addView(view1);
            }
        
            {
                osgViewer::View* view2 = new osgViewer::View;
                view2->getCamera()->setGraphicsContext(viewerWindow->getGraphicsWindow());
                view2->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0);
                view2->getCamera()->setViewport(new osg::Viewport(0,height/2,width,height/2));
                view2->setCameraManipulator(new osgGA::TrackballManipulator);
                view2->setSceneData(loadedModel.get());
            
                viewerWindow->addView(view2);
            }

            viewerWindow->show();
        }
    else if (arguments.read("--mdi")) {
        std::cout<<"Using ViewetQT MDI version"<<std::endl;
        /*
          Following problems are found here:
          - miminize causes loaded model to disappear (some problem with Camera matrix? - clampProjectionMatrix is invalid)
        */
        ViewerQT* viewerWindow = new ViewerQT;
        viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
        viewerWindow->setSceneData(loadedModel.get());
 
        QMainWindow* mw = new QMainWindow();
        QMdiArea* mdiArea = new QMdiArea(mw);
        mw->setCentralWidget(mdiArea);

        QMdiSubWindow *subWindow = mdiArea->addSubWindow(viewerWindow);
        subWindow->showMaximized();
        subWindow->setWindowTitle("New Window");
        mw->show();
    } else {
        ViewerQT* viewerWindow = new ViewerQT;

        viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
        viewerWindow->setSceneData(loadedModel.get());

        viewerWindow->show();
    }    
    
    
    a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
   
    return a.exec();
}