Giter Club home page Giter Club logo

kdmactouchbar's Introduction

KDMacTouchBar

KDAB's Qt Widget for the Mac Touch Bar

Introduction

The KDMacTouchBar class wraps the native NSTouchBar class.

KDMacTouchBar provides a Qt-based API for NSTouchBar. The touchbar displays a number of QActions. Each QAction can have a text and an icon. Alternatively, the QActions might be separators (with or without text) or QWidgetActions.

Add actions by calling addAction(). Alternatively, you can use one of the convenience methods like addDialogButtonBox() or addTabBar() which provide common use cases.

If an action with a associated menu is added, its menu items are added as sub-touchbar. Showing sub-menus of this menu is not supported, due to macOS system restrictions.

Usage:

QMainWindow *mw = ...;
KDMacTouchBar *touchBar = new KDMacTouchBar(mw);
touchBar->addAction(actionNewFile);
touchBar->addSeparator();
touchBar->addAction(actionSaveFile);

Licensing:

KD MacTouchBar is © Klarälvdalens Datakonsult AB and is available under the terms of:

  • the LGPL (see LICENSE.LGPL.txt for details)
  • the KDAB commercial license, provided that you buy a license. please contact [email protected] if you are interested in buying commercial licenses.

Get Involved:

KDAB will happily accept external contributions; however, all contributions will require a signed Contributor License Agreement (see docs/KDMacTouchBar-CopyrightAssignmentForm.pdf).

Contact [email protected] for more information.

Please submit your contributions or issue reports from our GitHub space at https://github.com/KDAB/KDMacTouchBar

About KDAB

KD MacTouchBar is supported and maintained by Klarälvdalens Datakonsult AB (KDAB).

The KDAB Group is the global No.1 software consultancy for Qt, C++ and OpenGL applications across desktop, embedded and mobile platforms.

The KDAB Group provides consulting and mentoring for developing Qt applications from scratch and in porting from all popular and legacy frameworks to Qt. We continue to help develop parts of Qt and are one of the major contributors to the Qt Project. We can give advanced or standard trainings anywhere around the globe on Qt as well as C++, OpenGL, 3D and more.

Please visit https://www.kdab.com to meet the people who write code like this.

Stay up-to-date with KDAB product announcements:

kdmactouchbar's People

Contributors

adriweb avatar cschleifenbaum avatar dantti avatar winterz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kdmactouchbar's Issues

Add KDMacTouchBar::clear()

I don't see any option at moment to clear the touchbar other than
for (auto* action : m_touchBar->actions(); m_touchBar->removeAction(action);

It would be great to have KDMacTouchBar::clear() to have a similar interface like in QToolBar.

Allow to ignore the text available in QAction

I have a set of QActions used in the main menu and also in the toolbar and I want/need to re-use those actions in the TouchBar. Because of the limited amount of space showing the text in the touchbar is not always practical. It would be great to have an option in KDMacTouchBar to ignore the text available in QAction::text(). Maybe something similar to what we have in KF5's toolbar already with "Show Icon only", "Show Text only", "Show Icon an Text"?

Doesn't build anymore with Qt 5.15

This is due to qt/qtbase@bee3d0f which removes NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0).

Looks like the class method imageFromQIcon can be used instead. But only if the current Qt version is >= 5.15.

error: conversion from 'int' to 'QChar' is ambiguous

I have a 2022 M2 MBP with the touch bar. I'm getting this error trying to compile with Qt 6.5.0 on Ventura with 13.1 SDK:

kdmactouchbar.mm:78:41: error: conversion from 'int' to 'QChar' is ambiguous
    QString returnText(original.size(), 0);
                                        ^

Including several warnings about deprecated constructors (QMouseEvent) and functions (QAction::associatedWidgets).

If I change that 0 to QChar(0), I get another error:

mainwindow.cpp:25:10: fatal error: 'QtWidgets/QAction' file not found
#include <QtWidgets/QAction>
         ^~~~~~~~~~~~~~~~~~~
mainwindow.cpp:25:10: note: did not find header 'QAction' in framework 'QtWidgets' (loaded from '/Users/user/Qt6/6.5.0/macos/lib')

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.