Code Monkey home page Code Monkey logo

qtkeyboard's Introduction

本文介绍Qt君最近编写的一个Qt键盘,该键盘主要功能有大小写切换,中英文切换,实现数字输入,符号输入等基本功能,未来还会支持换肤,手写功能。

键盘演示

实现初衷

  • 供大家交流学习;
  • 希望以轻量级(嵌入式设备)键盘为特点不断发展该键盘项目(源码地址在文末)。
    键盘界面

项目预览

  • 文件目录
    文件目录

  • 基类键盘AbstractKeyboard

class AbstractKeyboard : public QWidget
{
    Q_OBJECT
public:
    AbstractKeyboard(QWidget *parent = 0);
    ~AbstractKeyboard();

    const QString name();
    void setName(const QString &name);

public slots:
    virtual void update(const QString &text);
    void onKeyPressed(int key, QString value);

signals:
    void keyPressed(int key, QString value);
};
  • 实现类键盘Keyboard
class Keyboard : public AbstractKeyboard
{
    Q_OBJECT
public:
    Keyboard(QWidget *parent = NULL);

protected:
    void resizeEvent(QResizeEvent *e);

private slots:
    void switchCapsLock();
    void switchSpecialChar();
    void switchEnOrCh();
};
  • 键盘按钮KeyButton
class KeyButton : public QPushButton
{
    Q_OBJECT
public:
    enum Type { Auto = 0, LowerCase, UpperCase, SpecialChar };

    struct Mode {
        int key;          /* Qt::Key */
        QString value;    /* text */
        QString display;  /* display text */
        Type type;        /* default: Auto */
    };

    KeyButton(const QList<Mode> modes = QList<Mode>(), QWidget *parent = NULL);
    Mode mode();

    void onReponse(const QObject* receiverObj, const QString &receiver);

    void switchCapsLock();
    void switchSpecialChar();
    void switching(); /* Cycle switch. */

signals:
    void pressed(int key, QString value);
};

文章更新

  • 轻量级Qt键盘-介绍篇
  • 轻量级Qt键盘-原理篇
  • 轻量级Qt键盘-实现篇
  • 轻量级Qt键盘-中文输入
  • 后续会不定期更新关于主要新增功能介绍文章。

关于更多

  • 源码地址
https://github.com/aeagean/QtKeyboard
  • 本文首发公众号:Qt君

微信公众号:Qt君

Qt君

qtkeyboard's People

Contributors

aeagean avatar

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.