plus grand bouton
This commit is contained in:
parent
28054f494a
commit
5c6b908736
@ -81,8 +81,8 @@ QtView::~QtView()
|
|||||||
void QtView::setupUI()
|
void QtView::setupUI()
|
||||||
{
|
{
|
||||||
m_mainLayout = new QVBoxLayout(this);
|
m_mainLayout = new QVBoxLayout(this);
|
||||||
m_mainLayout->setSpacing(15);
|
m_mainLayout->setSpacing(25);
|
||||||
m_mainLayout->setContentsMargins(20, 20, 20, 20);
|
m_mainLayout->setContentsMargins(30, 30, 30, 30);
|
||||||
|
|
||||||
// Header with title and control buttons
|
// Header with title and control buttons
|
||||||
QHBoxLayout* headerLayout = new QHBoxLayout();
|
QHBoxLayout* headerLayout = new QHBoxLayout();
|
||||||
@ -398,14 +398,14 @@ void QtView::applyModernStyling()
|
|||||||
setStyleSheet(R"(
|
setStyleSheet(R"(
|
||||||
QWidget {
|
QWidget {
|
||||||
font-family: 'Segoe UI', Arial, sans-serif;
|
font-family: 'Segoe UI', Arial, sans-serif;
|
||||||
font-size: 11px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#titleLabel {
|
#titleLabel {
|
||||||
font-size: 24px;
|
font-size: 32px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #2c3e50;
|
color: #2c3e50;
|
||||||
padding: 10px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mainTabWidget::pane {
|
#mainTabWidget::pane {
|
||||||
@ -421,13 +421,13 @@ void QtView::applyModernStyling()
|
|||||||
QTabBar::tab {
|
QTabBar::tab {
|
||||||
background-color: #ecf0f1;
|
background-color: #ecf0f1;
|
||||||
color: #2c3e50;
|
color: #2c3e50;
|
||||||
padding: 12px 20px;
|
padding: 18px 30px;
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
font-size: 13px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border-top-left-radius: 8px;
|
border-top-left-radius: 8px;
|
||||||
border-top-right-radius: 8px;
|
border-top-right-radius: 8px;
|
||||||
min-width: 120px;
|
min-width: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTabBar::tab:selected {
|
QTabBar::tab:selected {
|
||||||
@ -440,13 +440,13 @@ void QtView::applyModernStyling()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QGroupBox {
|
QGroupBox {
|
||||||
font-size: 14px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #2c3e50;
|
color: #2c3e50;
|
||||||
border: 2px solid #bdc3c7;
|
border: 2px solid #bdc3c7;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-top: 15px;
|
margin-top: 20px;
|
||||||
padding-top: 15px;
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGroupBox::title {
|
QGroupBox::title {
|
||||||
@ -473,11 +473,11 @@ void QtView::applyModernStyling()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QLineEdit, QSpinBox, QComboBox {
|
QLineEdit, QSpinBox, QComboBox {
|
||||||
padding: 8px 12px;
|
padding: 12px 18px;
|
||||||
border: 2px solid #bdc3c7;
|
border: 2px solid #bdc3c7;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
font-size: 12px;
|
font-size: 16px;
|
||||||
min-height: 20px;
|
min-height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineEdit:focus, QSpinBox:focus, QComboBox:focus {
|
QLineEdit:focus, QSpinBox:focus, QComboBox:focus {
|
||||||
@ -489,10 +489,11 @@ void QtView::applyModernStyling()
|
|||||||
background-color: #27ae60;
|
background-color: #27ae60;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 12px 20px;
|
padding: 18px 30px;
|
||||||
border-radius: 6px;
|
border-radius: 8px;
|
||||||
font-size: 13px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
min-height: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#createButton:hover {
|
#createButton:hover {
|
||||||
@ -507,10 +508,11 @@ void QtView::applyModernStyling()
|
|||||||
background-color: #e74c3c;
|
background-color: #e74c3c;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 12px 20px;
|
padding: 18px 30px;
|
||||||
border-radius: 6px;
|
border-radius: 8px;
|
||||||
font-size: 13px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
min-height: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#deleteButton:hover {
|
#deleteButton:hover {
|
||||||
@ -525,10 +527,11 @@ void QtView::applyModernStyling()
|
|||||||
background-color: #3498db;
|
background-color: #3498db;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 12px 20px;
|
padding: 18px 30px;
|
||||||
border-radius: 6px;
|
border-radius: 8px;
|
||||||
font-size: 13px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
min-height: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#showButton:hover {
|
#showButton:hover {
|
||||||
@ -543,10 +546,11 @@ void QtView::applyModernStyling()
|
|||||||
background-color: #f39c12;
|
background-color: #f39c12;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 12px 20px;
|
padding: 18px 30px;
|
||||||
border-radius: 6px;
|
border-radius: 8px;
|
||||||
font-size: 13px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
min-height: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#moveButton:hover {
|
#moveButton:hover {
|
||||||
@ -561,10 +565,11 @@ void QtView::applyModernStyling()
|
|||||||
background-color: #17a2b8;
|
background-color: #17a2b8;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 8px 16px;
|
padding: 15px 25px;
|
||||||
border-radius: 6px;
|
border-radius: 8px;
|
||||||
font-size: 12px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
min-height: 45px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#refreshButton:hover {
|
#refreshButton:hover {
|
||||||
@ -575,10 +580,11 @@ void QtView::applyModernStyling()
|
|||||||
background-color: #6c757d;
|
background-color: #6c757d;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 8px 16px;
|
padding: 15px 25px;
|
||||||
border-radius: 6px;
|
border-radius: 8px;
|
||||||
font-size: 12px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
min-height: 45px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#exitButton:hover {
|
#exitButton:hover {
|
||||||
@ -587,12 +593,12 @@ void QtView::applyModernStyling()
|
|||||||
|
|
||||||
#outputDisplay {
|
#outputDisplay {
|
||||||
font-family: 'Consolas', 'Monaco', monospace;
|
font-family: 'Consolas', 'Monaco', monospace;
|
||||||
font-size: 11px;
|
font-size: 14px;
|
||||||
background-color: #f8f9fa;
|
background-color: #f8f9fa;
|
||||||
border: 2px solid #dee2e6;
|
border: 2px solid #dee2e6;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 12px;
|
padding: 15px;
|
||||||
line-height: 1.4;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLabel {
|
QLabel {
|
||||||
@ -1001,7 +1007,8 @@ void QtView::onExit()
|
|||||||
|
|
||||||
void QtView::setupVirtualKeyboard()
|
void QtView::setupVirtualKeyboard()
|
||||||
{
|
{
|
||||||
m_virtualKeyboard = new VirtualKeyboard();
|
m_virtualKeyboard = new VirtualKeyboard(this); // Passer 'this' comme parent
|
||||||
|
m_virtualKeyboard->hide(); // Le cacher initialement
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtView::connectTextFieldEvents()
|
void QtView::connectTextFieldEvents()
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
#include <QHideEvent>
|
#include <QHideEvent>
|
||||||
|
#include <QResizeEvent>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#include <QPalette>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
|
||||||
VirtualKeyboard::VirtualKeyboard(QWidget* parent)
|
VirtualKeyboard::VirtualKeyboard(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@ -21,8 +25,9 @@ VirtualKeyboard::VirtualKeyboard(QWidget* parent)
|
|||||||
, m_capsLockButton(nullptr)
|
, m_capsLockButton(nullptr)
|
||||||
, m_hideButton(nullptr)
|
, m_hideButton(nullptr)
|
||||||
{
|
{
|
||||||
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
|
// Ne pas créer de fenêtre séparée, utiliser le parent
|
||||||
setAttribute(Qt::WA_ShowWithoutActivating);
|
setAttribute(Qt::WA_ShowWithoutActivating);
|
||||||
|
setAutoFillBackground(true); // Permettre le fond personnalisé
|
||||||
|
|
||||||
// Initialize key layouts
|
// Initialize key layouts
|
||||||
m_qwertyLayout << "q" << "w" << "e" << "r" << "t" << "y" << "u" << "i" << "o" << "p"
|
m_qwertyLayout << "q" << "w" << "e" << "r" << "t" << "y" << "u" << "i" << "o" << "p"
|
||||||
@ -59,7 +64,12 @@ void VirtualKeyboard::showForWidget(QWidget* target)
|
|||||||
m_displayEdit->clear();
|
m_displayEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
showFullScreen();
|
// Positionner le clavier comme overlay sur l'application parent
|
||||||
|
if (parentWidget()) {
|
||||||
|
setGeometry(parentWidget()->rect());
|
||||||
|
}
|
||||||
|
|
||||||
|
show();
|
||||||
raise();
|
raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +93,7 @@ void VirtualKeyboard::setupKeyboard()
|
|||||||
|
|
||||||
m_hideButton = new QPushButton("✕ Fermer");
|
m_hideButton = new QPushButton("✕ Fermer");
|
||||||
m_hideButton->setObjectName("hideButton");
|
m_hideButton->setObjectName("hideButton");
|
||||||
m_hideButton->setFixedSize(120, 50);
|
m_hideButton->setFixedSize(180, 70);
|
||||||
connect(m_hideButton, &QPushButton::clicked, this, &VirtualKeyboard::hideKeyboard);
|
connect(m_hideButton, &QPushButton::clicked, this, &VirtualKeyboard::hideKeyboard);
|
||||||
|
|
||||||
headerLayout->addWidget(titleLabel);
|
headerLayout->addWidget(titleLabel);
|
||||||
@ -96,7 +106,7 @@ void VirtualKeyboard::setupKeyboard()
|
|||||||
m_displayEdit = new QLineEdit();
|
m_displayEdit = new QLineEdit();
|
||||||
m_displayEdit->setObjectName("displayEdit");
|
m_displayEdit->setObjectName("displayEdit");
|
||||||
m_displayEdit->setReadOnly(true);
|
m_displayEdit->setReadOnly(true);
|
||||||
m_displayEdit->setFixedHeight(60);
|
m_displayEdit->setFixedHeight(80);
|
||||||
m_displayEdit->setPlaceholderText("Le texte saisi apparaîtra ici...");
|
m_displayEdit->setPlaceholderText("Le texte saisi apparaîtra ici...");
|
||||||
m_mainLayout->addWidget(m_displayEdit);
|
m_mainLayout->addWidget(m_displayEdit);
|
||||||
|
|
||||||
@ -119,13 +129,13 @@ void VirtualKeyboard::setupKeyboard()
|
|||||||
void VirtualKeyboard::setupNumericKeys()
|
void VirtualKeyboard::setupNumericKeys()
|
||||||
{
|
{
|
||||||
QHBoxLayout* numericLayout = new QHBoxLayout();
|
QHBoxLayout* numericLayout = new QHBoxLayout();
|
||||||
numericLayout->setSpacing(10);
|
numericLayout->setSpacing(15);
|
||||||
numericLayout->addStretch(); // Centrer les touches
|
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(80, 80);
|
button->setFixedSize(100, 100);
|
||||||
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);
|
||||||
@ -136,7 +146,7 @@ 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(80, 80);
|
button->setFixedSize(100, 100);
|
||||||
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
||||||
numericLayout->addWidget(button);
|
numericLayout->addWidget(button);
|
||||||
}
|
}
|
||||||
@ -149,13 +159,13 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
|||||||
{
|
{
|
||||||
// First row: QWERTYUIOP
|
// First row: QWERTYUIOP
|
||||||
QHBoxLayout* firstRow = new QHBoxLayout();
|
QHBoxLayout* firstRow = new QHBoxLayout();
|
||||||
firstRow->setSpacing(10);
|
firstRow->setSpacing(15);
|
||||||
firstRow->addStretch();
|
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(80, 80);
|
button->setFixedSize(100, 100);
|
||||||
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);
|
||||||
@ -166,13 +176,13 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
|||||||
|
|
||||||
// Second row: ASDFGHJKL
|
// Second row: ASDFGHJKL
|
||||||
QHBoxLayout* secondRow = new QHBoxLayout();
|
QHBoxLayout* secondRow = new QHBoxLayout();
|
||||||
secondRow->setSpacing(10);
|
secondRow->setSpacing(15);
|
||||||
secondRow->addStretch();
|
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(80, 80);
|
button->setFixedSize(100, 100);
|
||||||
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);
|
||||||
@ -183,13 +193,13 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
|||||||
|
|
||||||
// Third row: ZXCVBNM
|
// Third row: ZXCVBNM
|
||||||
QHBoxLayout* thirdRow = new QHBoxLayout();
|
QHBoxLayout* thirdRow = new QHBoxLayout();
|
||||||
thirdRow->setSpacing(10);
|
thirdRow->setSpacing(15);
|
||||||
thirdRow->addStretch();
|
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(100, 80);
|
m_shiftButton->setFixedSize(120, 100);
|
||||||
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);
|
||||||
@ -197,7 +207,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(80, 80);
|
button->setFixedSize(100, 100);
|
||||||
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);
|
||||||
@ -206,7 +216,7 @@ 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(100, 80);
|
m_backspaceButton->setFixedSize(120, 100);
|
||||||
connect(m_backspaceButton, &QPushButton::clicked, this, &VirtualKeyboard::onBackspacePressed);
|
connect(m_backspaceButton, &QPushButton::clicked, this, &VirtualKeyboard::onBackspacePressed);
|
||||||
thirdRow->addWidget(m_backspaceButton);
|
thirdRow->addWidget(m_backspaceButton);
|
||||||
|
|
||||||
@ -217,13 +227,13 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
|||||||
void VirtualKeyboard::setupFunctionKeys()
|
void VirtualKeyboard::setupFunctionKeys()
|
||||||
{
|
{
|
||||||
m_functionLayout = new QHBoxLayout();
|
m_functionLayout = new QHBoxLayout();
|
||||||
m_functionLayout->setSpacing(15);
|
m_functionLayout->setSpacing(20);
|
||||||
m_functionLayout->addStretch();
|
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(120, 80);
|
m_capsLockButton->setFixedSize(150, 100);
|
||||||
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);
|
||||||
@ -231,14 +241,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->setFixedSize(400, 80);
|
m_spaceButton->setFixedSize(500, 100);
|
||||||
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(120, 80);
|
m_enterButton->setFixedSize(150, 100);
|
||||||
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);
|
||||||
|
|
||||||
@ -247,7 +257,7 @@ 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(80, 80);
|
button->setFixedSize(100, 100);
|
||||||
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
connect(button, &QPushButton::clicked, this, &VirtualKeyboard::onKeyPressed);
|
||||||
m_functionLayout->addWidget(button);
|
m_functionLayout->addWidget(button);
|
||||||
}
|
}
|
||||||
@ -258,18 +268,18 @@ void VirtualKeyboard::setupFunctionKeys()
|
|||||||
|
|
||||||
void VirtualKeyboard::applyKeyboardStyling()
|
void VirtualKeyboard::applyKeyboardStyling()
|
||||||
{
|
{
|
||||||
|
// Utiliser une palette pour le fond au lieu du stylesheet
|
||||||
|
QPalette palette = this->palette();
|
||||||
|
palette.setColor(QPalette::Window, QColor(44, 62, 80, 250));
|
||||||
|
setPalette(palette);
|
||||||
|
|
||||||
setStyleSheet(R"(
|
setStyleSheet(R"(
|
||||||
VirtualKeyboard {
|
|
||||||
background-color: rgba(44, 62, 80, 0.95);
|
|
||||||
border: 3px solid #34495e;
|
|
||||||
border-radius: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#keyboardTitle {
|
#keyboardTitle {
|
||||||
color: #ecf0f1;
|
color: #ecf0f1;
|
||||||
font-size: 24px;
|
font-size: 28px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 10px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#displayEdit {
|
#displayEdit {
|
||||||
@ -277,8 +287,8 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
color: #ecf0f1;
|
color: #ecf0f1;
|
||||||
border: 2px solid #5d6d7e;
|
border: 2px solid #5d6d7e;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
font-size: 18px;
|
font-size: 22px;
|
||||||
padding: 10px;
|
padding: 15px;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +297,7 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 25px;
|
border-radius: 25px;
|
||||||
font-size: 16px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +314,7 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
color: #ecf0f1;
|
color: #ecf0f1;
|
||||||
border: 2px solid #5d6d7e;
|
border: 2px solid #5d6d7e;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
font-size: 20px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +331,7 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
color: white;
|
color: white;
|
||||||
border: 2px solid #d68910;
|
border: 2px solid #d68910;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
font-size: 16px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +347,7 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
color: white;
|
color: white;
|
||||||
border: 2px solid #229954;
|
border: 2px solid #229954;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
font-size: 18px;
|
font-size: 20px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +364,7 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
color: white;
|
color: white;
|
||||||
border: 2px solid #7d3c98;
|
border: 2px solid #7d3c98;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
font-size: 18px;
|
font-size: 20px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,6 +458,32 @@ void VirtualKeyboard::hideEvent(QHideEvent* event)
|
|||||||
m_targetWidget = nullptr;
|
m_targetWidget = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VirtualKeyboard::resizeEvent(QResizeEvent* event)
|
||||||
|
{
|
||||||
|
QWidget::resizeEvent(event);
|
||||||
|
// S'assurer que le clavier couvre toute la fenêtre parent si visible
|
||||||
|
if (isVisible() && parentWidget()) {
|
||||||
|
setGeometry(parentWidget()->rect());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VirtualKeyboard::paintEvent(QPaintEvent* event)
|
||||||
|
{
|
||||||
|
QPainter painter(this);
|
||||||
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
|
|
||||||
|
// Dessiner le fond avec transparence
|
||||||
|
QColor backgroundColor(44, 62, 80, 250);
|
||||||
|
painter.fillRect(rect(), backgroundColor);
|
||||||
|
|
||||||
|
// Dessiner la bordure
|
||||||
|
QPen borderPen(QColor(52, 73, 94), 3);
|
||||||
|
painter.setPen(borderPen);
|
||||||
|
painter.drawRoundedRect(rect().adjusted(1, 1, -1, -1), 15, 15);
|
||||||
|
|
||||||
|
QWidget::paintEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
// Slot implementations
|
// Slot implementations
|
||||||
void VirtualKeyboard::onKeyPressed()
|
void VirtualKeyboard::onKeyPressed()
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
|
class QResizeEvent;
|
||||||
|
class QPaintEvent;
|
||||||
|
|
||||||
class VirtualKeyboard : public QWidget
|
class VirtualKeyboard : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -34,6 +37,8 @@ public slots:
|
|||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
void hideEvent(QHideEvent* event) override;
|
void hideEvent(QHideEvent* event) override;
|
||||||
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
void paintEvent(QPaintEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupKeyboard();
|
void setupKeyboard();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user