All pastes #927106 Raw Edit

Anonymous

public cpp v1 · immutable
·published 2008-03-04 01:07 UTC
rendered paste body
#include "editortabwidget.h"#include "editortabwidget.moc"#include <assert.h>#include <QFileDialog>#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<EditorWidget*>(_currentWidget);	assert(editorWidget != 0);		editorWidget->Save();}