#include "customcombobox.h" CustomComboBox::CustomComboBox(QWidget *parent) : QComboBox(parent) { this->setStyleSheet("QComboBox { background-color : black; color : #00bbff; " "}QComboBox:editable {" " background: #00bbff; selection-background-color: black; color : black;}" "QComboBox QAbstractItemView {" " selection-background-color: black;}" ); } void CustomComboBox::wheelEvent(QWheelEvent * event) { if (event->delta() > 0) { emit wheelUp(); }else{ emit wheelDown(); } } /* void CustomComboBox::mousePressEvent(QMouseEvent *event) { emit clicked(); } */ void CustomComboBox::enterEvent(QEvent * event) { this->setStyleSheet("QComboBox { selection-color: white; color : white; background-color : black; background: black; selection-background-color: black;}" ); /* this->setStyleSheet("QComboBox { background-color : black; color : green; " "}QComboBox:editable {" " background: black; selection-background-color: black;}" "QComboBox QAbstractItemView {" " selection-background-color: black;}" ); */ emit focused(); } void CustomComboBox::leaveEvent(QEvent * event) { this->setStyleSheet("QComboBox { background-color : black; color : #00bbff; selection-color: #00bbff;" "}QComboBox:editable {" " background: #00bbff; selection-background-color: black; color : black;}" "QComboBox QAbstractItemView {" " selection-background-color: black;}" ); emit unfocused(); }