meilleur résolution et meilleur clavier
This commit is contained in:
parent
2bbae40800
commit
28054f494a
@ -57,7 +57,7 @@ QtView::QtView(QWidget* parent)
|
|||||||
setupUI();
|
setupUI();
|
||||||
setupVirtualKeyboard();
|
setupVirtualKeyboard();
|
||||||
setWindowTitle("Gestionnaire de Stock - Interface Moderne");
|
setWindowTitle("Gestionnaire de Stock - Interface Moderne");
|
||||||
resize(1200, 800);
|
showFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
QtView::QtView(StockController* controller, QWidget* parent)
|
QtView::QtView(StockController* controller, QWidget* parent)
|
||||||
|
@ -10,6 +10,7 @@ VirtualKeyboard::VirtualKeyboard(QWidget* parent)
|
|||||||
, m_mainLayout(nullptr)
|
, m_mainLayout(nullptr)
|
||||||
, m_keyboardLayout(nullptr)
|
, m_keyboardLayout(nullptr)
|
||||||
, m_functionLayout(nullptr)
|
, m_functionLayout(nullptr)
|
||||||
|
, m_displayEdit(nullptr)
|
||||||
, m_targetWidget(nullptr)
|
, m_targetWidget(nullptr)
|
||||||
, m_capsLock(false)
|
, m_capsLock(false)
|
||||||
, m_shift(false)
|
, m_shift(false)
|
||||||
@ -20,7 +21,7 @@ VirtualKeyboard::VirtualKeyboard(QWidget* parent)
|
|||||||
, m_capsLockButton(nullptr)
|
, m_capsLockButton(nullptr)
|
||||||
, m_hideButton(nullptr)
|
, m_hideButton(nullptr)
|
||||||
{
|
{
|
||||||
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
|
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
|
||||||
setAttribute(Qt::WA_ShowWithoutActivating);
|
setAttribute(Qt::WA_ShowWithoutActivating);
|
||||||
|
|
||||||
// Initialize key layouts
|
// Initialize key layouts
|
||||||
@ -48,8 +49,17 @@ void VirtualKeyboard::setTargetWidget(QWidget* target)
|
|||||||
void VirtualKeyboard::showForWidget(QWidget* target)
|
void VirtualKeyboard::showForWidget(QWidget* target)
|
||||||
{
|
{
|
||||||
setTargetWidget(target);
|
setTargetWidget(target);
|
||||||
positionKeyboard();
|
|
||||||
show();
|
// Initialiser la zone d'affichage avec le contenu actuel
|
||||||
|
if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(target)) {
|
||||||
|
m_displayEdit->setText(lineEdit->text());
|
||||||
|
} else if (QTextEdit* textEdit = qobject_cast<QTextEdit*>(target)) {
|
||||||
|
m_displayEdit->setText(textEdit->toPlainText());
|
||||||
|
} else {
|
||||||
|
m_displayEdit->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
showFullScreen();
|
||||||
raise();
|
raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,22 +67,23 @@ void VirtualKeyboard::hideKeyboard()
|
|||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
m_targetWidget = nullptr;
|
m_targetWidget = nullptr;
|
||||||
|
m_displayEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboard::setupKeyboard()
|
void VirtualKeyboard::setupKeyboard()
|
||||||
{
|
{
|
||||||
m_mainLayout = new QVBoxLayout(this);
|
m_mainLayout = new QVBoxLayout(this);
|
||||||
m_mainLayout->setSpacing(5);
|
m_mainLayout->setSpacing(20);
|
||||||
m_mainLayout->setContentsMargins(10, 10, 10, 10);
|
m_mainLayout->setContentsMargins(50, 50, 50, 50);
|
||||||
|
|
||||||
// Header with title and hide button
|
// Header with title and hide button
|
||||||
QHBoxLayout* headerLayout = new QHBoxLayout();
|
QHBoxLayout* headerLayout = new QHBoxLayout();
|
||||||
QLabel* titleLabel = new QLabel("Clavier Virtuel");
|
QLabel* titleLabel = new QLabel("Clavier Virtuel");
|
||||||
titleLabel->setObjectName("keyboardTitle");
|
titleLabel->setObjectName("keyboardTitle");
|
||||||
|
|
||||||
m_hideButton = new QPushButton("✕");
|
m_hideButton = new QPushButton("✕ Fermer");
|
||||||
m_hideButton->setObjectName("hideButton");
|
m_hideButton->setObjectName("hideButton");
|
||||||
m_hideButton->setFixedSize(30, 30);
|
m_hideButton->setFixedSize(120, 50);
|
||||||
connect(m_hideButton, &QPushButton::clicked, this, &VirtualKeyboard::hideKeyboard);
|
connect(m_hideButton, &QPushButton::clicked, this, &VirtualKeyboard::hideKeyboard);
|
||||||
|
|
||||||
headerLayout->addWidget(titleLabel);
|
headerLayout->addWidget(titleLabel);
|
||||||
@ -81,6 +92,17 @@ void VirtualKeyboard::setupKeyboard()
|
|||||||
|
|
||||||
m_mainLayout->addLayout(headerLayout);
|
m_mainLayout->addLayout(headerLayout);
|
||||||
|
|
||||||
|
// Zone d'affichage du texte en cours de saisie
|
||||||
|
m_displayEdit = new QLineEdit();
|
||||||
|
m_displayEdit->setObjectName("displayEdit");
|
||||||
|
m_displayEdit->setReadOnly(true);
|
||||||
|
m_displayEdit->setFixedHeight(60);
|
||||||
|
m_displayEdit->setPlaceholderText("Le texte saisi apparaîtra ici...");
|
||||||
|
m_mainLayout->addWidget(m_displayEdit);
|
||||||
|
|
||||||
|
// Add spacer to center keyboard
|
||||||
|
m_mainLayout->addStretch(1);
|
||||||
|
|
||||||
// Numeric row
|
// Numeric row
|
||||||
setupNumericKeys();
|
setupNumericKeys();
|
||||||
|
|
||||||
@ -89,17 +111,21 @@ void VirtualKeyboard::setupKeyboard()
|
|||||||
|
|
||||||
// Function keys row
|
// Function keys row
|
||||||
setupFunctionKeys();
|
setupFunctionKeys();
|
||||||
|
|
||||||
|
// Add spacer to center keyboard
|
||||||
|
m_mainLayout->addStretch(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboard::setupNumericKeys()
|
void VirtualKeyboard::setupNumericKeys()
|
||||||
{
|
{
|
||||||
QHBoxLayout* numericLayout = new QHBoxLayout();
|
QHBoxLayout* numericLayout = new QHBoxLayout();
|
||||||
numericLayout->setSpacing(3);
|
numericLayout->setSpacing(10);
|
||||||
|
numericLayout->addStretch(); // Centrer les touches
|
||||||
|
|
||||||
for (const QString& key : m_numericLayout) {
|
for (const QString& key : m_numericLayout) {
|
||||||
QPushButton* button = new QPushButton(key);
|
QPushButton* button = new QPushButton(key);
|
||||||
button->setObjectName("numericKey");
|
button->setObjectName("numericKey");
|
||||||
button->setFixedSize(45, 45);
|
button->setFixedSize(80, 80);
|
||||||
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
||||||
m_numericKeys.append(button);
|
m_numericKeys.append(button);
|
||||||
numericLayout->addWidget(button);
|
numericLayout->addWidget(button);
|
||||||
@ -110,11 +136,12 @@ void VirtualKeyboard::setupNumericKeys()
|
|||||||
for (const QString& key : specialChars) {
|
for (const QString& key : specialChars) {
|
||||||
QPushButton* button = new QPushButton(key);
|
QPushButton* button = new QPushButton(key);
|
||||||
button->setObjectName("specialKey");
|
button->setObjectName("specialKey");
|
||||||
button->setFixedSize(45, 45);
|
button->setFixedSize(80, 80);
|
||||||
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
||||||
numericLayout->addWidget(button);
|
numericLayout->addWidget(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numericLayout->addStretch(); // Centrer les touches
|
||||||
m_mainLayout->addLayout(numericLayout);
|
m_mainLayout->addLayout(numericLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,43 +149,47 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
|||||||
{
|
{
|
||||||
// First row: QWERTYUIOP
|
// First row: QWERTYUIOP
|
||||||
QHBoxLayout* firstRow = new QHBoxLayout();
|
QHBoxLayout* firstRow = new QHBoxLayout();
|
||||||
firstRow->setSpacing(3);
|
firstRow->setSpacing(10);
|
||||||
|
firstRow->addStretch();
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
QPushButton* button = new QPushButton(m_qwertyLayout[i]);
|
QPushButton* button = new QPushButton(m_qwertyLayout[i]);
|
||||||
button->setObjectName("alphabeticKey");
|
button->setObjectName("alphabeticKey");
|
||||||
button->setFixedSize(45, 45);
|
button->setFixedSize(80, 80);
|
||||||
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
||||||
m_alphabeticKeys.append(button);
|
m_alphabeticKeys.append(button);
|
||||||
firstRow->addWidget(button);
|
firstRow->addWidget(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstRow->addStretch();
|
||||||
m_mainLayout->addLayout(firstRow);
|
m_mainLayout->addLayout(firstRow);
|
||||||
|
|
||||||
// Second row: ASDFGHJKL
|
// Second row: ASDFGHJKL
|
||||||
QHBoxLayout* secondRow = new QHBoxLayout();
|
QHBoxLayout* secondRow = new QHBoxLayout();
|
||||||
secondRow->setSpacing(3);
|
secondRow->setSpacing(10);
|
||||||
secondRow->addSpacing(20); // Slight offset
|
secondRow->addStretch();
|
||||||
|
|
||||||
for (int i = 10; i < 19; ++i) {
|
for (int i = 10; i < 19; ++i) {
|
||||||
QPushButton* button = new QPushButton(m_qwertyLayout[i]);
|
QPushButton* button = new QPushButton(m_qwertyLayout[i]);
|
||||||
button->setObjectName("alphabeticKey");
|
button->setObjectName("alphabeticKey");
|
||||||
button->setFixedSize(45, 45);
|
button->setFixedSize(80, 80);
|
||||||
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
||||||
m_alphabeticKeys.append(button);
|
m_alphabeticKeys.append(button);
|
||||||
secondRow->addWidget(button);
|
secondRow->addWidget(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
secondRow->addStretch();
|
||||||
m_mainLayout->addLayout(secondRow);
|
m_mainLayout->addLayout(secondRow);
|
||||||
|
|
||||||
// Third row: ZXCVBNM
|
// Third row: ZXCVBNM
|
||||||
QHBoxLayout* thirdRow = new QHBoxLayout();
|
QHBoxLayout* thirdRow = new QHBoxLayout();
|
||||||
thirdRow->setSpacing(3);
|
thirdRow->setSpacing(10);
|
||||||
|
thirdRow->addStretch();
|
||||||
|
|
||||||
// Shift button
|
// Shift button
|
||||||
m_shiftButton = new QPushButton("⇧");
|
m_shiftButton = new QPushButton("⇧");
|
||||||
m_shiftButton->setObjectName("functionKey");
|
m_shiftButton->setObjectName("functionKey");
|
||||||
m_shiftButton->setFixedSize(60, 45);
|
m_shiftButton->setFixedSize(100, 80);
|
||||||
m_shiftButton->setCheckable(true);
|
m_shiftButton->setCheckable(true);
|
||||||
connect(m_shiftButton, &QPushButton::clicked, this, &VirtualKeyboard::onShiftPressed);
|
connect(m_shiftButton, &QPushButton::clicked, this, &VirtualKeyboard::onShiftPressed);
|
||||||
thirdRow->addWidget(m_shiftButton);
|
thirdRow->addWidget(m_shiftButton);
|
||||||
@ -166,7 +197,7 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
|||||||
for (int i = 19; i < 26; ++i) {
|
for (int i = 19; i < 26; ++i) {
|
||||||
QPushButton* button = new QPushButton(m_qwertyLayout[i]);
|
QPushButton* button = new QPushButton(m_qwertyLayout[i]);
|
||||||
button->setObjectName("alphabeticKey");
|
button->setObjectName("alphabeticKey");
|
||||||
button->setFixedSize(45, 45);
|
button->setFixedSize(80, 80);
|
||||||
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
||||||
m_alphabeticKeys.append(button);
|
m_alphabeticKeys.append(button);
|
||||||
thirdRow->addWidget(button);
|
thirdRow->addWidget(button);
|
||||||
@ -175,22 +206,24 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
|||||||
// Backspace button
|
// Backspace button
|
||||||
m_backspaceButton = new QPushButton("⌫");
|
m_backspaceButton = new QPushButton("⌫");
|
||||||
m_backspaceButton->setObjectName("functionKey");
|
m_backspaceButton->setObjectName("functionKey");
|
||||||
m_backspaceButton->setFixedSize(60, 45);
|
m_backspaceButton->setFixedSize(100, 80);
|
||||||
connect(m_backspaceButton, &QPushButton::clicked, this, &VirtualKeyboard::onBackspacePressed);
|
connect(m_backspaceButton, &QPushButton::clicked, this, &VirtualKeyboard::onBackspacePressed);
|
||||||
thirdRow->addWidget(m_backspaceButton);
|
thirdRow->addWidget(m_backspaceButton);
|
||||||
|
|
||||||
|
thirdRow->addStretch();
|
||||||
m_mainLayout->addLayout(thirdRow);
|
m_mainLayout->addLayout(thirdRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboard::setupFunctionKeys()
|
void VirtualKeyboard::setupFunctionKeys()
|
||||||
{
|
{
|
||||||
m_functionLayout = new QHBoxLayout();
|
m_functionLayout = new QHBoxLayout();
|
||||||
m_functionLayout->setSpacing(5);
|
m_functionLayout->setSpacing(15);
|
||||||
|
m_functionLayout->addStretch();
|
||||||
|
|
||||||
// Caps Lock
|
// Caps Lock
|
||||||
m_capsLockButton = new QPushButton("Caps");
|
m_capsLockButton = new QPushButton("Caps");
|
||||||
m_capsLockButton->setObjectName("functionKey");
|
m_capsLockButton->setObjectName("functionKey");
|
||||||
m_capsLockButton->setFixedSize(60, 45);
|
m_capsLockButton->setFixedSize(120, 80);
|
||||||
m_capsLockButton->setCheckable(true);
|
m_capsLockButton->setCheckable(true);
|
||||||
connect(m_capsLockButton, &QPushButton::clicked, this, &VirtualKeyboard::onCapsLockPressed);
|
connect(m_capsLockButton, &QPushButton::clicked, this, &VirtualKeyboard::onCapsLockPressed);
|
||||||
m_functionLayout->addWidget(m_capsLockButton);
|
m_functionLayout->addWidget(m_capsLockButton);
|
||||||
@ -198,14 +231,14 @@ void VirtualKeyboard::setupFunctionKeys()
|
|||||||
// Space bar
|
// Space bar
|
||||||
m_spaceButton = new QPushButton("Espace");
|
m_spaceButton = new QPushButton("Espace");
|
||||||
m_spaceButton->setObjectName("spaceKey");
|
m_spaceButton->setObjectName("spaceKey");
|
||||||
m_spaceButton->setFixedHeight(45);
|
m_spaceButton->setFixedSize(400, 80);
|
||||||
connect(m_spaceButton, &QPushButton::clicked, this, &VirtualKeyboard::onSpacePressed);
|
connect(m_spaceButton, &QPushButton::clicked, this, &VirtualKeyboard::onSpacePressed);
|
||||||
m_functionLayout->addWidget(m_spaceButton);
|
m_functionLayout->addWidget(m_spaceButton);
|
||||||
|
|
||||||
// Enter
|
// Enter
|
||||||
m_enterButton = new QPushButton("↵");
|
m_enterButton = new QPushButton("↵");
|
||||||
m_enterButton->setObjectName("functionKey");
|
m_enterButton->setObjectName("functionKey");
|
||||||
m_enterButton->setFixedSize(60, 45);
|
m_enterButton->setFixedSize(120, 80);
|
||||||
connect(m_enterButton, &QPushButton::clicked, this, &VirtualKeyboard::onEnterPressed);
|
connect(m_enterButton, &QPushButton::clicked, this, &VirtualKeyboard::onEnterPressed);
|
||||||
m_functionLayout->addWidget(m_enterButton);
|
m_functionLayout->addWidget(m_enterButton);
|
||||||
|
|
||||||
@ -214,11 +247,12 @@ void VirtualKeyboard::setupFunctionKeys()
|
|||||||
for (const QString& key : punctuation) {
|
for (const QString& key : punctuation) {
|
||||||
QPushButton* button = new QPushButton(key);
|
QPushButton* button = new QPushButton(key);
|
||||||
button->setObjectName("punctuationKey");
|
button->setObjectName("punctuationKey");
|
||||||
button->setFixedSize(40, 45);
|
button->setFixedSize(80, 80);
|
||||||
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
||||||
m_functionLayout->addWidget(button);
|
m_functionLayout->addWidget(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_functionLayout->addStretch();
|
||||||
m_mainLayout->addLayout(m_functionLayout);
|
m_mainLayout->addLayout(m_functionLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,24 +260,34 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
{
|
{
|
||||||
setStyleSheet(R"(
|
setStyleSheet(R"(
|
||||||
VirtualKeyboard {
|
VirtualKeyboard {
|
||||||
background-color: #2c3e50;
|
background-color: rgba(44, 62, 80, 0.95);
|
||||||
border: 2px solid #34495e;
|
border: 3px solid #34495e;
|
||||||
border-radius: 10px;
|
border-radius: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#keyboardTitle {
|
#keyboardTitle {
|
||||||
color: #ecf0f1;
|
color: #ecf0f1;
|
||||||
font-size: 14px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 5px;
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#displayEdit {
|
||||||
|
background-color: #34495e;
|
||||||
|
color: #ecf0f1;
|
||||||
|
border: 2px solid #5d6d7e;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 10px;
|
||||||
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
#hideButton {
|
#hideButton {
|
||||||
background-color: #e74c3c;
|
background-color: #e74c3c;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 15px;
|
border-radius: 25px;
|
||||||
font-size: 12px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,9 +302,9 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
#alphabeticKey, #numericKey {
|
#alphabeticKey, #numericKey {
|
||||||
background-color: #34495e;
|
background-color: #34495e;
|
||||||
color: #ecf0f1;
|
color: #ecf0f1;
|
||||||
border: 1px solid #5d6d7e;
|
border: 2px solid #5d6d7e;
|
||||||
border-radius: 6px;
|
border-radius: 12px;
|
||||||
font-size: 13px;
|
font-size: 20px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,15 +319,14 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
#functionKey {
|
#functionKey {
|
||||||
background-color: #e67e22;
|
background-color: #e67e22;
|
||||||
color: white;
|
color: white;
|
||||||
border: 1px solid #d68910;
|
border: 2px solid #d68910;
|
||||||
border-radius: 6px;
|
border-radius: 12px;
|
||||||
font-size: 12px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
#functionKey:hover {
|
#functionKey:hover {
|
||||||
background-color: #f39c12;
|
background-color: #f39c12;
|
||||||
}
|
|
||||||
|
|
||||||
#functionKey:pressed, #functionKey:checked {
|
#functionKey:pressed, #functionKey:checked {
|
||||||
background-color: #d35400;
|
background-color: #d35400;
|
||||||
@ -292,9 +335,9 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
#spaceKey {
|
#spaceKey {
|
||||||
background-color: #27ae60;
|
background-color: #27ae60;
|
||||||
color: white;
|
color: white;
|
||||||
border: 1px solid #229954;
|
border: 2px solid #229954;
|
||||||
border-radius: 6px;
|
border-radius: 12px;
|
||||||
font-size: 12px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,9 +352,9 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
#specialKey, #punctuationKey {
|
#specialKey, #punctuationKey {
|
||||||
background-color: #8e44ad;
|
background-color: #8e44ad;
|
||||||
color: white;
|
color: white;
|
||||||
border: 1px solid #7d3c98;
|
border: 2px solid #7d3c98;
|
||||||
border-radius: 6px;
|
border-radius: 12px;
|
||||||
font-size: 11px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,8 +391,12 @@ void VirtualKeyboard::insertTextToTarget(const QString& text)
|
|||||||
|
|
||||||
if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(m_targetWidget)) {
|
if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(m_targetWidget)) {
|
||||||
lineEdit->insert(text);
|
lineEdit->insert(text);
|
||||||
|
// Mettre à jour la zone d'affichage
|
||||||
|
m_displayEdit->setText(lineEdit->text());
|
||||||
} else if (QTextEdit* textEdit = qobject_cast<QTextEdit*>(m_targetWidget)) {
|
} else if (QTextEdit* textEdit = qobject_cast<QTextEdit*>(m_targetWidget)) {
|
||||||
textEdit->insertPlainText(text);
|
textEdit->insertPlainText(text);
|
||||||
|
// Mettre à jour la zone d'affichage
|
||||||
|
m_displayEdit->setText(textEdit->toPlainText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +439,7 @@ void VirtualKeyboard::positionKeyboard()
|
|||||||
void VirtualKeyboard::showEvent(QShowEvent* event)
|
void VirtualKeyboard::showEvent(QShowEvent* event)
|
||||||
{
|
{
|
||||||
QWidget::showEvent(event);
|
QWidget::showEvent(event);
|
||||||
positionKeyboard();
|
// Le clavier est maintenant en plein écran, pas besoin de positionner
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboard::hideEvent(QHideEvent* event)
|
void VirtualKeyboard::hideEvent(QHideEvent* event)
|
||||||
@ -423,10 +470,14 @@ void VirtualKeyboard::onBackspacePressed()
|
|||||||
|
|
||||||
if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(m_targetWidget)) {
|
if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(m_targetWidget)) {
|
||||||
lineEdit->backspace();
|
lineEdit->backspace();
|
||||||
|
// Mettre à jour la zone d'affichage
|
||||||
|
m_displayEdit->setText(lineEdit->text());
|
||||||
} else if (QTextEdit* textEdit = qobject_cast<QTextEdit*>(m_targetWidget)) {
|
} else if (QTextEdit* textEdit = qobject_cast<QTextEdit*>(m_targetWidget)) {
|
||||||
QTextCursor cursor = textEdit->textCursor();
|
QTextCursor cursor = textEdit->textCursor();
|
||||||
cursor.deletePreviousChar();
|
cursor.deletePreviousChar();
|
||||||
textEdit->setTextCursor(cursor);
|
textEdit->setTextCursor(cursor);
|
||||||
|
// Mettre à jour la zone d'affichage
|
||||||
|
m_displayEdit->setText(textEdit->toPlainText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ private:
|
|||||||
QVBoxLayout* m_mainLayout;
|
QVBoxLayout* m_mainLayout;
|
||||||
QGridLayout* m_keyboardLayout;
|
QGridLayout* m_keyboardLayout;
|
||||||
QHBoxLayout* m_functionLayout;
|
QHBoxLayout* m_functionLayout;
|
||||||
|
QLineEdit* m_displayEdit; // Zone d'affichage du texte saisi
|
||||||
|
|
||||||
QWidget* m_targetWidget;
|
QWidget* m_targetWidget;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user