#include "rm_button.h" #include #include #include #include #include #include #include #if(LIVE_LANGUAGE_CHANGE) #include "../core/rm_language.h" #include "../core/fm_strings.h" #endif RMButton::RMButton(QWidget *parent) : QPushButton(parent) { setFocusPolicy(Qt::NoFocus); #if (DEBUG_BUTTON_EVENT) bCheckEvent = false; #endif } RMButton::~RMButton() { #if(LIVE_LANGUAGE_CHANGE) RMLanguage::instance()->remove(this); #endif } #if (LIVE_LANGUAGE2) RMButton* RMButton::create2(QWidget* parent, QLayout* layout, const char* name, const char* toolTip, QSize size) { RMButton* btn = new RMButton(parent); if(toolTip != NULL) { btn->setToolTip(FMS::txt(toolTip)); } btn->setObjectName(name); btn->setFixedSize(size); // 34,42 btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); layout->addWidget(btn); if(toolTip != NULL) { RMLanguage::instance()->append(toolTip,RMLanguage::TOOLTIP_TEXT,btn); } return btn; } #else // LIVE_LANGUAGE2 RMButton* RMButton::create(QWidget* parent, QLayout* layout, const char* name, QString toolTip, QSize size) { RMButton* btn = new RMButton(parent); if(toolTip.length() > 0 ) { btn->setToolTip(toolTip); } btn->setObjectName(name); btn->setFixedSize(size); // 34,42 btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); layout->addWidget(btn); #if !(LIVE_LANGUAGE2) #if(LIVE_LANGUAGE_CHANGE) if(toolTip.length() > 0 ) { RMLanguage::instance()->append(RMLanguage::LANGUAGE_JP,RMLanguage::TOOLTIP_TEXT,btn,toolTip); } #endif #endif // LIVE_LANGUAGE2 return btn; } #endif // LIVE_LANGUAGE2 #if (DEBUG_BUTTON_EVENT) bool RMButton::event(QEvent *e) { if(bCheckEvent){ if(e->type() == QEvent::WindowBlocked) { qInfo() << __FUNCTION__ << e->type(); } } return QPushButton::event(e); } #endif void RMButton::setStyleStatus(const char* status,bool toggle) { setProperty(status,toggle); style()->unpolish(this); style()->polish(this); update(); } void RMButton::updateObject(QString objectName) { setObjectName(objectName); style()->unpolish(this); style()->polish(this); update(); }