[rkward] rkward/windows: Close any active view in toolbar, before adding a new tool view.
Thomas Friedrichsmeier
null at kde.org
Wed Jan 29 16:10:01 GMT 2020
Git commit f3a9c4152c203689b0e963945e586ebe82a1f709 by Thomas Friedrichsmeier.
Committed on 29/01/2020 at 16:09.
Pushed by tfry into branch 'master'.
Close any active view in toolbar, before adding a new tool view.
M +12 -5 rkward/windows/rktoolwindowbar.cpp
M +1 -0 rkward/windows/rktoolwindowbar.h
https://commits.kde.org/rkward/f3a9c4152c203689b0e963945e586ebe82a1f709
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index 11e67d13..f59cc021 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -144,6 +144,7 @@ void RKToolWindowBar::addWidget (RKMDIWindow *window) {
if (window->tool_window_bar) {
window->tool_window_bar->removeWidget (window);
}
+ closeOthers (window);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5,13,0)
appendTab (window->windowIcon (), id, window->shortCaption ());
@@ -196,13 +197,9 @@ void RKToolWindowBar::removeWidget (RKMDIWindow *widget) {
if (widget_to_id.isEmpty ()) hide ();
}
-void RKToolWindowBar::showWidget (RKMDIWindow *widget) {
+void RKToolWindowBar::closeOthers (RKMDIWindow* widget) {
RK_TRACE (APP);
- RK_ASSERT (widget_to_id.contains (widget));
-
- int id = widget_to_id[widget];
- // close any others
for (QMap<RKMDIWindow*, int>::const_iterator it = widget_to_id.constBegin (); it != widget_to_id.constEnd (); ++it) {
RKMDIWindow *cur = it.key ();
if (cur != widget) {
@@ -213,6 +210,16 @@ void RKToolWindowBar::showWidget (RKMDIWindow *widget) {
setTab (it.value (), false);
}
}
+}
+
+void RKToolWindowBar::showWidget (RKMDIWindow *widget) {
+ RK_TRACE (APP);
+ RK_ASSERT (widget_to_id.contains (widget));
+
+ int id = widget_to_id[widget];
+
+ // close any others
+ closeOthers (widget);
widget->show ();
if (widget->isAttached ()) {
diff --git a/rkward/windows/rktoolwindowbar.h b/rkward/windows/rktoolwindowbar.h
index 5c0b8c2b..213a59c4 100644
--- a/rkward/windows/rktoolwindowbar.h
+++ b/rkward/windows/rktoolwindowbar.h
@@ -65,6 +65,7 @@ protected:
private:
friend class RKWorkplace;
void reclaimDetached (RKMDIWindow *window);
+ void closeOthers (RKMDIWindow *window);
int getSplitterSize () const;
void setSplitterSize (int new_size);
More information about the rkward-tracker
mailing list