Code Monkey home page Code Monkey logo

qt-macos-examples's Introduction

Qt for macOS Examples

This repository contains Qt usage examples that are spesific to Qt for macOS. This includes exmples for working with native window types, the MacBook Pro Touch bar, and the Metal graphcis API.

The target Qt branch for the examples contained here is the "5.15" branch. The examples may use features or rely on bugfixes which are not present in the released version of Qt.

Native Window Types and Configurations

Macos provides several native window types and window configurations which do not have a corresponding cross-platform API in Qt. The following examples shows how to create and configure such native windows and then embed Qt-based application content.

accessoryview/           Application content in the title bar area.
fullsizecontentview/     Full-window application content with overlaid window controls
hudwindow/               Windows with the 'HUD' look
popover/                 Popover popup/context menus
visualeffects/           Native blur effect

MacBook Pro Touch Bar

This example shows how to populate the MacBook Pro touch bar from a Qt-based applicaiton.

Normally this is done by creating an NSTouchBarDelegate, and then implementing the NSTouchBarProvider protocol on for example the NApplication delegate or NSWindow delegate.

For Qt applcations this becomes a problem since the the application and window delegates are owned by Qt and are private implementation objects.

The example shows how the application can install its delegate, and then forward non-touchbar related messages to the Qt delegate.

touchbar/                A simple touch bar example

Metal

Two examples demonstrate how to integrate Metal rendering with Qt:

metalview/                MTKView controlled by QWindow
metalwindow/              QWindow subclass with QSurface::MetalSurface
metalwidget/              QWidget::createWindowContainer() with Metal QWindow
metalquick/               Metal window overlaid on Qt Quick content

In the metalview example, QWindow::fromWinId() is used to "wrap" and control a native MKMetalView.

In the metalwindow example, a QWindow subclass is configured to have Metal backing layer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.