Exemple #1
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();
}
Exemple #2
0
void MainWindow::fileNew() {
    if (_sdata)
        if (!_sdata->isSaved())
            maybeSave();
        fileClose();
    // if project exist,
        // if not saved,
            //maybe save?
        // close


    // run wizard
    QMdiSubWindow * world = _mdiArea->addSubWindow(new WorldWidget());
    world->setWindowTitle("*untitled");
    world->setMinimumSize(300, 200);
    world->show();

    _sdata = new SimulationData();
    _sdata->setSaved(false);

    connect(_sdata, SIGNAL(fileNameChanged(QString)), world, SLOT(setWindowTitle(QString)));

    SensorNetwork net(40);
    net.push();
    net.start();

    _fileSaveAsAct->setEnabled(true);
    _fileCloseAct->setEnabled(true);
}
Exemple #3
0
void GameForm::BuildCharacterTabs(){
    tabsWidget = new CharacterTabs();
    QMdiSubWindow* tabsWindow = ui->gameArea->addSubWindow(tabsWidget);
    tabsWindow->setWindowTitle("PlayerName");
    tabsWindow->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
    tabsWindow->setFixedSize(tabsWidget->width()+15, tabsWidget->height()+35);

}
Exemple #4
0
void GameForm::BuildTownWindow(){
    townWidget = new TownWidget();
    QMdiSubWindow* townWindow = ui->gameArea->addSubWindow(townWidget);
    townWindow->setWindowTitle("The City");
    townWindow->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
    townWindow->setFixedSize(townWidget->width()+15, townWidget->height()+35);

}
Exemple #5
0
void PropLov::setTabName(const QModelIndex &index)
{
    QMdiSubWindow *subWindow = qobject_cast<QMdiSubWindow *> (this->parent());

    QString lovName = modelData(DBLOVXML::LOV, DBLOVXML::NAME,index).toString();
    QString id = this->dataId(index);

    this->setObjectName("PropLov::" + id);
    subWindow->setWindowIcon(qvariant_cast<QIcon>(index.data(Qt::DecorationRole)));
    subWindow->setWindowTitle(lovName);
}
Exemple #6
0
void MainWindow::on_actionControlPixmap_triggered()
{
    QAxWidget *container = activeAxWidget();
    if (!container)
        return;

    QLabel *label = new QLabel;
    label->setPixmap(QPixmap::grabWidget(container));
    QMdiSubWindow *subWindow = mdiArea->addSubWindow(label);
    subWindow->setWindowTitle(tr("%1 - Pixmap").arg(container->windowTitle()));
    label->show();
}
Exemple #7
0
void CodeEdit::updateTitle()
{
    QMdiSubWindow *sub = (QMdiSubWindow *)this->parent();

    if ( !rev->textChangedSinceSave ) {

        rev->textChangedSinceSave = true;
        sub->setWindowTitle( rev->getDisplayName() );

        //TODO: also update in shredTree UI
    }
}
Exemple #8
0
// 新建文件菜单
void MainWindow::on_action_New_triggered()
{
    // 新建文本编辑器部件
    QTextEdit *edit = new QTextEdit(this);

    // 使用QMdiArea类的addSubWindow()函数创建子窗口,以文本编辑器为中心部件
    QMdiSubWindow *child = ui->mdiArea->addSubWindow(edit);

    child->setWindowTitle(tr("多文档编辑器子窗口"));

    // 显示子窗口
    child->show();
}
Exemple #9
0
void MainWindow::on_actionControlDocumentation_triggered()
{
    QAxWidget *container = activeAxWidget();
    if (!container)
        return;
    
    const QString docu = container->generateDocumentation();
    if (docu.isEmpty())
	return;

    DocuWindow *docwindow = new DocuWindow(docu);
    QMdiSubWindow *subWindow = mdiArea->addSubWindow(docwindow);
    subWindow->setWindowTitle(DocuWindow::tr("%1 - Documentation").arg(container->windowTitle()));
    docwindow->show();
}
Exemple #10
0
void MainWindow::new_swing_trade()
{
    QString contractName = tr("Exchange-Contract-").append(QString("%1").arg(swing_counter_));
    SwingTradeDialog *swingTradeDialog = new SwingTradeDialog(contractName, swing_counter_, disp_, this);

    connect(swingTradeDialog, SIGNAL(update_contract(QString)), this, SLOT(update_swing_contract(QString)));

    QMdiSubWindow *qMdiSubWindow = ui_->mdiArea_swing->addSubWindow(swingTradeDialog);
    qMdiSubWindow->setAttribute(Qt::WA_DeleteOnClose);
    qMdiSubWindow->setFixedSize(265, 440);
    qMdiSubWindow->setWindowFlags(qMdiSubWindow->windowFlags()& ~Qt::WindowMaximizeButtonHint& ~Qt::WindowMinimizeButtonHint);
    qMdiSubWindow->setWindowTitle(contractName);
    qMdiSubWindow->show();

    swing_counter_++;
    selcon_->setCurrentText(contractName);
}
Exemple #11
0
void
PidMain::openImage()
{
    QString path;

    path = QFileDialog::getOpenFileName(this,
        "Choose an image file to open",
        QString::null,
        "*.jpg *.jpeg");

    if (path != NULL)
    {
        ImageTabs *img = new ImageTabs(mdiArea, path);
        QMdiSubWindow *imgWindow = mdiArea->addSubWindow(img);
        imgWindow->setWindowTitle(path);
        imgWindow->show();
    }
}
Exemple #12
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)) );

}
Exemple #13
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();
}
Exemple #14
0
void ChatList::addChatWindow(ChatWindow* chatw)
{

    connect(m_mainWindow, SIGNAL(closing()), chatw, SLOT(save()));
    int listSize = m_chatWindowList.size();
    beginInsertRows(QModelIndex(), listSize, listSize);


    m_chatMenu.addAction(chatw->toggleViewAction());
    connect(chatw, SIGNAL(ChatWindowHasChanged(ChatWindow *)), this, SLOT(changeChatWindow(ChatWindow *)));

    QMdiSubWindow* subWindowChat = static_cast<QMdiSubWindow*>(m_mainWindow->registerSubWindow(chatw,chatw->toggleViewAction()));

    connect(chatw->chat(), SIGNAL(changedName(QString)), subWindowChat, SLOT(setWindowTitle(QString)));
    m_chatWindowList.append(chatw);
    m_chatSubWindowList.append(subWindowChat);

    if((subWindowChat->height()<451)||(subWindowChat->width()<264))
    {
        subWindowChat->resize(264,451);
    }

    if(NULL!=subWindowChat)
    {
        chatw->setSubWindow(subWindowChat);
        subWindowChat->setWindowTitle(tr("%1 (Chat)").arg(chatw->getTitleFromChat()));
        subWindowChat->setWindowIcon(QIcon(":/chat.png"));
        subWindowChat->setAttribute(Qt::WA_DeleteOnClose, false);
        chatw->setAttribute(Qt::WA_DeleteOnClose, false);

        subWindowChat->setVisible(chatw->toggleViewAction()->isChecked());
    }


    endInsertRows();
}
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 );
}
Exemple #16
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();
}