1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/test/shadowwidget/mainform.cpp
tianduanrui a1202779c2 更新QQtShadowWidget的功能。
可以是主窗口,也可以是子控件。
qqtwindowattribute提供shadow效果只能应用于子控件。
2019-09-01 14:39:26 +08:00

36 lines
1.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "mainform.h"
#include "ui_mainform.h"
#include "qqtbodymover.h"
#include <qgraphicseffect.h>
//shadow 不管用
MainForm::MainForm ( QWidget* parent ) :
QQtWidget ( parent ),
ui ( new Ui::MainForm )
{
ui->setupUi ( this );
setAttribute ( Qt::WA_TranslucentBackground, true );
//如果需要鼠标可以移动窗体。
QQtBodyMover* h = new QQtBodyMover ( this );
//此处不能安装给主窗体在UNIX系统下会和QQtTitleBar的鼠标移动共同作用产生并和移动现象。
ui->widget_2->installEventFilter ( h );
//这是使用QQtTitleBar的标准过程请参见mainform.ui。
setWindowIcon ( QIcon ( "logo.ico" ) );
setWindowTitle ( "This is a main form test form." );
//setPixmap ( "rose.png" );
QGraphicsDropShadowEffect* shadow = new QGraphicsDropShadowEffect;
shadow->setBlurRadius ( 10 );
shadow->setColor ( QColor ( 0, 0, 0, 160 ) );
shadow->setOffset ( 5, 5 );
this->setGraphicsEffect ( shadow );
}
MainForm::~MainForm()
{
delete ui;
}