| 8 | #include <utility> |
| 9 | Q_PROPERTY_CREATE_Q_CPP(ElaKeyBinder, int, BorderRadius) |
| 10 | ElaKeyBinder::ElaKeyBinder(QWidget* parent) |
| 11 | : QLabel(parent), d_ptr(new ElaKeyBinderPrivate()) |
| 12 | { |
| 13 | Q_D(ElaKeyBinder); |
| 14 | d->q_ptr = this; |
| 15 | d->_pBorderRadius = 5; |
| 16 | setFixedHeight(35); |
| 17 | setMouseTracking(true); |
| 18 | setStyleSheet("#ElaKeyBinder{background-color:transparent;}"); |
| 19 | QFont textFont = font(); |
| 20 | textFont.setLetterSpacing(QFont::AbsoluteSpacing, 0.5); |
| 21 | textFont.setPixelSize(15); |
| 22 | setFont(textFont); |
| 23 | d->_binderContainer = new ElaKeyBinderContainer(this); |
| 24 | setText(u8" 按键: " + QString(u8"未绑定") + " "); |
| 25 | d->_binderDialog = new ElaContentDialog(window()); |
| 26 | d->_binderDialog->setCentralWidget(d->_binderContainer); |
| 27 | d->_binderDialog->setLeftButtonText(u8"取消"); |
| 28 | d->_binderDialog->setMiddleButtonText(u8"重置"); |
| 29 | d->_binderDialog->setRightButtonText(u8"确认"); |
| 30 | connect(d->_binderDialog, &ElaContentDialog::middleButtonClicked, this, [=]() { |
| 31 | d->_binderContainer->logOrResetHistoryData(false); |
| 32 | }); |
| 33 | connect(d->_binderDialog, &ElaContentDialog::rightButtonClicked, this, [=]() { |
| 34 | d->_binderContainer->saveBinderChanged(); |
| 35 | }); |
| 36 | d->onThemeChanged(eTheme->getThemeMode()); |
| 37 | connect(eTheme, &ElaTheme::themeModeChanged, d, &ElaKeyBinderPrivate::onThemeChanged); |
| 38 | } |
| 39 | |
| 40 | ElaKeyBinder::~ElaKeyBinder() |
| 41 | { |
nothing calls this directly
no test coverage detected