fix problem with disappearing tab
This commit is contained in:
parent
2f206a114c
commit
7153022de3
@ -444,9 +444,10 @@ void SettingsGui::saveSettings() {
|
|||||||
m_ui->m_editorMessagesToolbar->saveToolBar();
|
m_ui->m_editorMessagesToolbar->saveToolBar();
|
||||||
m_ui->m_editorStatusbar->saveToolBar();
|
m_ui->m_editorStatusbar->saveToolBar();
|
||||||
|
|
||||||
qApp->mainForm()->tabWidget()->feedMessageViewer()->normalizeToolbarHeights();
|
qApp->mainForm()->tabWidget()->updateAppearance();
|
||||||
|
qApp->mainForm()->tabWidget()->checkCornerButtonVisibility();
|
||||||
|
|
||||||
qApp->mainForm()->tabWidget()->checkTabBarVisibility();
|
qApp->mainForm()->tabWidget()->feedMessageViewer()->normalizeToolbarHeights();
|
||||||
qApp->mainForm()->tabWidget()->feedMessageViewer()->refreshVisualProperties();
|
qApp->mainForm()->tabWidget()->feedMessageViewer()->refreshVisualProperties();
|
||||||
|
|
||||||
qApp->feedReader()->feedsModel()->reloadWholeLayout();
|
qApp->feedReader()->feedsModel()->reloadWholeLayout();
|
||||||
|
@ -29,6 +29,7 @@ TabWidget::TabWidget(QWidget* parent) : QTabWidget(parent), m_menuMain(nullptr)
|
|||||||
setupMainMenuButton();
|
setupMainMenuButton();
|
||||||
initializeTabs();
|
initializeTabs();
|
||||||
createConnections();
|
createConnections();
|
||||||
|
updateAppearance();
|
||||||
}
|
}
|
||||||
|
|
||||||
TabWidget::~TabWidget() {
|
TabWidget::~TabWidget() {
|
||||||
@ -43,6 +44,8 @@ void TabWidget::setupMainMenuButton() {
|
|||||||
m_btnMainMenu->setIcon(qApp->icons()->fromTheme(QSL("go-home")));
|
m_btnMainMenu->setIcon(qApp->icons()->fromTheme(QSL("go-home")));
|
||||||
m_btnMainMenu->setPopupMode(QToolButton::ToolButtonPopupMode::InstantPopup);
|
m_btnMainMenu->setPopupMode(QToolButton::ToolButtonPopupMode::InstantPopup);
|
||||||
|
|
||||||
|
setCornerWidget(m_btnMainMenu, Qt::Corner::TopLeftCorner);
|
||||||
|
|
||||||
connect(m_btnMainMenu, &PlainToolButton::clicked, this, &TabWidget::openMainMenu);
|
connect(m_btnMainMenu, &PlainToolButton::clicked, this, &TabWidget::openMainMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,10 +87,10 @@ void TabWidget::showDownloadManager() {
|
|||||||
setCurrentIndex(count() - 1);
|
setCurrentIndex(count() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::checkTabBarVisibility() {
|
void TabWidget::checkCornerButtonVisibility() {
|
||||||
const bool should_be_visible =
|
const bool should_be_visible = count() > 1 || !tabBarAutoHide();
|
||||||
count() > 1 || !qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideTabBarIfOnlyOneTab)).toBool();
|
|
||||||
|
|
||||||
|
/*
|
||||||
if (should_be_visible) {
|
if (should_be_visible) {
|
||||||
setCornerWidget(m_btnMainMenu, Qt::Corner::TopLeftCorner);
|
setCornerWidget(m_btnMainMenu, Qt::Corner::TopLeftCorner);
|
||||||
}
|
}
|
||||||
@ -95,14 +98,19 @@ void TabWidget::checkTabBarVisibility() {
|
|||||||
setCornerWidget(nullptr, Qt::Corner::TopLeftCorner);
|
setCornerWidget(nullptr, Qt::Corner::TopLeftCorner);
|
||||||
setCornerWidget(nullptr, Qt::Corner::TopRightCorner);
|
setCornerWidget(nullptr, Qt::Corner::TopRightCorner);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
m_btnMainMenu->setVisible(should_be_visible);
|
m_btnMainMenu->setVisible(should_be_visible);
|
||||||
tabBar()->setVisible(should_be_visible);
|
// tabBar()->setVisible(should_be_visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabWidget::updateAppearance() {
|
||||||
|
setTabBarAutoHide(qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideTabBarIfOnlyOneTab)).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::tabInserted(int index) {
|
void TabWidget::tabInserted(int index) {
|
||||||
QTabWidget::tabInserted(index);
|
QTabWidget::tabInserted(index);
|
||||||
checkTabBarVisibility();
|
checkCornerButtonVisibility();
|
||||||
const int count_of_tabs = count();
|
const int count_of_tabs = count();
|
||||||
|
|
||||||
if (index < count_of_tabs - 1 && count_of_tabs > 1) {
|
if (index < count_of_tabs - 1 && count_of_tabs > 1) {
|
||||||
@ -113,7 +121,7 @@ void TabWidget::tabInserted(int index) {
|
|||||||
|
|
||||||
void TabWidget::tabRemoved(int index) {
|
void TabWidget::tabRemoved(int index) {
|
||||||
QTabWidget::tabRemoved(index);
|
QTabWidget::tabRemoved(index);
|
||||||
checkTabBarVisibility();
|
checkCornerButtonVisibility();
|
||||||
const int count_of_tabs = count();
|
const int count_of_tabs = count();
|
||||||
|
|
||||||
if (index < count_of_tabs && count_of_tabs > 1) {
|
if (index < count_of_tabs && count_of_tabs > 1) {
|
||||||
|
@ -61,7 +61,8 @@ class TabWidget : public QTabWidget {
|
|||||||
void scrollDownCurrentBrowser();
|
void scrollDownCurrentBrowser();
|
||||||
|
|
||||||
// Called when number of tab pages changes.
|
// Called when number of tab pages changes.
|
||||||
void checkTabBarVisibility();
|
void checkCornerButtonVisibility();
|
||||||
|
void updateAppearance();
|
||||||
|
|
||||||
// Tab closing.
|
// Tab closing.
|
||||||
bool closeTab(int index);
|
bool closeTab(int index);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user