From 2d6cbf8a0bb81bfe55a7d4e04d53a704f93c6b2e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 9 Oct 2019 18:02:19 +0200 Subject: Make FileBrowser window always-on-top and try to position it inside the plugin gui window rectangle. --- plugingui/drumkitframecontent.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'plugingui/drumkitframecontent.cc') diff --git a/plugingui/drumkitframecontent.cc b/plugingui/drumkitframecontent.cc index 1da7201..0850ac1 100644 --- a/plugingui/drumkitframecontent.cc +++ b/plugingui/drumkitframecontent.cc @@ -168,6 +168,13 @@ void DrumkitframeContent::kitBrowseClick() CONNECT(&file_browser, fileSelectNotifier, this, &DrumkitframeContent::selectKitFile); file_browser.show(); + Point p{ window()->x() + (int)window()->width() / 2, + window()->y() + (int)window()->height() / 2 }; + auto p0 = window()->translateToScreen(p); + auto sz = file_browser.window()->getNativeSize(); + file_browser.move(p0.x - sz.width / 2, + p0.y - sz.height / 2); + file_browser.setAlwaysOnTop(true); } void DrumkitframeContent::midimapBrowseClick() @@ -189,6 +196,13 @@ void DrumkitframeContent::midimapBrowseClick() CONNECT(&file_browser, fileSelectNotifier, this, &DrumkitframeContent::selectMapFile); file_browser.show(); + Point p{ window()->x() + (int)window()->width() / 2, + window()->y() + (int)window()->height() / 2 }; + auto p0 = window()->translateToScreen(p); + auto sz = file_browser.window()->getNativeSize(); + file_browser.move(p0.x - sz.width / 2, + p0.y - sz.height / 2); + file_browser.setAlwaysOnTop(true); } void DrumkitframeContent::defaultPathChanged(const std::string& path) -- cgit v1.2.3