X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=test%2Fstandalone%2Fgui%2FPLMainWindow.cxx;h=c9ee032b69963dd6480fbb5253ac7c3cfa91a337;hb=1872421989f63893a0461902eb572143d19f388e;hp=e2754985e3480d210d590a4817643e9a8f94d318;hpb=654addd46335c9a7f42e87b662f9085414db8069;p=modules%2Fparavis.git diff --git a/test/standalone/gui/PLMainWindow.cxx b/test/standalone/gui/PLMainWindow.cxx index e2754985..c9ee032b 100644 --- a/test/standalone/gui/PLMainWindow.cxx +++ b/test/standalone/gui/PLMainWindow.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2010-2016 CEA/DEN, EDF R&D +// Copyright (C) 2010-2023 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -50,7 +50,8 @@ PLMainWindow::PLMainWindow(QWidget *parent) : QMainWindow(parent), _pAppC(0), _simplePipeline(), - _autoApply(true) + _autoApply(true), + _filterMenu(0) { _mainWindow.setupUi(this); _autoApply = _mainWindow.actionAuto_apply->isChecked(); @@ -63,25 +64,23 @@ PLMainWindow::PLMainWindow(QWidget *parent) : void PLMainWindow::finishUISetup() { _pAppC = PVViewer_Core::GetPVApplication(); - PVViewer_GUIElements * pvgui = PVViewer_GUIElements::GetInstance(this); - QWidget * wprop = pvgui->getPropertiesPanel(); - QWidget * wpipe = pvgui->getPipelineBrowserWidget(); + _pvgui = PVViewer_GUIElements::GetInstance(this); + + QWidget * wprop = _pvgui->getPropertiesPanel(); + QWidget * wpipe = _pvgui->getPipelineBrowserWidget(); wprop->setParent(_mainWindow.propFrame); _mainWindow.verticalLayoutProp->addWidget(wprop); wpipe->setParent(_mainWindow.pipelineFrame); _mainWindow.verticalLayoutPipe->addWidget(wpipe); - PVViewer_GUIElements * pvge = PVViewer_GUIElements::GetInstance(this); -// pvge->setToolBarVisible(false); - // In this mockup, we play on the parent widget visibility (a QFrame), so show these: - pvge->getPipelineBrowserWidget()->show(); - pvge->getPropertiesPanel()->show(); + _pvgui->getPipelineBrowserWidget()->show(); + _pvgui->getPropertiesPanel()->show(); // and hide these: _mainWindow.propFrame->hide(); _mainWindow.pipelineFrame->hide(); -// pvge->setToolBarEnabled(false); -// pvge->setToolBarVisible(false); +// _pvgui->setToolBarEnabled(false); +// _pvgui->setToolBarVisible(false); } @@ -110,6 +109,19 @@ void PLMainWindow::showPipeline(bool isChecked) isChecked ? _mainWindow.pipelineFrame->show() : _mainWindow.pipelineFrame->hide(); } +void PLMainWindow::onBuildFilterMenu() +{ + if(_filterMenu == 0) + { + _filterMenu = _pvgui->getFiltersMenu(); +// _filterMenu = new QMenu(); + _filterMenu->setTitle("Filters"); + this->menuBar()->addMenu(_filterMenu); + } + else + QMessageBox::warning(this, "Warning", "Filter menu already added!"); +} + void PLMainWindow::addTab() { int c = _mainWindow.tabWidget->count(); @@ -120,6 +132,7 @@ void PLMainWindow::addTab() // Connect buttons QObject::connect(newTab, SIGNAL(onInsertSingleView(PLViewTab *)), this, SLOT(insertSingleView(PLViewTab *))); QObject::connect(newTab, SIGNAL(onInsertMultiView(PLViewTab *)), this, SLOT(insertMultiView(PLViewTab *))); + QObject::connect(newTab, SIGNAL(onInsertSpreadsheetView(PLViewTab *)), this, SLOT(insertSpreadsheetView(PLViewTab *))); } void PLMainWindow::deleteTab() @@ -202,6 +215,26 @@ void PLMainWindow::insertSingleView(PLViewTab * tab) pqActiveObjects::instance().setActiveView(pqview); } +void PLMainWindow::insertSpreadsheetView(PLViewTab * tab) +{ + // Create a new view proxy on the server + pqObjectBuilder* builder = _pAppC->getObjectBuilder(); + pqServer* active_serv = pqActiveObjects::instance().activeServer(); + + std::cout << "About to create spreadsheet view ..." << std::endl; + pqView * pqview = builder->createView(QString("SpreadSheetView"), active_serv); + std::cout << "Created: " << pqview << "!" << std::endl; + + // Retrieve its widget and pass it to the Qt tab: + QWidget* viewWidget = pqview->widget(); + +// QWidget* viewWidget = new QPushButton("toto"); + tab->hideAndReplace(viewWidget, pqview); + + pqActiveObjects::instance().setActiveView(pqview); +} + + void PLMainWindow::insertMultiView(PLViewTab * tab) { // Retrieve TabbedMultiView and see if it is already attached to someone: @@ -221,7 +254,6 @@ void PLMainWindow::insertMultiView(PLViewTab * tab) } } - void PLMainWindow::doShrink() { if(!_simplePipeline.isEmpty())