Qt 软键盘设计

        最近有客户用的电脑是触屏的,所以不用键盘与鼠标,系统的键盘不好看,所以自己设计一个键盘显示,先看下效果图;

设计思路,构建一个软键盘设计界面并重写输入框,然后做界面提升,直接上代码

class CustomLineEdit : public QLineEdit
{Q_OBJECTpublic:CustomLineEdit(QWidget *parent = Q_NULLPTR);~CustomLineEdit();protected:bool eventFilter(QObject* sender, QEvent* event);};CustomLineEdit::CustomLineEdit(QWidget *parent): QLineEdit(parent)
{installEventFilter(this);
}CustomLineEdit::~CustomLineEdit()
{}bool CustomLineEdit::eventFilter(QObject* sender, QEvent* event)
{if (event->type() == QEvent::MouseButtonPress){if (!ClientLogic::GetKeyboardStatus()){SystemParams sysParams;ClientLogic::GetSystemParams(sysParams);if (sysParams.m_bSoftKeyboard){ClientLogic::SetKeyboardStatus(true);auto pSoftKeyBoard = ivmsClient::getInstance()->GetSoftKeyBoard();if (pSoftKeyBoard){pSoftKeyBoard->show();}/*	DialogSoftKeyBoard dlgKeyBoard;dlgKeyBoard.exec();*/}}}return QLineEdit::eventFilter(sender, event);
}
#ifndef DialogSoftKeyBoard_h__
#define DialogSoftKeyBoard_h__#include <QDialog>
#include <QVector>
#include <QLabel>
#include <QMap>
#include <QMouseEvent>
#include <QListWidgetItem>#ifdef WIN32
#pragma execution_character_set("utf-8")
#endifnamespace Ui {class DialogSoftKeyBoard;
};class DialogSoftKeyBoard : public QDialog
{Q_OBJECTpublic:DialogSoftKeyBoard(QWidget *parent = Q_NULLPTR);~DialogSoftKeyBoard();protected:/// 鼠标事件重写virtual void mouseMoveEvent(QMouseEvent *event);virtual void mousePressEvent(QMouseEvent *event);virtual void mouseReleaseEvent(QMouseEvent *event);private slots:void slotKeyButtonClicked();void slotKeyLetterButtonClicked();void slotKeyNumberButtonClicked();void on_listWidget_itemClicked(QListWidgetItem *item);void on_toolButton_lastPage_clicked();void on_toolButton_nextPage_clicked();void on_ButtonClose_clicked();private:void initFrm();void loadChineseFontData();void findChineseFontData(QString text);void addOneItem(QString text);QString OnLoadQssStyle(const QString& filePath, const QString& fileName);private:Ui::DialogSoftKeyBoard *ui;QMap<QString, QList<QPair<QString, QString>>> m_data;bool		m_bIsChinese = false;QString		m_recordLitterBuf;QVector<QPushButton*> m_letterKeys;QVector<QPushButton*> m_NumberKeys;QMap<QString, Qt::Key> m_mapSymbolKeys;QStringList m_showTextList;int m_curPage = 0;QLabel* m_labelShowPinyin;Qt::KeyboardModifier m_curModifier = Qt::NoModifier;bool        m_bPressed = false;QPoint      m_ptPressStart = { 0, 0 };
};#endif // DialogSoftKeyBoard_h__
#include "DialogSoftKeyBoard.h"
#include "ui_DialogSoftKeyBoard.h"
#include <QPushButton>
#include <QKeyEvent>
#include <QDebug>
#include <QStyle>
#include <QListWidgetItem>
#include <QLabel>
#include <QVBoxLayout>
#include <QToolTip>
#include "ClientLogic.h"DialogSoftKeyBoard::DialogSoftKeyBoard(QWidget *parent): QDialog(parent)
{ui = new Ui::DialogSoftKeyBoard();ui->setupUi(this);setWindowTitle("键盘");setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Dialog | Qt::WindowDoesNotAcceptFocus | Qt::FramelessWindowHint);setWindowModality(Qt::WindowModal);setAttribute(Qt::WA_TranslucentBackground);ui->listWidget->setEnabled(false);initFrm();loadChineseFontData();QString DirPathStr = QCoreApplication::applicationDirPath();QString qssPath = DirPathStr + "/Clientqss";QString qssFile = OnLoadQssStyle(qssPath, "/DialogSoftKeyBoard.qss");this->setStyleSheet(qssFile);ui->frame->installEventFilter(this);ui->listWidget->installEventFilter(this);
}DialogSoftKeyBoard::~DialogSoftKeyBoard()
{ClientLogic::SetKeyboardStatus(false);delete ui;
}void DialogSoftKeyBoard::mouseMoveEvent(QMouseEvent *event)
{if (m_bPressed){auto gEndPos = event->globalPos();this->move(pos() + (gEndPos - m_ptPressStart));m_ptPressStart = gEndPos;}event->ignore();
}void DialogSoftKeyBoard::mousePressEvent(QMouseEvent *event)
{auto gPos = event->globalPos();auto gLeftTop = this->frameGeometry().topLeft();if (event->button() == Qt::LeftButton &&ui->listWidget->frameRect().contains(gPos - gLeftTop)){m_bPressed = true;m_ptPressStart = gPos;}event->ignore();
}void DialogSoftKeyBoard::mouseReleaseEvent(QMouseEvent *event)
{if (event->button() == Qt::LeftButton){m_bPressed = false;}event->ignore();
}QString DialogSoftKeyBoard::OnLoadQssStyle(const QString& filePath, const QString& fileName)
{QString qssFile = "";QFile file(filePath + fileName);file.open(QFile::ReadOnly);if (file.isOpen()){qssFile = QString::fromLocal8Bit(file.readAll());file.close();}return qssFile;
}void DialogSoftKeyBoard::slotKeyButtonClicked()
{QPushButton* pbtn = (QPushButton*)sender();QString objectName = pbtn->objectName();if (pbtn->text().contains("BACKSPACE")){if (m_bIsChinese){if (m_recordLitterBuf.size() > 0){m_recordLitterBuf.remove(m_recordLitterBuf.size() - 1, 1);findChineseFontData(m_recordLitterBuf);if (!m_labelShowPinyin->text().isEmpty())m_labelShowPinyin->setText(m_recordLitterBuf);}else{QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Backspace, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Backspace, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}}else{QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Backspace, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Backspace, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}}else if (pbtn->text().contains("CAPS")){if (pbtn->isChecked()){for (auto pbtnKey : m_letterKeys){pbtnKey->setText(pbtnKey->text().toUpper());}}else{for (auto pbtnKey : m_letterKeys){pbtnKey->setText(pbtnKey->text().toLower());}}}else if (pbtn->text() == "SPACE"){if (!isActiveWindow()){QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Space, m_curModifier, " ");QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Space, m_curModifier, " ");QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}}else if (pbtn->text().contains("TAB")){//QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Tab, m_curModifier);//QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Tab, m_curModifier);//QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);//QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if (pbtn->text().contains("ENTER")){if (!isActiveWindow()){QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Enter, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Enter, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}}else if (pbtn->text().contains("SHIFT")){if (pbtn->isChecked()) {m_bIsChinese = true;m_curModifier = Qt::ShiftModifier;ui->listWidget->setEnabled(true);/*for (auto pbtnKey : m_letterKeys) {pbtnKey->setText(pbtnKey->text().toUpper());}*/}else {ui->listWidget->setEnabled(false);m_bIsChinese = false;ui->listWidget->clear();m_showTextList.clear();m_curPage = 0;m_labelShowPinyin->clear();m_recordLitterBuf.clear();m_curModifier = Qt::NoModifier;for (auto pbtnKey : m_letterKeys) {pbtnKey->setText(pbtnKey->text().toLower());}}QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Shift, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Shift, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if (pbtn->text().contains("CTRL")) {if (pbtn->isChecked())m_curModifier = Qt::ControlModifier;elsem_curModifier = Qt::NoModifier;QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Control, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Control, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if (pbtn->text().contains("WIN")){if (pbtn->isChecked())m_curModifier = Qt::MetaModifier;elsem_curModifier = Qt::NoModifier;QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Meta, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Meta, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if (pbtn->text().contains("ALT")) {if (pbtn->isChecked())m_curModifier = Qt::AltModifier;elsem_curModifier = Qt::NoModifier;QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Alt, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Alt, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if(objectName == "ButtonTop")// (pbtn->text().contains("↑")) {QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Up, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Up, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if (objectName == "ButtonBottom") //(pbtn->text().contains("↓")) {QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Down, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Down, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if (objectName == "ButtonLeft") //(pbtn->text().contains("←")) {QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Left, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Left, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if (objectName == "ButtonRight") //(pbtn->text().contains("→")) {QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Right, m_curModifier);QKeyEvent keyRelease(QEvent::KeyRelease, Qt::Key_Right, m_curModifier);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}else if (objectName == "ButtonClose"){ClientLogic::SetKeyboardStatus(false);done(QDialog::Accepted);}else {QString symbol;if (ui->Button_shift->isChecked())symbol = pbtn->text().split("\n").at(0);elsesymbol = pbtn->text().split("\n").at(1);QKeyEvent keyPress(QEvent::KeyPress, m_mapSymbolKeys.value(symbol), m_curModifier, symbol);QKeyEvent keyRelease(QEvent::KeyRelease, m_mapSymbolKeys.value(symbol), m_curModifier, symbol);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}
}void DialogSoftKeyBoard::slotKeyLetterButtonClicked()
{QPushButton* pbtn = (QPushButton*)sender();if (*(pbtn->text().data()) >= 'a' && *(pbtn->text().data()) <= 'z') {if (m_bIsChinese){m_recordLitterBuf += pbtn->text().toLower();findChineseFontData(m_recordLitterBuf);}else{ui->listWidget->clear();m_showTextList.clear();m_curPage = 0;m_labelShowPinyin->clear();m_recordLitterBuf.clear();QKeyEvent keyPress(QEvent::KeyPress, int(pbtn->text().at(0).toLatin1()) - 32, m_curModifier, pbtn->text());QKeyEvent keyRelease(QEvent::KeyRelease, int(pbtn->text().at(0).toLatin1()) - 32, m_curModifier, pbtn->text());QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}}else if (*(pbtn->text().data()) >= 'A' && *(pbtn->text().data()) <= 'Z') {if (m_bIsChinese){m_recordLitterBuf += pbtn->text().toLower();findChineseFontData(m_recordLitterBuf);}else{ui->listWidget->clear();m_showTextList.clear();m_curPage = 0;m_labelShowPinyin->clear();m_recordLitterBuf.clear();QKeyEvent keyPress(QEvent::KeyPress, int(pbtn->text().at(0).toLatin1()), m_curModifier, pbtn->text());QKeyEvent keyRelease(QEvent::KeyRelease, int(pbtn->text().at(0).toLatin1()), m_curModifier, pbtn->text());QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}}//取消组合键按下//    if (ui.pushButton_shift->isChecked()) {//        ui.pushButton_shift->setChecked(false);//        for (auto pbtnKey : m_letterKeys) {//            pbtnKey->setText(pbtnKey->text().toLower());//        }//    }if (ui->Button_ctrl->isChecked())ui->Button_ctrl->setChecked(false);if (ui->Button_win->isChecked())ui->Button_win->setChecked(false);if (ui->Button_alt->isChecked())ui->Button_alt->setChecked(false);m_curModifier = Qt::NoModifier;
}void DialogSoftKeyBoard::slotKeyNumberButtonClicked()
{QPushButton* pbtn = (QPushButton*)sender();int num = pbtn->text().toInt();if (m_bIsChinese){if (m_recordLitterBuf.size() > 0){if (num > 0 && num <= 9 && ui->listWidget->count() >= num){on_listWidget_itemClicked(ui->listWidget->item(num - 1));}}else{QKeyEvent keyPress(QEvent::KeyPress, num + 48, m_curModifier, pbtn->text());QKeyEvent keyRelease(QEvent::KeyRelease, num + 48, m_curModifier, pbtn->text());QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}}else {QKeyEvent keyPress(QEvent::KeyPress, num + 48, m_curModifier, pbtn->text());QKeyEvent keyRelease(QEvent::KeyRelease, num + 48, m_curModifier, pbtn->text());QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);//取消组合键按下//    if (ui.pushButton_shift->isChecked()) {//        ui.pushButton_shift->setChecked(false);//        for (auto pbtnKey : m_letterKeys) {//            pbtnKey->setText(pbtnKey->text().toLower());//        }//    }if (ui->Button_ctrl->isChecked())ui->Button_ctrl->setChecked(false);if (ui->Button_win->isChecked())ui->Button_win->setChecked(false);if (ui->Button_alt->isChecked())ui->Button_alt->setChecked(false);}m_curModifier = Qt::NoModifier;
}void DialogSoftKeyBoard::on_listWidget_itemClicked(QListWidgetItem *item)
{QKeyEvent keyPress(QEvent::KeyPress, 0, m_curModifier, item->text().right(1));QKeyEvent keyRelease(QEvent::KeyRelease, 0, m_curModifier, item->text().right(1));QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);ui->listWidget->clear();m_showTextList.clear();m_curPage = 0;m_labelShowPinyin->clear();m_recordLitterBuf.clear();
}void DialogSoftKeyBoard::on_toolButton_lastPage_clicked()
{if (m_curPage <= 0)return;m_curPage--;ui->listWidget->clear();for (int i = m_curPage * 9; i < m_curPage * 9 + 9; i++) {if (i >= m_showTextList.count())break;addOneItem(m_showTextList.at(i));}
}void DialogSoftKeyBoard::on_toolButton_nextPage_clicked()
{if (m_curPage >= m_showTextList.count() / 9)return;m_curPage++;ui->listWidget->clear();for (int i = m_curPage * 9; i < m_curPage * 9 + 9; i++) {if (i >= m_showTextList.count())break;addOneItem(m_showTextList.at(i));}
}void DialogSoftKeyBoard::on_ButtonClose_clicked()
{ClientLogic::SetKeyboardStatus(false);done(QDialog::Accepted);
}void DialogSoftKeyBoard::initFrm()
{m_letterKeys.clear();m_NumberKeys.clear();QList<QPushButton*> pbtns = this->findChildren<QPushButton*>();foreach(QPushButton * pbtn, pbtns) {pbtn->setAutoRepeat(true);    //允许自动重复pbtn->setAutoRepeatDelay(500);//设置重复操作的时延if (*(pbtn->text().data()) >= 'a' && *(pbtn->text().data()) <= 'z') {connect(pbtn, &QPushButton::clicked, this, &DialogSoftKeyBoard::slotKeyLetterButtonClicked);m_letterKeys.push_back(pbtn);}else if (pbtn->text().toInt() > 0 && pbtn->text().toInt() <= 9 || pbtn->text() == "0") {connect(pbtn, &QPushButton::clicked, this, &DialogSoftKeyBoard::slotKeyNumberButtonClicked);m_NumberKeys.push_back(pbtn);}else{connect(pbtn, &QPushButton::clicked, this, &DialogSoftKeyBoard::slotKeyButtonClicked);}}m_labelShowPinyin = new QLabel();QVBoxLayout* vLayout = new QVBoxLayout();vLayout->addWidget(m_labelShowPinyin);vLayout->addStretch();ui->listWidget->setLayout(vLayout);m_mapSymbolKeys.insert("~", Qt::Key_AsciiTilde);m_mapSymbolKeys.insert("`", Qt::Key_nobreakspace);m_mapSymbolKeys.insert("-", Qt::Key_Minus);m_mapSymbolKeys.insert("_", Qt::Key_Underscore);m_mapSymbolKeys.insert("+", Qt::Key_Plus);m_mapSymbolKeys.insert("=", Qt::Key_Equal);m_mapSymbolKeys.insert(",", Qt::Key_Comma);m_mapSymbolKeys.insert(".", Qt::Key_Period);m_mapSymbolKeys.insert("/", Qt::Key_Slash);m_mapSymbolKeys.insert("<", Qt::Key_Less);m_mapSymbolKeys.insert(">", Qt::Key_Greater);m_mapSymbolKeys.insert("?", Qt::Key_Question);m_mapSymbolKeys.insert("[", Qt::Key_BracketLeft);m_mapSymbolKeys.insert("]", Qt::Key_BracketRight);m_mapSymbolKeys.insert("{", Qt::Key_BraceLeft);m_mapSymbolKeys.insert("}", Qt::Key_BraceRight);m_mapSymbolKeys.insert("|", Qt::Key_Bar);m_mapSymbolKeys.insert("\\", Qt::Key_Backslash);m_mapSymbolKeys.insert(":", Qt::Key_Colon);m_mapSymbolKeys.insert(";", Qt::Key_Semicolon);m_mapSymbolKeys.insert("\"", Qt::Key_QuoteLeft);m_mapSymbolKeys.insert("'", Qt::Key_Apostrophe);
}void DialogSoftKeyBoard::loadChineseFontData()
{QString exePath = QCoreApplication::applicationDirPath();exePath += "/PinYin_Chinese.txt";QFile pinyin(exePath);if (!pinyin.open(QIODevice::ReadOnly)) {qDebug() << "Open pinyin file failed!";return;}while (!pinyin.atEnd()) {QString buf = QString::fromUtf8(pinyin.readLine()).trimmed();if (buf.isEmpty())continue;/* 去除#号后的注释内容 */if (buf.left(1) == "#")continue;buf = buf.replace("\t", " ");QString pinyin = buf.mid(1, buf.size() - 1);QString word = buf.mid(0, 1);QString abb;QStringList pinyinList = pinyin.split(" ");for (int i = 0; i < pinyinList.count(); i++) {/* 获得拼音词组的首字母(用于缩写匹配) */abb += pinyinList.at(i).left(1);}QList<QPair<QString, QString>> &tmp = m_data[pinyin.left(1)];/* 将'拼音(缩写)'和'词组'写入匹配容器 */tmp.append(qMakePair(abb, word));/* 将'拼音(全拼)'和'词组'写入匹配容器 */tmp.append(qMakePair(pinyin.remove(" "), word));}qDebug() << m_data.size();pinyin.close();
}void DialogSoftKeyBoard::findChineseFontData(QString text)
{QString lowerText = text.toLower();m_labelShowPinyin->setText(lowerText);for (int i = 0; i < ui->listWidget->count(); i++) {QListWidgetItem *item = ui->listWidget->takeItem(i);delete item;item = NULL;}ui->listWidget->clear();m_showTextList.clear();m_curPage = 0;if (lowerText.count() <= 0)return;const QList<QPair<QString, QString> > &tmp = m_data[lowerText.left(1)];bool fond = false;for (int i = 0; i < tmp.count(); i++) {const QPair<QString, QString> &each = tmp.at(i);if (each.first.left(lowerText.count()) != lowerText)continue;fond = true;addOneItem(each.second);m_showTextList.push_back(each.second);}if (!fond){if (m_recordLitterBuf.count() > 1){m_recordLitterBuf = m_recordLitterBuf.right(1);findChineseFontData(m_recordLitterBuf);}else{QKeyEvent keyPress(QEvent::KeyPress, int(m_recordLitterBuf.at(0).toLatin1()), m_curModifier, m_recordLitterBuf);QKeyEvent keyRelease(QEvent::KeyRelease, int(m_recordLitterBuf.at(0).toLatin1()), m_curModifier, m_recordLitterBuf);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyPress);QApplication::sendEvent(qApp->focusWidget() == nullptr ? this : qApp->focusWidget(), &keyRelease);}}
}void DialogSoftKeyBoard::addOneItem(QString text)
{if (ui->listWidget->count() >= 9)return;QString itemText = QString("%1.%2").arg(ui->listWidget->count() + 1).arg(text);QListWidgetItem *item = new QListWidgetItem(itemText);QFont font;font.setPointSize(15);font.setBold(true);font.setWeight(50);item->setFont(font);/* 设置文字居中 */item->setTextAlignment(Qt::AlignBottom | Qt::AlignHCenter);bool isChineseFlag = QRegExp("^[\u4E00-\u9FA5]+").indexIn(text.left(1)) != -1;int width = font.pointSize();if (isChineseFlag)width += itemText.count()*font.pointSize()*1.5;elsewidth += itemText.count()*font.pointSize() * 2 / 3;item->setSizeHint(QSize(width, 50));ui->listWidget->addItem(item);
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>DialogSoftKeyBoard</class><widget class="QDialog" name="DialogSoftKeyBoard"><property name="geometry"><rect><x>0</x><y>0</y><width>878</width><height>327</height></rect></property><property name="windowTitle"><string>DialogSoftKeyBoard</string></property><property name="styleSheet"><string notr="true"/></property><layout class="QGridLayout" name="gridLayout_3"><property name="leftMargin"><number>0</number></property><property name="topMargin"><number>0</number></property><property name="rightMargin"><number>0</number></property><property name="bottomMargin"><number>0</number></property><property name="spacing"><number>0</number></property><item row="0" column="0"><widget class="QFrame" name="frame"><property name="minimumSize"><size><width>0</width><height>320</height></size></property><property name="frameShape"><enum>QFrame::StyledPanel</enum></property><property name="frameShadow"><enum>QFrame::Raised</enum></property><layout class="QGridLayout" name="gridLayout"><property name="topMargin"><number>2</number></property><property name="bottomMargin"><number>2</number></property><property name="verticalSpacing"><number>1</number></property><item row="0" column="0"><layout class="QHBoxLayout" name="horizontalLayout_3"><item><widget class="QListWidget" name="listWidget"><property name="enabled"><bool>true</bool></property><property name="minimumSize"><size><width>0</width><height>50</height></size></property><property name="flow"><enum>QListView::LeftToRight</enum></property></widget></item><item><widget class="QFrame" name="frame_2"><property name="minimumSize"><size><width>80</width><height>73</height></size></property><property name="maximumSize"><size><width>80</width><height>73</height></size></property><property name="frameShape"><enum>QFrame::StyledPanel</enum></property><property name="frameShadow"><enum>QFrame::Raised</enum></property><layout class="QGridLayout" name="gridLayout_2"><property name="leftMargin"><number>0</number></property><property name="topMargin"><number>0</number></property><property name="rightMargin"><number>0</number></property><property name="bottomMargin"><number>0</number></property><item row="0" column="0"><layout class="QVBoxLayout" name="verticalLayout"><property name="spacing"><number>6</number></property><property name="bottomMargin"><number>6</number></property><item><layout class="QHBoxLayout" name="horizontalLayout"><item><spacer name="horizontalSpacer"><property name="orientation"><enum>Qt::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item><item><widget class="QPushButton" name="ButtonClose"><property name="minimumSize"><size><width>28</width><height>28</height></size></property><property name="maximumSize"><size><width>28</width><height>28</height></size></property></widget></item><item><spacer name="horizontalSpacer_2"><property name="orientation"><enum>Qt::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item></layout></item><item><layout class="QHBoxLayout" name="horizontalLayout_2"><item><widget class="QToolButton" name="toolButton_lastPage"><property name="minimumSize"><size><width>20</width><height>20</height></size></property><property name="text"><string/></property><property name="autoRaise"><bool>true</bool></property></widget></item><item><widget class="QToolButton" name="toolButton_nextPage"><property name="minimumSize"><size><width>20</width><height>20</height></size></property><property name="text"><string/></property><property name="autoRaise"><bool>true</bool></property></widget></item></layout></item></layout></item></layout></widget></item></layout></item><item row="1" column="0"><layout class="QHBoxLayout" name="horizontalLayout_13"><property name="spacing"><number>6</number></property><item><widget class="QPushButton" name="Button_fuhao"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>~
`</string></property></widget></item><item><widget class="QPushButton" name="Button_1"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>1</string></property></widget></item><item><widget class="QPushButton" name="Button_2"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>2</string></property></widget></item><item><widget class="QPushButton" name="Button_3"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>3</string></property></widget></item><item><widget class="QPushButton" name="Button_4"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>4</string></property></widget></item><item><widget class="QPushButton" name="Button_5"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>5</string></property></widget></item><item><widget class="QPushButton" name="Button_6"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>6</string></property></widget></item><item><widget class="QPushButton" name="Button_7"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>7</string></property></widget></item><item><widget class="QPushButton" name="Button_8"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>8</string></property></widget></item><item><widget class="QPushButton" name="Button_9"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>9</string></property></widget></item><item><widget class="QPushButton" name="Button_0"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>0</string></property></widget></item><item><widget class="QPushButton" name="pushButton_9"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>_
-</string></property></widget></item><item><widget class="QPushButton" name="pushButton_10"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>+
=</string></property></widget></item><item><widget class="QPushButton" name="Button_backspace"><property name="minimumSize"><size><width>100</width><height>50</height></size></property><property name="maximumSize"><size><width>100</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>BACKSPACE</string></property></widget></item></layout></item><item row="2" column="0"><layout class="QHBoxLayout" name="horizontalLayout_14"><property name="spacing"><number>6</number></property><item><widget class="QPushButton" name="Button_tab"><property name="minimumSize"><size><width>70</width><height>50</height></size></property><property name="maximumSize"><size><width>70</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>TAB</string></property></widget></item><item><widget class="QPushButton" name="Button_Q"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>q</string></property></widget></item><item><widget class="QPushButton" name="Button_W"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>w</string></property></widget></item><item><widget class="QPushButton" name="Button_E"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>e</string></property></widget></item><item><widget class="QPushButton" name="Button_R"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>r</string></property></widget></item><item><widget class="QPushButton" name="Button_T"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>t</string></property></widget></item><item><widget class="QPushButton" name="Button_Y"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>y</string></property></widget></item><item><widget class="QPushButton" name="Button_U"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>u</string></property></widget></item><item><widget class="QPushButton" name="Button_I"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>i</string></property></widget></item><item><widget class="QPushButton" name="Button_O"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>o</string></property></widget></item><item><widget class="QPushButton" name="Button_P"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>p</string></property></widget></item><item><widget class="QPushButton" name="pushButton_1"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>{
[</string></property></widget></item><item><widget class="QPushButton" name="pushButton_2"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>}
]</string></property></widget></item><item><widget class="QPushButton" name="pushButton_3"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>|
\</string></property></widget></item></layout></item><item row="3" column="0"><layout class="QHBoxLayout" name="horizontalLayout_15"><property name="spacing"><number>6</number></property><item><widget class="QPushButton" name="Button_capsLock"><property name="minimumSize"><size><width>80</width><height>50</height></size></property><property name="maximumSize"><size><width>80</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="layoutDirection"><enum>Qt::LeftToRight</enum></property><property name="text"><string>CAPS
LOCK</string></property><property name="checkable"><bool>true</bool></property><property name="checked"><bool>false</bool></property></widget></item><item><widget class="QPushButton" name="Button_A"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>a</string></property></widget></item><item><widget class="QPushButton" name="Button_S"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>s</string></property></widget></item><item><widget class="QPushButton" name="Button_D"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>d</string></property></widget></item><item><widget class="QPushButton" name="Button_F"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>f</string></property></widget></item><item><widget class="QPushButton" name="Button_G"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>g</string></property></widget></item><item><widget class="QPushButton" name="Button_H"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>h</string></property></widget></item><item><widget class="QPushButton" name="Button_J"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>j</string></property></widget></item><item><widget class="QPushButton" name="Button_K"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>k</string></property></widget></item><item><widget class="QPushButton" name="Button_L"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>l</string></property></widget></item><item><widget class="QPushButton" name="pushButton_4"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>:
;</string></property></widget></item><item><widget class="QPushButton" name="pushButton_5"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>&quot;
'</string></property></widget></item><item><widget class="QPushButton" name="Button_enter"><property name="minimumSize"><size><width>120</width><height>50</height></size></property><property name="maximumSize"><size><width>120</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>ENTER</string></property></widget></item></layout></item><item row="4" column="0"><layout class="QHBoxLayout" name="horizontalLayout_16"><property name="spacing"><number>6</number></property><property name="bottomMargin"><number>0</number></property><item><widget class="QPushButton" name="Button_shift"><property name="minimumSize"><size><width>100</width><height>50</height></size></property><property name="maximumSize"><size><width>100</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="toolTip"><string>En/Ch</string></property><property name="text"><string>SHIFT</string></property><property name="checkable"><bool>true</bool></property></widget></item><item><widget class="QPushButton" name="Button_Z"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>z</string></property></widget></item><item><widget class="QPushButton" name="Button_X"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>x</string></property></widget></item><item><widget class="QPushButton" name="Button_C"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>c</string></property></widget></item><item><widget class="QPushButton" name="Button_V"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>v</string></property></widget></item><item><widget class="QPushButton" name="Button_B"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>b</string></property></widget></item><item><widget class="QPushButton" name="Button_N"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>n</string></property></widget></item><item><widget class="QPushButton" name="Button_M"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>m</string></property></widget></item><item><widget class="QPushButton" name="pushButton_6"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>&lt;
,</string></property></widget></item><item><widget class="QPushButton" name="pushButton_7"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>&gt;
.</string></property></widget></item><item><widget class="QPushButton" name="pushButton_8"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>?
/</string></property></widget></item><item><widget class="QPushButton" name="ButtonTop"><property name="minimumSize"><size><width>163</width><height>50</height></size></property><property name="maximumSize"><size><width>163</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>↑</string></property></widget></item></layout></item><item row="5" column="0"><layout class="QHBoxLayout" name="horizontalLayout_17"><property name="spacing"><number>6</number></property><property name="bottomMargin"><number>0</number></property><item><widget class="QPushButton" name="Button_ctrl"><property name="minimumSize"><size><width>70</width><height>50</height></size></property><property name="maximumSize"><size><width>70</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>CTRL</string></property><property name="checkable"><bool>true</bool></property></widget></item><item><widget class="QPushButton" name="Button_win"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="maximumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>WIN</string></property><property name="checkable"><bool>true</bool></property></widget></item><item><widget class="QPushButton" name="Button_alt"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="maximumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>ALT</string></property><property name="checkable"><bool>true</bool></property></widget></item><item><widget class="QPushButton" name="Button_space"><property name="minimumSize"><size><width>500</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>SPACE</string></property></widget></item><item><widget class="QPushButton" name="ButtonLeft"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="maximumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>←</string></property></widget></item><item><widget class="QPushButton" name="ButtonBottom"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="maximumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>↓</string></property></widget></item><item><widget class="QPushButton" name="ButtonRight"><property name="minimumSize"><size><width>50</width><height>50</height></size></property><property name="maximumSize"><size><width>50</width><height>50</height></size></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>→</string></property></widget></item></layout></item></layout></widget></item></layout></widget><layoutdefault spacing="6" margin="11"/><resources/><connections/>
</ui>

好了,直接干吧!!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/885380.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

94.【C语言】数据结构之双向链表的初始化,尾插,打印和尾删

目录 1.双向链表 2.结构体的定义 3.示意图 3.代码示例 1.双向链表的尾插 示意图 代码 main.c List.h List.c 详细分析代码的执行过程 双向链表的初始化 2.双向链表的打印 代码 3.双向链表的尾删 1.双向链表 以一种典型的双向链表为例:带头双向循环链表(带头:带…

区块链技术入门:以太坊智能合约详解

&#x1f493; 博客主页&#xff1a;瑕疵的CSDN主页 &#x1f4dd; Gitee主页&#xff1a;瑕疵的gitee主页 ⏩ 文章专栏&#xff1a;《热点资讯》 区块链技术入门&#xff1a;以太坊智能合约详解 区块链技术入门&#xff1a;以太坊智能合约详解 区块链技术入门&#xff1a;以太…

Mybatis Plus 集成 PgSQL 指南

“哲学家们只是用不同的方式解释世界&#xff0c;而问题在于改变世界。” ——卡尔马克思 (Karl Marx) 解读&#xff1a;马克思强调了实践的重要性&#xff0c;主张哲学不仅要理解世界&#xff0c;更要致力于改造世界。 本文我们引入 Mybatis Plus 作为 ORM &#xff0c;并且使…

苍穹外卖day09超出配送范围前端不提示问题

同学们在写苍穹外卖项目day09时调用了百度地图api来判断用户地址是否超出配送范围&#xff0c; 但是在黑马官方的课程或资料中&#xff0c;出现这样的问题时只会向用户端的控制台报错并不会提醒用户 如下图&#xff1a; 解决方法&#xff1a; 其实解决方法很简单只需要找到向…

【Linux系列】命令行中的文本处理:从中划线到下划线与大写转换

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…

【详细实用のMyBatis教程】获取参数值和结果的各种情况、自定义映射、动态SQL、多级缓存、逆向工程、分页插件

文章目录 一、MyBatis介绍1、MyBatis简介2、MyBatis特性3、和其它持久化层技术对比 二、搭建MyBatis基本步骤1、创建Maven工程2、添加log4j2的配置文件3、创建MyBatis的核心配置文件4、创建Mapper接口5、创建MyBatis映射文件&#xff08;增删改查&#xff09;6、创建Junit测试功…

推动企业数字化转型的三驾马车:DataOps与DevOps、MLOps的关系及其重要性

在当今快速发展的技术领域&#xff0c;DevOps、DataOps和MLOps成为了推动企业数字化转型的三大核心实践。它们各自关注不同的领域&#xff0c;但又相互关联&#xff0c;共同推动着软件和数据的高效开发与运营。 DevOps&#xff1a;软件开发的加速器 DevOps是一种将开发&#…

下载 AndroidStudio 旧版本方法

1.打开官网&#xff1a; 点击Read release notes 然后就是各个历史版本了&#xff1a; 直接点链接好像也行&#xff1a;https://developer.android.com/studio/archive

ONLYOFFICE 8.2深度测评:集成PDF编辑、数据可视化与AI功能的强大办公套件

本文 一、文档编辑与PDF支持主要功能概述 二、数据可视化和增强的表格工具数据可视化功能亮点 三、AI驱动的摘要功能AI摘要功能优势 四、演示文稿的增强功能主要更新 五、协同办公能力的提升协同功能更新 六、跨平台兼容与开放文档格式跨平台与兼容性 七、安全性与隐私保护安全…

彻底理解ARXML中的PDU

文章目录 一、DBC报文信号的发送二、ARXML报文信号的发送2.1 什么是PDU2.2 PDU的类型2.3 Container-I-PDU的发送 三、小结 在CANFD支持可变速率和更大的数据长度&#xff08;64字节&#xff09;的情况下&#xff0c;可以使用DBC和ARXML两种数据库格式来进行报文通信&#xff0c…

el-scrollbar 动态更新内容 鼠标滚轮无效

有以下功能逻辑&#xff0c;实现了一个时间轴组件&#xff0c;点击、-号后像地图那样放大组件以显示不同的UI。 默认显示年月&#xff1a; 当点击一下加号时切换为年&#xff1a; 当点击减号时切换为日&#xff1a; 即加号、减号点击就是在年月日显示进行切换。给Scrollvie…

LED点阵显示(Proteus 与Keil uVision联合仿真)(点阵字模提取)

点阵字模提取&#xff1a; https://pan.baidu.com/s/1DZSeLyD_SUkaHRgTm26o-A 提取码: 1111 一、LED点阵显示器结构 点亮点阵中一个发光二极管条件&#xff1a;对应行为高电平&#xff0c;对应列为低电平。如在很短时间内依次点亮很多个发光二极管&#xff0c;LED点阵就可显示…

.NET中通过C#实现Excel与DataTable的数据互转

在.NET框架中&#xff0c;使用C#进行Excel数据与DataTable之间的转换是数据分析、报表生成、数据迁移等操作中的常见需求。这一过程涉及到将Excel文件中的数据读取并加载至DataTable中&#xff0c;以便于利用.NET提供的丰富数据处理功能进行操作&#xff0c;同时也包括将DataTa…

「Mac畅玩鸿蒙与硬件29」UI互动应用篇6 - 多选问卷小应用

本篇将带你实现一个多选问卷小应用&#xff0c;用户可以勾选选项并点击提交按钮查看选择的结果。通过本教程&#xff0c;你将学习如何使用 Checkbox 组件、动态渲染列表、状态管理及用户交互&#xff0c;构建完整的应用程序。 关键词 UI互动应用Checkbox 组件状态管理动态列表…

Java 并发编程学习笔记

参考资料&#xff1a; JAVA并发专题 - 终有救赎的专栏 - 掘金 Java并发编程学习路线&#xff08;建议收藏&#xfffd;&#xfffd;&#xff09; | Java程序员进阶之路x沉默王二 面试题目&#xff1a; JUC第一讲&#xff1a;Java并发知识体系详解 面试题汇总(P6熟练 P7精通…

【Linux系统】—— 基本指令(二)

【Linux系统】—— 基本指令&#xff08;二&#xff09; 1 「alias」命令1.1 「ll」命令1.2 「alias」命令 2 「rmdir」指令与「rm」指令2.1 「rmdir」2.2 「rm」2.2.1 「rm」 删除普通文件2.2.2 「rm」 删除目录2.2.3 『 * 』 通配符 3 「man」 指令4 「cp」 指令4.1 拷贝普通…

Pytorch cuda版本选择(高效简洁版)

简而言之 Pytorch cuda版本选择 只需要低于cuda驱动版本即可&#xff0c;cuda驱动版本查看命令是nvidia-smi, nvcc -V 是runtimeapi版本可以不用管 1.只要看cuda驱动版本 安装pytorch 选择cuda版本&#xff0c;只要看你电脑cuda驱动版本即可。 2.选择依据 pytorch中cuda版本只…

Flink API 的层次结构

Apache Flink 提供了多层 API&#xff0c;每层 API 针对不同的抽象层次和用途&#xff0c;使得开发者可以根据具体需求选择合适的 API 层次。以下是 Flink API 的层次结构及其简要说明&#xff1a;

GPU集群上分布式训练大模型

总结一下如何在超算系统上进行预训练大模型的分布式训练 / 微调&#xff0c;文中代码已上传至 github 实验环境 集群1&#xff1a;国家广州超算 星逸A800智能AI集群 GPU&#xff1a;8 * Nvdia Tesla-A800 80G显存 CPU&#xff1a;2 * 28核 Intel Xeon Gold 6348 内存&#xff…

python爬虫自动库DrissionPage保存网页快照mhtml/pdf/全局截图/打印机另存pdf

目录 零一、保存网页快照的三种方法二、利用打印机保存pdf的方法 零 最近星球有人问如何使用页面打印功能&#xff0c;另存为pdf 一、保存网页快照的三种方法 解决方案已经放在星球内&#xff1a;https://articles.zsxq.com/id_55mr53xahr9a.html当然也可以看如下代码&…