Skip to content

Instantly share code, notes, and snippets.

@Consolatis
Last active February 18, 2023 18:52
Show Gist options
  • Save Consolatis/22d7c7843af77bcf5db92b6cae3b3425 to your computer and use it in GitHub Desktop.
Save Consolatis/22d7c7843af77bcf5db92b6cae3b3425 to your computer and use it in GitHub Desktop.
#include <QApplication>
#include <QMainWindow>
#include <QPushButton>
#include <LayerShellQt/shell.h>
#include <LayerShellQt/window.h>
int main(int argc, char **argv) {
QApplication app(argc, argv);
LayerShellQt::Shell::useLayerShell();
QMainWindow main_window;
QPushButton button;
button.setText("foobar");
main_window.setCentralWidget(&button);
/* Ensure platform window is created */
main_window.winId();
QWindow *window = main_window.windowHandle();
LayerShellQt::Window *layershell = LayerShellQt::Window::get(window);
layershell->setAnchors({
LayerShellQt::Window::Anchor::AnchorTop,
LayerShellQt::Window::Anchor::AnchorLeft,
LayerShellQt::Window::Anchor::AnchorRight
});
layershell->setLayer(LayerShellQt::Window::Layer::LayerBottom);
layershell->setExclusiveZone(30);
main_window.resize(0, 30);
main_window.show();
return app.exec();
}
@Consolatis
Copy link
Author

CMakeLists.txt additions:

find_package(LayerShellQt REQUIRED)
target_link_libraries(example PRIVATE LayerShellQtInterface Qt5::Widgets)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment