first commit
This commit is contained in:
47
project/fm_viewer/ui/rm_widget_style_base.cpp
Normal file
47
project/fm_viewer/ui/rm_widget_style_base.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "rm_widget_style_base.h"
|
||||
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
|
||||
RMWidgetStyleBase::RMWidgetStyleBase(QWidget *parent,QString styleChangeName,bool bEvent) : RMWidgetBase(parent,bEvent)
|
||||
{
|
||||
if(styleChangeName.isEmpty() == false)
|
||||
{
|
||||
setObjectName(styleChangeName);
|
||||
normalStyle = styleChangeName;
|
||||
}
|
||||
}
|
||||
|
||||
void RMWidgetStyleBase::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||
}
|
||||
|
||||
void RMWidgetStyleBase::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
Q_UNUSED(param)
|
||||
if(normalStyle.isEmpty() == false)
|
||||
{
|
||||
bool bUpdate = false;
|
||||
if(event == RMApp::WillNormalScreen)
|
||||
{
|
||||
setObjectName(normalStyle);
|
||||
bUpdate = true;
|
||||
}
|
||||
else if (event == RMApp::WillFullScreen)
|
||||
{
|
||||
setObjectName("");
|
||||
bUpdate = true;
|
||||
}
|
||||
if (bUpdate)
|
||||
{
|
||||
style()->unpolish(this);
|
||||
style()->polish(this);
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user