Commit 40c37372 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

S&R: use TabBar::setAutoHide(true) instead of manual show/hide

parent 831a0069
...@@ -363,6 +363,8 @@ KatePluginSearchView::KatePluginSearchView(KTextEditor::Plugin *plugin, KTextEdi ...@@ -363,6 +363,8 @@ KatePluginSearchView::KatePluginSearchView(KTextEditor::Plugin *plugin, KTextEdi
actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::SHIFT | Qt::Key_F6)); actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::SHIFT | Qt::Key_F6));
connect(a, &QAction::triggered, this, &KatePluginSearchView::goToPreviousMatch); connect(a, &QAction::triggered, this, &KatePluginSearchView::goToPreviousMatch);
// Only show the tab bar when there is more than one tab
m_ui.resultTabWidget->tabBar()->setAutoHide(true);
m_ui.resultTabWidget->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectLeftTab); m_ui.resultTabWidget->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectLeftTab);
KAcceleratorManager::setNoAccel(m_ui.resultTabWidget); KAcceleratorManager::setNoAccel(m_ui.resultTabWidget);
...@@ -389,9 +391,7 @@ KatePluginSearchView::KatePluginSearchView(KTextEditor::Plugin *plugin, KTextEdi ...@@ -389,9 +391,7 @@ KatePluginSearchView::KatePluginSearchView(KTextEditor::Plugin *plugin, KTextEdi
m_ui.filterCombo->setToolTip(i18n("Comma separated list of file types to search in. Example: \"*.cpp,*.h\"\n")); m_ui.filterCombo->setToolTip(i18n("Comma separated list of file types to search in. Example: \"*.cpp,*.h\"\n"));
m_ui.excludeCombo->setToolTip(i18n("Comma separated list of files and directories to exclude from the search. Example: \"build*\"")); m_ui.excludeCombo->setToolTip(i18n("Comma separated list of files and directories to exclude from the search. Example: \"build*\""));
// the order here is important to get the tabBar hidden for only one tab
addTab(); addTab();
m_ui.resultTabWidget->tabBar()->hide();
// get url-requester's combo box and sanely initialize // get url-requester's combo box and sanely initialize
KComboBox *cmbUrl = m_ui.folderRequester->comboBox(); KComboBox *cmbUrl = m_ui.folderRequester->comboBox();
...@@ -1960,7 +1960,6 @@ void KatePluginSearchView::addTab() ...@@ -1960,7 +1960,6 @@ void KatePluginSearchView::addTab()
m_ui.resultTabWidget->addTab(res, QString()); m_ui.resultTabWidget->addTab(res, QString());
m_ui.resultTabWidget->setCurrentIndex(m_ui.resultTabWidget->count() - 1); m_ui.resultTabWidget->setCurrentIndex(m_ui.resultTabWidget->count() - 1);
m_ui.stackedWidget->setCurrentIndex(0); m_ui.stackedWidget->setCurrentIndex(0);
m_ui.resultTabWidget->tabBar()->show();
m_ui.displayOptions->setChecked(false); m_ui.displayOptions->setChecked(false);
res->treeView->installEventFilter(this); res->treeView->installEventFilter(this);
...@@ -1978,9 +1977,7 @@ void KatePluginSearchView::tabCloseRequested(int index) ...@@ -1978,9 +1977,7 @@ void KatePluginSearchView::tabCloseRequested(int index)
delete tmp; // remove the tab delete tmp; // remove the tab
m_curResults = nullptr; m_curResults = nullptr;
} }
if (m_ui.resultTabWidget->count() == 1) {
m_ui.resultTabWidget->tabBar()->hide();
}
updateMatchMarks(); updateMatchMarks();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment