Add transparent overlay window (#4746)

This commit is contained in:
nerix
2024-10-06 12:54:24 +02:00
committed by GitHub
parent 9ba7ef324d
commit afa8067a20
40 changed files with 1464 additions and 190 deletions
+56
View File
@@ -33,6 +33,7 @@
#include "widgets/helper/ResizingTextEdit.hpp"
#include "widgets/helper/SearchPopup.hpp"
#include "widgets/Notebook.hpp"
#include "widgets/OverlayWindow.hpp"
#include "widgets/Scrollbar.hpp"
#include "widgets/splits/DraggedSplit.hpp"
#include "widgets/splits/SplitContainer.hpp"
@@ -765,6 +766,47 @@ void Split::addShortcuts()
}
return "";
}},
{"popupOverlay",
[this](const auto &) -> QString {
this->showOverlayWindow();
return {};
}},
{"toggleOverlayInertia",
[this](const auto &args) -> QString {
if (args.empty())
{
return "No arguments provided to toggleOverlayInertia "
"(expected one)";
}
const auto &arg = args.front();
if (arg == "this")
{
if (this->overlayWindow_)
{
this->overlayWindow_->toggleInertia();
}
return {};
}
if (arg == "thisOrAll")
{
if (this->overlayWindow_)
{
this->overlayWindow_->toggleInertia();
}
else
{
getApp()->getWindows()->toggleAllOverlayInertia();
}
return {};
}
if (arg == "all")
{
getApp()->getWindows()->toggleAllOverlayInertia();
return {};
}
return {};
}},
};
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
@@ -1104,6 +1146,20 @@ void Split::popup()
window.show();
}
OverlayWindow *Split::overlayWindow()
{
return this->overlayWindow_.data();
}
void Split::showOverlayWindow()
{
if (!this->overlayWindow_)
{
this->overlayWindow_ = new OverlayWindow(this->getIndirectChannel());
}
this->overlayWindow_->show();
}
void Split::clear()
{
this->view_->clearMessages();