Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
71238562
Commit
71238562
authored
Aug 16, 2022
by
loh tar
Browse files
Improve code readability
Rename Sidebar::expandSidebar() => updateSidebar() to fit better what there is done
parent
5b1a7b16
Changes
2
Hide whitespace changes
Inline
Side-by-side
apps/lib/katemdi.cpp
View file @
71238562
...
...
@@ -385,7 +385,7 @@ void MultiTabBar::tabClicked(int id)
hideToolView
(
id
);
}
m_sb
->
expand
Sidebar
();
m_sb
->
update
Sidebar
();
}
void
MultiTabBar
::
removeBlankTab
(
int
id
)
...
...
@@ -691,7 +691,7 @@ bool Sidebar::removeToolView(ToolView *widget)
m_idToWidget
.
erase
(
id
);
m_widgetToId
.
erase
(
widget
);
expand
Sidebar
();
update
Sidebar
();
return
true
;
}
...
...
@@ -703,7 +703,7 @@ bool Sidebar::showToolView(ToolView *widget)
}
tabBar
(
widget
)
->
showToolView
(
m_widgetToId
.
at
(
widget
));
expand
Sidebar
();
update
Sidebar
();
return
true
;
}
...
...
@@ -716,7 +716,7 @@ bool Sidebar::hideToolView(ToolView *widget)
updateLastSize
();
tabBar
(
widget
)
->
hideToolView
(
m_widgetToId
.
at
(
widget
));
expand
Sidebar
();
update
Sidebar
();
return
true
;
}
...
...
@@ -764,7 +764,7 @@ void Sidebar::handleCollapse(int pos, int index)
}
collapseSidebar
();
}
else
if
(
!
isCollapsed
()
&&
m_isPreviouslyCollapsed
)
{
expand
Sidebar
();
update
Sidebar
();
}
}
...
...
@@ -791,7 +791,7 @@ bool Sidebar::tabBarIsEmpty(MultiTabBar *bar)
QTimer
::
singleShot
(
0
,
this
,
[
this
]()
{
// We need to delay the update or m_ownSplit report wrong size count
expand
Sidebar
();
update
Sidebar
();
});
return
true
;
...
...
@@ -862,7 +862,7 @@ bool Sidebar::adjustSplitterSections()
return
true
;
}
void
Sidebar
::
expand
Sidebar
()
void
Sidebar
::
update
Sidebar
()
{
if
(
!
adjustSplitterSections
())
{
// Nothing is shown, don't expand to a blank area
...
...
@@ -976,7 +976,7 @@ bool Sidebar::eventFilter(QObject *obj, QEvent *ev)
if
(
e
->
button
()
==
Qt
::
LeftButton
)
{
if
(
obj
->
property
(
"is-multi-tabbar"
).
toBool
())
{
if
(
isCollapsed
())
{
expand
Sidebar
();
update
Sidebar
();
}
else
{
collapseSidebar
();
}
...
...
@@ -1110,7 +1110,7 @@ void Sidebar::restoreSession(KConfigGroup &config)
m_lastSize
=
config
.
readEntry
(
QStringLiteral
(
"Kate-MDI-Sidebar-%1-LastSize"
).
arg
(
position
()),
160
);
setSizes
(
config
.
readEntry
(
QStringLiteral
(
"Kate-MDI-Sidebar-%1-Splitter"
).
arg
(
position
()),
QList
<
int
>
()));
// ...now we are ready to get the final splitter sizes by MainWindow::finishRestore
expand
Sidebar
();
update
Sidebar
();
}
void
Sidebar
::
saveSession
(
KConfigGroup
&
config
)
...
...
@@ -1433,7 +1433,7 @@ void MainWindow::finishRestore()
// Expand again to trigger splitter sync tabs/tools, but for any reason works this sometimes only after enough delay
QTimer
::
singleShot
(
400
,
this
,
[
this
]()
{
for
(
auto
&
sidebar
:
m_sidebars
)
{
sidebar
->
expand
Sidebar
();
sidebar
->
update
Sidebar
();
}
});
}
...
...
apps/lib/katemdi.h
View file @
71238562
...
...
@@ -261,7 +261,12 @@ public:
void
showToolviewTab
(
ToolView
*
widget
,
bool
show
);
bool
isCollapsed
();
void
expandSidebar
();
/**
* Will the sidebar expand when some tool has to be visible in any section,
* or calling collapseSidebar() if non such tool is found
*/
void
updateSidebar
();
void
collapseSidebar
();
KMultiTabBar
::
KMultiTabBarPosition
position
()
const
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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