Skip to content

Commit

Permalink
Start: remove close button of start tab, and remove name.
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddleStroke committed Jan 5, 2025
1 parent 607be12 commit d776d67
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/Gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ bool MainWindow::eventFilter(QObject* o, QEvent* e)
return QMainWindow::eventFilter(o, e);
}

void MainWindow::addWindow(MDIView* view)
void MainWindow::addWindow(MDIView* view, bool closeButton)
{
// make workspace parent of view
bool isempty = d->mdiArea->subWindowList().isEmpty();
Expand All @@ -1400,6 +1400,14 @@ void MainWindow::addWindow(MDIView* view)
QAction* action = menu->addAction(tr("Close All"));
connect(action, &QAction::triggered, d->mdiArea, &QMdiArea::closeAllSubWindows);
d->mdiArea->addSubWindow(child);

if (!closeButton) {
QTabBar* tabBar = d->mdiArea->findChild<QTabBar*>();
if (tabBar) {
int index = tabBar->count() - 1;
tabBar->setTabButton(index, QTabBar::RightSide, nullptr);
}
}
}

connect(view, &MDIView::message, this, &MainWindow::showMessage);
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class GuiExport MainWindow : public QMainWindow
* Adds an MDI window \a view to the main window's workspace and adds a new tab
* to the tab bar.
*/
void addWindow(MDIView* view);
void addWindow(MDIView* view, bool closeButton = true);
/**
* Removes an MDI window from the main window's workspace and its associated tab without
* deleting the widget. If the main windows does not have such a window nothing happens.
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Start/Gui/Manipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void CmdStart::activated(int iMsg)
auto existingView = mw->findChild<StartGui::StartView*>(QLatin1String("StartView"));
if (!existingView) {
existingView = gsl::owner<StartGui::StartView*>(new StartGui::StartView(mw));
mw->addWindow(existingView); // Transfers ownership
mw->addWindow(existingView, false); // Transfers ownership
}
Gui::getMainWindow()->setActiveWindow(existingView);
existingView->show();
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Start/Gui/StartView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ void StartView::changeEvent(QEvent* event)

void StartView::retranslateUi()
{
QString title = QCoreApplication::translate("Workbench", "Start");
QString title = QString::fromLatin1(" ");
setWindowTitle(title);

const QLatin1String h1Start("<h1>");
Expand Down

0 comments on commit d776d67

Please sign in to comment.