spinbox->lineEdit()->deselect();
#ifndef SPINBOX_H#define SPINBOX_H#include <QSpinBox>#include <QLineEdit>class spinBox : public QSpinBox{ Q_OBJECT QLineEdit *le;public: explicit spinBox(QWidget *parent = 0); signals: public slots: void deselectSB(); };#endif // SPINBOX_H
#include "spinbox.h"spinBox::spinBox(QWidget *parent) : QSpinBox(parent) , le(new QLineEdit(this)){ this->setLineEdit(le);}void spinBox::deselectSB(){// this->setStyleSheet("selection-background-color: rgba(0, 0, 0, 0%); selection-color: black");// это для "выделения не видно". Но оно мне не подошло. le->deselect();}
void spinBox::deselectSB(){ lineEdit()->setFocus(Qt::MouseFocusReason);}