#include "XGUI_MainWindow.h"
+#include "XGUI_Constants.h"
#include "XGUI_MainMenu.h"
#include "XGUI_ViewWindow.h"
#include "XGUI_Viewer.h"
XGUI_MainWindow::XGUI_MainWindow(QWidget* parent)
: QMainWindow(parent),
- myObjectBrowser(NULL),
- myPythonConsole(NULL),
- myPropertyPanelDock(NULL)
+ myPythonConsole(0)
{
setWindowTitle(tr("New Geom"));
myMenuBar = new XGUI_MainMenu(this);
setCentralWidget(aMdiArea);
myViewer = new XGUI_Viewer(this);
-
- createDockWidgets();
}
XGUI_MainWindow::~XGUI_MainWindow(void)
return static_cast<QMdiArea*>(centralWidget());
}
-//******************************************************
-void XGUI_MainWindow::showObjectBrowser()
-{
- myObjectBrowser->parentWidget()->show();
-}
-
-//******************************************************
-void XGUI_MainWindow::hideObjectBrowser()
-{
- myObjectBrowser->parentWidget()->hide();
-}
-
//******************************************************
void XGUI_MainWindow::showPythonConsole()
{
aDoc->setMinimumHeight(0);
aDoc->setWindowTitle("Console");
myPythonConsole = new PyConsole_EnhConsole( aDoc, new PyConsole_EnhInterp());
- //myPythonConsole = new QTextEdit(aDoc);
- //myPythonConsole->setGeometry(0,0,200, 50);
- //myPythonConsole->setText(">>>");
aDoc->setWidget(myPythonConsole);
- //myPythonConsole->setMinimumHeight(0);
addDockWidget(Qt::TopDockWidgetArea, aDoc);
tabifyDockWidget(myMenuBar->getLastDockWindow(), aDoc);
}
myPythonConsole->parentWidget()->hide();
}
-void XGUI_MainWindow::showPropertyPanel()
-{
- QAction* aViewAct = myPropertyPanelDock->toggleViewAction();
- aViewAct->setEnabled(true);
- myPropertyPanelDock->show();
- myPropertyPanelDock->raise();
-}
-void XGUI_MainWindow::hidePropertyPanel()
-{
- QAction* aViewAct = myPropertyPanelDock->toggleViewAction();
- aViewAct->setEnabled(false);
- myPropertyPanelDock->hide();
-}
-
-/*
- * Creates dock widgets, places them in corresponding area
- * and tabifies if necessary.
- */
-void XGUI_MainWindow::createDockWidgets()
-{
- QDockWidget* aObjDock = createObjectBrowser();
- addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
- myPropertyPanelDock = createPropertyPanel();
- addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanelDock);
- hidePropertyPanel(); //<! Invisible by default
-
- tabifyDockWidget(aObjDock, myPropertyPanelDock);
-}
-
-
-QDockWidget* XGUI_MainWindow::createPropertyPanel()
-{
- QDockWidget* aPropPanel = new QDockWidget(this);
- aPropPanel->setWindowTitle(tr("Property Panel"));
-
- QWidget* aContent = new QWidget(aPropPanel);
- QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
- aMainLay->setContentsMargins(3, 3, 3, 3);
- aPropPanel->setWidget(aContent);
-
- QWidget* aCustomWidget = new QWidget(aContent);
- aCustomWidget->setObjectName("property_panel_widget");
- aMainLay->addWidget(aCustomWidget);
- aMainLay->addStretch(1);
-
- QFrame* aFrm = new QFrame(aContent);
- aFrm->setFrameStyle(QFrame::Sunken);
- aFrm->setFrameShape(QFrame::Panel);
- QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
- aBtnLay->setContentsMargins(0, 0, 0, 0);
- aMainLay->addWidget(aFrm);
-
- QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
- aBtn->setFlat(true);
- aBtnLay->addWidget(aBtn);
- aBtnLay->addStretch(1);
- aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
- aBtn->setObjectName("property_panel_ok");
- aBtn->setFlat(true);
- aBtnLay->addWidget(aBtn);
- aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
- aBtn->setObjectName("property_panel_cancel");
- aBtn->setFlat(true);
- aBtnLay->addWidget(aBtn);
-
- return aPropPanel;
-}
-
-QDockWidget* XGUI_MainWindow::createObjectBrowser()
-{
- QDockWidget* aObjDock = new QDockWidget(this);
- aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
- aObjDock->setWindowTitle(tr("Object browser"));
- myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
- //myObjectBrowser->setColumnCount(1);
- //myObjectBrowser->setHeaderHidden(true);
- aObjDock->setWidget(myObjectBrowser);
-// fillObjectBrowser();
- return aObjDock;
-}