1 Star 1 Fork 1

xueshanfeihu999 / QtKeyboard

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

本文介绍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君

MIT License Copyright (c) 2019 aeagean Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
C++ 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/xueshanfeihu999/QtKeyboard.git
git@gitee.com:xueshanfeihu999/QtKeyboard.git
xueshanfeihu999
QtKeyboard
QtKeyboard
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891