mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Fixed showing close buttons on pinned tabs.
- regression from 1e5b7d92cd
This commit is contained in:
parent
1d919e0172
commit
cff5fce5da
@ -158,7 +158,7 @@ void TabBar::contextMenuRequested(const QPoint &position)
|
|||||||
action->setEnabled(m_tabWidget->canRestoreTab());
|
action->setEnabled(m_tabWidget->canRestoreTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Prevent choosing first option with double rightclick
|
// Prevent choosing first option with double rightclick
|
||||||
const QPoint &pos = mapToGlobal(position);
|
const QPoint &pos = mapToGlobal(position);
|
||||||
QPoint p(pos.x(), pos.y() + 1);
|
QPoint p(pos.x(), pos.y() + 1);
|
||||||
menu.exec(p);
|
menu.exec(p);
|
||||||
@ -168,6 +168,12 @@ void TabBar::contextMenuRequested(const QPoint &position)
|
|||||||
|
|
||||||
QSize TabBar::tabSizeHint(int index) const
|
QSize TabBar::tabSizeHint(int index) const
|
||||||
{
|
{
|
||||||
|
if (!isVisible()) {
|
||||||
|
// Don't calculate it when tabbar is not visible
|
||||||
|
// It produces invalid size anyway
|
||||||
|
return QSize(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
static int PINNED_TAB_WIDTH = -1;
|
static int PINNED_TAB_WIDTH = -1;
|
||||||
|
|
||||||
if (PINNED_TAB_WIDTH == -1) {
|
if (PINNED_TAB_WIDTH == -1) {
|
||||||
@ -234,8 +240,14 @@ QSize TabBar::tabSizeHint(int index) const
|
|||||||
size.setWidth(m_lastTabWidth);
|
size.setWidth(m_lastTabWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore close buttons according to preferences
|
||||||
if (tabsClosable() != m_showCloseButtons) {
|
if (tabsClosable() != m_showCloseButtons) {
|
||||||
tabBar->setTabsClosable(m_showCloseButtons);
|
tabBar->setTabsClosable(m_showCloseButtons);
|
||||||
|
|
||||||
|
// Hide close buttons on pinned tabs
|
||||||
|
for (int i = 0; i < count(); ++i) {
|
||||||
|
updateCloseButton(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,7 +315,7 @@ void TabBar::hideCloseButton(int index)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void TabBar::updateCloseButton(int index)
|
void TabBar::updateCloseButton(int index) const
|
||||||
{
|
{
|
||||||
QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, QTabBar::RightSide));
|
QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, QTabBar::RightSide));
|
||||||
if (!button) {
|
if (!button) {
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
explicit TabBar(QupZilla* mainClass, TabWidget* tabWidget);
|
explicit TabBar(QupZilla* mainClass, TabWidget* tabWidget);
|
||||||
// void hideCloseButton(int index);
|
// void hideCloseButton(int index);
|
||||||
// void showCloseButton(int index);
|
// void showCloseButton(int index);
|
||||||
void updateCloseButton(int index);
|
void updateCloseButton(int index) const;
|
||||||
|
|
||||||
QSize getTabSizeHint(int index) { return QTabBar::tabSizeHint(index); }
|
QSize getTabSizeHint(int index) { return QTabBar::tabSizeHint(index); }
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
Loading…
Reference in New Issue
Block a user