msnh2012 / QT_KIT_qttokenedit

Qt Token Edit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please note: This project and its site on Github are still under development.

Qt Token Edit

Implementation of a token edit based on the Qt model/view framework.

Preview

Requirements

  • C++14 compliant compiler
  • Qt version >= 5.9 (a lower version may work but was not tested)

Notable Features

QAbstractItemModel Interface

The token edit is populated using the QAbstractItemModel interface. The widget reacts to changes from outside using the model’s signals.

Usage of QStyle and QPalette

The implementation utilises the application’s style wherever possible. Colors are taken from the widget’s palette.

MacOS

MacOS Style

Windows

Windows Style

Gnome Adwaita

Gnome Adwaita Style

Auto-Completion and validation

The token edit exposes its QLineEdit so that auto-completion and validation can easily be added as normally.

Drag and Drop

Drag and Drop is implemented using the QAbstractItemModel interface. However only move operations are currently supported.

High-DPI Support

The widget is properly scaled at different DPI scale factors.

Optional Collapsed State

When the widget is not in focus, tokens that do not fit into the widget without scrolling can be collapsed into one displaying the number of collapsed ones.

Option to Remove Tokens

The token edit offers an intuitive way to delete items through both mouse and keyboard interaction.

Known Issues / Todos

  • Only move operations are supported for drag and drop.
  • The widget does not rescale when moving between windows with difference DPI scaling
  • Add unit tests for the testable parts of the widget
  • Implement a Qt Designer plugin

References

  • Token fields in MacOS [link]
  • Input chips in Material Design [link]

About

Qt Token Edit

License:MIT License


Languages

Language:C++ 84.3%Language:Python 10.8%Language:CMake 2.3%Language:Shell 0.9%Language:Makefile 0.7%Language:M4 0.6%Language:C 0.5%Language:Starlark 0.0%