fix #297 : Filename that contains '&' doesn't correctly displayed in the editor tab.

This commit is contained in:
Roy Qu 2024-03-21 20:00:34 +08:00
parent 5b328f1e1a
commit 1ae60fa7ed
2 changed files with 7 additions and 5 deletions

View File

@ -71,6 +71,7 @@ Red Panda C++ Version 2.27
- fix: Can't correctly retrieve function parameters type. - fix: Can't correctly retrieve function parameters type.
- fix: Auto type induction for expression contains '[]' are not correct. - fix: Auto type induction for expression contains '[]' are not correct.
- fix: Option 'Pause after run in console' for tools doesn't work. - fix: Option 'Pause after run in console' for tools doesn't work.
- fix: Filename that contains '&' doesn't correctly displayed in the editor tab.
Red Panda C++ Version 2.26 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -5467,17 +5467,18 @@ void Editor::updateCaption(const QString& newCaption) {
int index = mParentPageControl->indexOf(this); int index = mParentPageControl->indexOf(this);
if (index==-1) if (index==-1)
return; return;
QString caption;
if (newCaption.isEmpty()) { if (newCaption.isEmpty()) {
QString caption = QFileInfo(mFilename).fileName(); caption = QFileInfo(mFilename).fileName();
if (this->modified()) { if (this->modified()) {
caption.append("[*]"); caption.append("[*]");
} }
if (this->readOnly()) { if (this->readOnly()) {
caption.append("["+tr("Readonly")+"]"); caption.append("["+tr("Readonly")+"]");
} }
mParentPageControl->setTabText(index,caption);
} else { } else {
mParentPageControl->setTabText(index,newCaption); caption = newCaption;
} }
caption = caption.replace("&","&&");
mParentPageControl->setTabText(index,caption);
} }