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()); }
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(); } }