void MainWindow::addStatus(QWidget *w, bool) { QStatusBar *status = statusBar(); w->setParent(status); w->move(QPoint()); statusWidgets.push_back(w); status->addWidget(w, true); w->show(); status->setSizeGripEnabled(true); status->show(); }
MainWindow::MainWindow( IfcPlusPlusSystem* sys, ViewerWidget* vw, QWidget *parent) : m_system(sys), m_viewer_widget(vw), QMainWindow(parent) { m_system = sys; setWindowTitle("IFC++ example application"); setWindowIcon( QIcon( ":img/IfcPlusPlusViewerWindowIcon.png" ) ); // global style sheet definitions QFile file( ":styles.css" ); file.open( QFile::ReadOnly ); QString styleSheet = QLatin1String( file.readAll() ); setStyleSheet( styleSheet ); createTabWidget(); QAction* zoom_bounds_btn = new QAction(QIcon(":img/zoomBoundings.png"), "&Zoom to boundings", this ); zoom_bounds_btn->setShortcut(tr("Ctrl+Z")); zoom_bounds_btn->setStatusTip("Zoom to boundings"); connect(zoom_bounds_btn, SIGNAL(triggered()), this, SLOT(slotBtnZoomBoundingsClicked())); QAction* remove_selected_objects = new QAction(QIcon(":img/RemoveSelectedObjects.png"), "&Remove selected objects [del]", this ); remove_selected_objects->setStatusTip("Remove selected objects [del]"); connect(remove_selected_objects, SIGNAL(triggered()), this, SLOT(slotBtnRemoveSelectedObjectsClicked())); m_file_toolbar = new QToolBar(); m_file_toolbar->setObjectName("FileToolbar"); m_file_toolbar->addAction(zoom_bounds_btn); m_file_toolbar->addAction(remove_selected_objects); addToolBar( Qt::LeftToolBarArea, m_file_toolbar ); // building structure widget QDockWidget *dock = new QDockWidget(tr("Project structure"), this); dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::RightDockWidgetArea, dock); IfcTreeWidget* ifc_tree_widget = new IfcTreeWidget( m_system ); dock->setWidget( ifc_tree_widget ); m_splitter = new QSplitter( Qt::Vertical ); m_splitter->setContentsMargins( 0, 0, 0, 0 ); m_splitter->addWidget( m_viewer_widget ); m_splitter->addWidget( m_tabwidget ); m_splitter->setStretchFactor( 0, 2 ); m_splitter->setStretchFactor( 1, 0 ); QList<int> splitter_sizes; splitter_sizes << 400 << 100; m_splitter->setSizes( splitter_sizes ); // status bar QStatusBar* status = new QStatusBar(); m_label_status_cursor = new QLabel( "0.000, 0.000, 0.000" ); status->addWidget( m_label_status_cursor, 0 ); status->setSizeGripEnabled( true ); setStatusBar( status ); // central widget setCentralWidget( m_splitter ); // restore geometry QSettings settings(QSettings::UserScope, QLatin1String("IfcPlusPlus")); QStringList keys = settings.allKeys(); if( keys.contains( "MainWindowGeometry" ) ) { restoreGeometry(settings.value("MainWindowGeometry").toByteArray()); } else { showMaximized(); } if( keys.contains( "mainWindowState" ) ) { restoreState(settings.value("mainWindowState").toByteArray()); } }