예제 #1
0
void YbToolButton::setChecked(bool isChecked)
{
    if(isEnabled()){
        if(m_isCheckable){
            m_isChecked = isChecked;
            if(m_isChecked){
                setBkPalette(224, 238, 238);
            }else{
                setBkPalette(255, 255, 255, 0);
            }
        }
    }
}
예제 #2
0
void myPushButton::mousePressEvent(QMouseEvent *e)
{
    //setBkPalette(150);
    QPixmap pixmap(iconStatus.at(2));
    setBkPalette(0.5);
    setIcon(QIcon(pixmap));
}
예제 #3
0
void myPushButton::enterEvent(QEvent *)
{
    //setBkPalette(120);
    QPixmap pixmap(iconStatus.at(1));
    setBkPalette(0.5);
    setIcon(QIcon(pixmap));

}
예제 #4
0
void YbToolButton::enterEvent(QEvent *e)
{
    (void)e;
    if(m_isCheckable){
        if(isEnabled() && !m_isChecked){
            setBkPalette(224, 238, 238);
        }
    }else{
        if(isEnabled()){
        }
    }
}
예제 #5
0
myPushButton::myPushButton(QStringList iconStr, QWidget *parent):QPushButton(parent)
{
    iconStatus = iconStr;
    if(iconStatus.count() >= 2)
    {
        QPixmap pixmap(iconStatus.at(0));
        setIcon(QIcon(pixmap));
        setIconSize(pixmap.size());
        resize(pixmap.size());
        setBkPalette(0);//设置背景完全透明
        setFlat(true);
        setAutoFillBackground(true);
    }
}
예제 #6
0
void YbToolButton::mouseReleaseEvent(QMouseEvent *e)
{
    if(this->rect().contains(e->pos())){
        if(m_isCheckable){
            if(isEnabled() && !m_isChecked){
                m_isChecked = true;
                setBkPalette(224, 238, 238);
            }
        }else{
            if(isEnabled()){
            }
        }
        emit toolClicked();
    }
}
예제 #7
0
void YbToolButton::mousePressEvent(QMouseEvent *e)
{
    (void)e;
    if(m_isCheckable){
        if(isEnabled() && !m_isChecked){
            setBkPalette(224, 238, 238);
            m_textLabel->setFont(boldFont);
            m_picLabel->clear();
            m_picLabel->setPixmap(m_checkedPixmap);
            m_picLabel->setFixedSize(m_checkedPixmap.size());
        }
    }else{
        if(isEnabled()){
        }
    }
}