Example #1
0
void MainWindow::NewFileSlot()
{
	TextEdit* child = CreateTextEdit();
	child->NewFile();
	//child->show();
	tabWidget->addTab(child, child->GetCurrentFileName());
	int index = tabWidget->count();
	//tabWidget->addTab(child, child->GetCurrentFileName());
	tabWidget->setTabToolTip(index, child->GetCurrentFile());
}
Example #2
0
void MainWindow::OpenTextEdit( const QString fileName )
{
	TextEdit *existedTextEdit = FindTextEdit(fileName);
	if (existedTextEdit)
	{
		tabWidget->setCurrentWidget(existedTextEdit);
		return;
	}

	TextEdit* child = CreateTextEdit();
	if ( child->LoadFile(fileName) )
	{
		int index = tabWidget->count();
		tabWidget->addTab(child, child->GetCurrentFileName());
		tabWidget->setTabToolTip(index, child->GetCurrentFile());
		//child->show();
	}
	else
	{
		child->close();
	}
}