本文整理汇总了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;
}
示例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");
}
示例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();
}
示例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();
}
示例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);
}
示例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
}
示例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();
}
}
示例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();
}
示例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()));
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例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 {
示例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();
}