#include "editortabwidget.h" #include "editortabwidget.moc" #include #include #include "editorwidget.h" void EditorTabWidget::New() { int index = addTab(new EditorWidget, "Untitled"); setCurrentIndex(index); widget(index)->setFocus(); // Give focus to the editor, not the tab itself } void EditorTabWidget::Open() { QString filename = QFileDialog::getOpenFileName(this, tr("Open Script"), "", tr("Python Script Files (*.py)")); int index = addTab(new EditorWidget(filename), filename); setCurrentIndex(index); widget(index)->setFocus(); // Give focus to the editor, not the tab itself } void EditorTabWidget::Save() { QWidget* _currentWidget = currentWidget(); if(!_currentWidget) // No document open, ignore the event return; EditorWidget* editorWidget = qobject_cast(_currentWidget); assert(editorWidget != 0); editorWidget->Save(); }