51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
|
#include "customcombobox.h"
|
||
|
|
||
|
CustomComboBox::CustomComboBox(QWidget *parent) : QComboBox(parent)
|
||
|
{
|
||
|
this->setStyleSheet("QComboBox { background-color : black; color : #d4ae13; "
|
||
|
"}QComboBox:editable {"
|
||
|
" background: black; selection-background-color: black; color : #d4ae13;}"
|
||
|
"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 { 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 : #d4ae13; "
|
||
|
"}QComboBox:editable {"
|
||
|
" background: black; selection-background-color: black; color : #d4ae13; selection-color: #d4ae13; }"
|
||
|
"QComboBox QAbstractItemView {"
|
||
|
" selection-background-color: black;}"
|
||
|
);
|
||
|
emit unfocused();
|
||
|
}
|