Exemplo n.º 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());
}
Exemplo n.º 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();
	}
}