Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
Konversation
Commits
b5c741d2
Commit
b5c741d2
authored
Dec 30, 2021
by
Friedrich W. H. Kossebau
Browse files
Fix unused empty space on tabbar if separate tab close button is disabled
BUG: 382056
FIXED-IN: 1.8.21121
parent
4e5f1ed4
Pipeline
#116235
passed with stage
in 1 minute and 35 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/viewer/viewcontainer.cpp
View file @
b5c741d2
...
...
@@ -222,11 +222,11 @@ void ViewContainer::setupTabWidget()
m_vbox
->
hide
();
auto
*
c
loseB
t
n
=
new
QToolButton
(
m_tabWidget
);
c
loseB
t
n
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"tab-close"
)));
c
loseB
t
n
->
adjustSize
();
m_tabWidget
->
setCornerWidget
(
c
loseB
t
n
,
Qt
::
BottomRightCorner
);
connect
(
c
loseB
t
n
,
&
QAbstractButton
::
clicked
,
this
,
&
ViewContainer
::
closeCurrentView
);
m_tabC
loseB
utto
n
=
new
QToolButton
(
m_tabWidget
);
m_tabC
loseB
utto
n
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"tab-close"
)));
m_tabC
loseB
utto
n
->
adjustSize
();
m_tabWidget
->
setCornerWidget
(
m_tabC
loseB
utto
n
,
Qt
::
BottomRightCorner
);
connect
(
m_tabC
loseB
utto
n
,
&
QAbstractButton
::
clicked
,
this
,
&
ViewContainer
::
closeCurrentView
);
connect
(
m_tabWidget
,
&
QTabWidget
::
currentChanged
,
this
,
&
ViewContainer
::
viewSwitched
);
connect
(
m_tabWidget
->
tabBar
(),
&
QTabBar
::
tabCloseRequested
,
this
,
QOverload
<
int
>::
of
(
&
ViewContainer
::
closeView
));
...
...
@@ -695,10 +695,24 @@ void ViewContainer::updateTabWidgetAppearance()
m_tabWidget
->
setTabPosition
((
Preferences
::
self
()
->
tabPlacement
()
==
Preferences
::
Top
)
?
QTabWidget
::
North
:
QTabWidget
::
South
);
if
(
Preferences
::
self
()
->
showTabBarCloseButton
()
&&
!
noTabBar
)
m_tabWidget
->
cornerWidget
()
->
show
();
else
m_tabWidget
->
cornerWidget
()
->
hide
();
// the corner widget has to be unset if not wanted,
// just hiding it will have the tabbar still reserving the space
const
bool
showTabBarCloseButton
=
Preferences
::
self
()
->
showTabBarCloseButton
()
&&
!
noTabBar
;
const
bool
isTabBarCloseButtonVisible
=
(
m_tabWidget
->
cornerWidget
()
!=
nullptr
);
if
(
showTabBarCloseButton
!=
isTabBarCloseButtonVisible
)
{
if
(
showTabBarCloseButton
)
{
m_tabWidget
->
setCornerWidget
(
m_tabCloseButton
,
Qt
::
BottomRightCorner
);
m_tabCloseButton
->
show
();
}
else
{
m_tabWidget
->
setCornerWidget
(
nullptr
,
Qt
::
BottomRightCorner
);
m_tabCloseButton
->
hide
();
}
}
m_tabWidget
->
tabBar
()
->
setTabsClosable
(
Preferences
::
self
()
->
closeButtons
());
}
...
...
src/viewer/viewcontainer.h
View file @
b5c741d2
...
...
@@ -16,6 +16,7 @@
#include <QTabWidget>
class
QSplitter
;
class
QToolButton
;
class
KActionCollection
;
...
...
@@ -279,6 +280,7 @@ class ViewContainer : public QAbstractItemModel
QSplitter
*
m_viewTreeSplitter
;
TabWidget
*
m_tabWidget
;
QToolButton
*
m_tabCloseButton
;
ViewTree
*
m_viewTree
;
QWidget
*
m_vbox
;
QueueTuner
*
m_queueTuner
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment