当前位置: 首页>>代码示例>>C++>>正文


C++ QMdiArea类代码示例

本文整理汇总了C++中QMdiArea的典型用法代码示例。如果您正苦于以下问题:C++ QMdiArea类的具体用法?C++ QMdiArea怎么用?C++ QMdiArea使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QMdiArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: openBrowserHTML

static PyObject * 
openBrowserHTML(PyObject *self, PyObject *args) 
{
    const char* HtmlCode;
    const char* BaseUrl;
    const char* TabName = "Browser";
    if (! PyArg_ParseTuple(args, "ss|s",&HtmlCode,&BaseUrl,&TabName))
        return NULL; 
    
    PY_TRY {
        QMdiSubWindow* browserView = 0;
        QMdiArea* mdiArea = Gui::getMainWindow()->findChild<QMdiArea*>();
        QList<QMdiSubWindow *> mdiViews = mdiArea->subWindowList();
        for (QList<QMdiSubWindow *>::iterator it = mdiViews.begin(); it != mdiViews.end(); ++it) {
            if (qobject_cast<WebGui::BrowserView*>((*it)->widget())) {
                browserView = *it;
                break;
            }
        }

        if (!browserView) {
            WebGui::BrowserView* pcBrowserView = 0;
            pcBrowserView = new WebGui::BrowserView(Gui::getMainWindow());
            pcBrowserView->resize(400, 300);
            pcBrowserView->setHtml(QString::fromUtf8(HtmlCode),QUrl(QString::fromLatin1(BaseUrl)),QString::fromUtf8(TabName));
            Gui::getMainWindow()->addWindow(pcBrowserView);
        }
        else {
            mdiArea->setActiveSubWindow(browserView);
        }
    } PY_CATCH;

    Py_Return; 
}
开发者ID:Jonham,项目名称:FreeCAD,代码行数:34,代码来源:AppWebGuiPy.cpp

示例2: closeEditBlockWindow

/**
 * Closes all windows that are editing the given block.
 */
void QC_DialogFactory::closeEditBlockWindow(RS_Block* block) {
        RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow");

        QC_ApplicationWindow* appWindow = QC_ApplicationWindow::getAppWindow();
        QMdiArea* mdiAreaCAD = appWindow->getMdiArea();

    if (mdiAreaCAD!=NULL) {
                RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: workspace found");

        QList<QMdiSubWindow*> windows = mdiAreaCAD->subWindowList();
        for (int i = 0; i <windows.size(); ++i) {
                        RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: window: %d",
                                i);
            QC_MDIWindow* m = qobject_cast<QC_MDIWindow*>(windows.at(i)->widget());
            if (m!=NULL) {
                                RS_DEBUG->print(
                                        "QC_DialogFactory::closeEditBlockWindow: got mdi");
                                if (m->getDocument()==block) {
                                        RS_DEBUG->print(
                                                "QC_DialogFactory::closeEditBlockWindow: closing mdi");
                                        //m->closeMDI(true, false);
                                        m->setAttribute(Qt::WA_DeleteOnClose);//RLZ: to ensure the window is deleted
                                        m->close();
                                }
                        }
                }
        }
    QMdiSubWindow* subWindow=NULL;
        appWindow->slotWindowActivated(subWindow);

        RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: OK");
}
开发者ID:JGabriel85,项目名称:LibreCAD,代码行数:35,代码来源:qc_dialogfactory.cpp

示例3: Monitor

void Monitor::create(QWidget* parent)
{
	QWidget* window;

	/* Must not create more than one instance */
	if (s_instance != NULL)
		return;

#ifdef __APPLE__
	/* Create a separate window for OSX */
	s_instance = new Monitor(parent, Qt::Window);
	window = s_instance;
#else
	/* Create an MDI window for X11 & Win32 */
	QMdiArea* area = qobject_cast<QMdiArea*> (_app->centralWidget());
	Q_ASSERT(area != NULL);
	s_instance = new Monitor(parent);
	window = area->addSubWindow(s_instance);
#endif

	/* Set some common properties for the window and show it */
	window->setAttribute(Qt::WA_DeleteOnClose);
	window->setWindowIcon(QIcon(":/monitor.png"));
	window->setWindowTitle(tr("Fixture Monitor"));
	window->setContextMenuPolicy(Qt::CustomContextMenu);

	QSettings settings;
	QVariant var = settings.value(SETTINGS_GEOMETRY);
	if (var.isValid() == true)
		window->restoreGeometry(var.toByteArray());
	window->show();
}
开发者ID:speakman,项目名称:qlc,代码行数:32,代码来源:monitor.cpp

示例4: QPushButton

void Dialog::createMainWindow()
{
  QPushButton* btn = new QPushButton( "This is a MainWindow\nwith mdi area and subwindow\n(Close)" );

  //On mainwindows with mdiarea or
  //any widget which takes the layout
  //margins as 0, the frameless helper
  //will not be able to detect corners.
  //To workaround this, either change the
  //mainwindow layout's margin or put the mainwindow
  //inside a QWidget with margins.
  QMainWindow* mw = new QMainWindow;
  QMdiArea* area = new QMdiArea;
  area->addSubWindow(btn);
  mw->setCentralWidget(area);

  //This dosent seem to work!
  //mw.layout()->setMargin(fh2.borderWidth());

  //so we will use a QWidget
  mWidget = new QWidget;
  QVBoxLayout* vl = new QVBoxLayout;
  vl->addWidget(mw);
  mWidget->setLayout(vl);

  connect( btn, SIGNAL(clicked()), mWidget, SLOT(close()) );

  //mWidget->setAttribute(Qt::WA_DeleteOnClose);
  //mWidget->show();

}
开发者ID:jun-zhang,项目名称:qt-utilities,代码行数:31,代码来源:Dialog.cpp

示例5: FixtureManager

void FixtureManager::create(QWidget* parent)
{
	QWidget* window;

	/* Must not create more than one instance */
	if (s_instance != NULL)
		return;

#ifdef __APPLE__
	/* Create a separate window for OSX */
	s_instance = new FixtureManager(parent, Qt::Window);
	window = s_instance;
#else
	/* Create an MDI window for X11 & Win32 */
	QMdiArea* area = qobject_cast<QMdiArea*> (_app->centralWidget());
	Q_ASSERT(area != NULL);
	s_instance = new FixtureManager(parent);
	window = area->addSubWindow(s_instance);
#endif

	/* Set some common properties for the window and show it */
	window->setAttribute(Qt::WA_DeleteOnClose);
	window->setWindowIcon(QIcon(":/fixture.png"));
	window->setWindowTitle(tr("Fixture Manager"));
	window->setContextMenuPolicy(Qt::CustomContextMenu);
        window->show();

	QSettings settings;
	QVariant w = settings.value("fixturemanager/width");
	QVariant h = settings.value("fixturemanager/height");
	if (w.isValid() == true && h.isValid() == true)
		window->resize(w.toInt(), h.toInt());
	else
		window->resize(600, 400);
}
开发者ID:speakman,项目名称:qlc,代码行数:35,代码来源:fixturemanager.cpp

示例6: closeRequested

void RMdiChildQt::closeEvent(QCloseEvent* closeEvent) {
    // ask before closing (document was modified):
    if (documentInterface != NULL) {
        emit closeRequested(this);
    }
    else {
        closeEvent->accept();
        return;
    }

    // close canceled:
    if (!closeEventAccepted) {
        closeEvent->ignore();
        return;
    }

    if (documentInterface != NULL) {
        if (diLast==documentInterface) {
            diLast = NULL;
        }

        // 20130510: leads to empty layer list, etc when
        // closing background tab
        //RMainWindowQt::getMainWindow()->notifyListeners(true);

        // make sure rulers don't try to access view anymore:
        QList<RRulerQt*> rulers = findChildren<RRulerQt*>();
        for (int i=0; i<rulers.size(); i++) {
            rulers.at(i)->setGraphicsView(NULL);
        }

        // give current action a chance to clean up:
        RAction* action = documentInterface->getCurrentAction();
        if (action!=NULL) {
            action->suspendEvent();
        }

        RDocumentInterface* di = documentInterface;
        documentInterface=NULL;
        delete di;
        di = NULL;
    }
    closeEvent->accept();

#ifndef Q_OS_WIN32
    // part of the workaround for QMdiArea bug
    // with events filtering through all stacked windows:
    QMdiArea* mdiArea = RMainWindowQt::getMainWindow()->getMdiArea();
    QMdiSubWindow* child =  mdiArea->currentSubWindow();
    QList<QMdiSubWindow *> children = mdiArea->subWindowList(QMdiArea::ActivationHistoryOrder);
    int index = children.indexOf(child);
    int nextIndex = children.length()-2;
    nextIndex = nextIndex%children.length();
    if (nextIndex!=index) {
        children.at(nextIndex)->showMaximized();
        mdiArea->setActiveSubWindow(children.at(nextIndex));
    }
#endif
}
开发者ID:VixMobile,项目名称:qcad,代码行数:59,代码来源:RMdiChildQt.cpp

示例7: getMainWindow

void CmdTestMDI2::activated(int iMsg)
{
    QMdiArea* area = getMainWindow()->findChild<QMdiArea*>();
    if (area) {
        MDIView* mdi = getMainWindow()->activeWindow();
        area->removeSubWindow(mdi->parentWidget());
        mdi->parentWidget()->showNormal();
    }
}
开发者ID:AllenBootung,项目名称:FreeCAD,代码行数:9,代码来源:CommandTest.cpp

示例8: mainWindowExample

void mainWindowExample()
{
    QMdiArea *mdiArea = new QMdiArea;
//! [0]
    QMainWindow *mainWindow = new QMainWindow;
    mainWindow->setCentralWidget(mdiArea);
//! [0]

    mdiArea->addSubWindow(new QPushButton("Push Me Now!"));

    mainWindow->show();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:12,代码来源:mdiareasnippets.cpp

示例9: FilterChoice

void FilteringService::applyFiltering()
{
    StandardImageWindow* siw = dynamic_cast<StandardImageWindow*>(_ws->getCurrentImageWindow());
    if (siw != NULL)
    {
        _siw = siw;

        _filterChoice = new FilterChoice();
        QMdiArea* area = (QMdiArea*)_gi->centralWidget();
        area->addSubWindow(_filterChoice);
        _filterChoice->show();

        QObject::connect(_filterChoice, SIGNAL(choiceValidate(imagein::algorithm::Filtering*)), this, SLOT(apply(imagein::algorithm::Filtering*)));
        QObject::connect(_filterChoice, SIGNAL(cancelAction()), this, SLOT(cancelAction()));
    }
开发者ID:zakinster,项目名称:detiq-t_,代码行数:15,代码来源:FilteringService.cpp

示例10: InputManager

void InputManager::createAndShow(QWidget* parent, InputMap* inputMap)
{
    QWidget* window = NULL;

    /* Must not create more than one instance */
    if (s_instance == NULL)
    {
#ifdef __APPLE__
        /* Create a separate window for OSX */
        s_instance = new InputManager(parent, inputMap, Qt::Window);
        window = s_instance;
#else
        /* Create an MDI window for X11 & Win32 */
        QMdiArea* area = qobject_cast<QMdiArea*> (parent);
        Q_ASSERT(area != NULL);
        QMdiSubWindow* sub = new QMdiSubWindow;
        s_instance = new InputManager(sub, inputMap);
        sub->setWidget(s_instance);
        window = area->addSubWindow(sub);
#endif

        /* Set some common properties for the window and show it */
        window->setAttribute(Qt::WA_DeleteOnClose);
        window->setWindowIcon(QIcon(":/input.png"));
        window->setWindowTitle(tr("Input Manager"));
        window->setContextMenuPolicy(Qt::CustomContextMenu);
        window->show();

        QSettings settings;
        QVariant var = settings.value(SETTINGS_GEOMETRY);
        if (var.isValid() == true)
        {
            window->restoreGeometry(var.toByteArray());
            AppUtil::ensureWidgetIsVisible(window);
        }
    }
    else
    {
#ifdef __APPLE__
        window = s_instance;
#else
        window = s_instance->parentWidget();
#endif
    }

    window->show();
    window->raise();
}
开发者ID:speakman,项目名称:qlc,代码行数:48,代码来源:inputmanager.cpp

示例11: QMdiArea

void DetectorMainWindow::showImages(QStringList selected)
{
    ui->lineEdit->setText(selected.join(';'));
    QMdiArea * mdiarea = new QMdiArea() ;
    //ui->imagesViewWidget=new QWidget(this);
    ui->imagesViewWidget->setLayout(new QVBoxLayout(ui->imagesViewWidget));
    ui->imagesViewWidget->layout()->removeItem(ui->imagesViewWidget->layout()->itemAt(0));
    ui->imagesViewWidget->layout()->addWidget(mdiarea);

    DetectMultiScaleBatchDialog *d = new DetectMultiScaleBatchDialog (this,selected,&detector);
    QMdiSubWindow *w=mdiarea->addSubWindow(d);
    mdiarea->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    mdiarea->setViewMode(QMdiArea::TabbedView);
    w->show();
    ui->imagesViewWidget->show();
}
开发者ID:majdghada,项目名称:MyPersonDetectionApp,代码行数:17,代码来源:detectormainwindow.cpp

示例12: InputManager

void InputManager::create(QWidget* parent)
{
    QWidget* window;

    /* Must not create more than one instance */
    if (s_instance != NULL)
        return;

#ifdef __APPLE__
    /* Create a separate window for OSX */
    s_instance = new InputManager(parent, Qt::Window);
    window = s_instance;
#else
    /* Create an MDI window for X11 & Win32 */
    QMdiArea* area = qobject_cast<QMdiArea*> (_app->centralWidget());
    Q_ASSERT(area != NULL);
    s_instance = new InputManager(parent);
    window = area->addSubWindow(s_instance);
#endif

    /* Set some common properties for the window and show it */
    window->setAttribute(Qt::WA_DeleteOnClose);
    window->setWindowIcon(QIcon(":/input.png"));
    window->setWindowTitle(tr("Input Manager"));
    window->setContextMenuPolicy(Qt::CustomContextMenu);
    window->show();

    QSettings settings;
    QVariant var = settings.value(SETTINGS_GEOMETRY);
    if (var.isValid() == true)
    {
        window->restoreGeometry(var.toByteArray());
        AppUtil::ensureWidgetIsVisible(window);
    }
    else
    {
        QVariant w = settings.value("inputmanager/width");
        QVariant h = settings.value("inputmanager/height");
        if (w.isValid() == true && h.isValid() == true)
            window->resize(w.toInt(), h.toInt());
        else
            window->resize(700, 300);
    }
}
开发者ID:Andersbakken,项目名称:qlc-svn,代码行数:44,代码来源:inputmanager.cpp

示例13: mainAdapterWidget

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();
}
开发者ID:Mizux,项目名称:viewer,代码行数:42,代码来源:adapter_widget.cpp

示例14: DnsLookupWidget

void DnsLookupPlugin::slotMainActionForMenuTriggered() {

    QWidget *parentWidget = qobject_cast<QWidget *> (parent());
    DnsLookupWidget *wgt = new DnsLookupWidget(parentWidget);
    //connect(wgt, SIGNAL(destroyed(QObject *)), this, SLOT(slotWidgetDestoryed(QObject *)));

    QMdiArea *mdiArea = 0;
    if(parentWidget) {
        mdiArea = qobject_cast<QMdiArea *>(parentWidget);
    }
    if(mdiArea) {
        QMdiSubWindow *subWindow = new QMdiSubWindow;
        subWindow->setWidget(wgt);
        subWindow->setAttribute(Qt::WA_DeleteOnClose);
        mdiArea->addSubWindow(subWindow);
        //connect(this, SIGNAL(signalPluginToBeUnloaded()), subWindow, SLOT(close()));

        connect(subWindow, SIGNAL(destroyed(QObject *)), this, SLOT(slotWidgetDestoryed(QObject *)));
        widgetList.append(subWindow);
    } else {
开发者ID:berryha,项目名称:qtapplications,代码行数:20,代码来源:dnslookupplugin.cpp

示例15: addingSubWindowsExample

void addingSubWindowsExample()
{
    QWidget *internalWidget1 = new QWidget;
    QWidget *internalWidget2 = new QWidget;
    
//! [1]
    QMdiArea mdiArea;
    QMdiSubWindow *subWindow1 = new QMdiSubWindow;
    subWindow1->setWidget(internalWidget1);
    subWindow1->setAttribute(Qt::WA_DeleteOnClose);
    mdiArea.addSubWindow(subWindow1);

    QMdiSubWindow *subWindow2 =
	mdiArea.addSubWindow(internalWidget2);

//! [1]
    subWindow1->show();
    subWindow2->show();

    mdiArea.show();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:21,代码来源:mdiareasnippets.cpp


注:本文中的QMdiArea类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。