Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-qt-ui
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-qt-ui
Commits
c0c0f984
Commit
c0c0f984
authored
4 years ago
by
konstantin.kukharenko
Browse files
Options
Downloads
Patches
Plain Diff
[*]Reload effect
parent
71b9bb73
No related branches found
No related tags found
1 merge request
!29
[*]Reload effect
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
controls/ScreenOverlaying.cpp
+47
-7
47 additions, 7 deletions
controls/ScreenOverlaying.cpp
controls/ScreenOverlaying.h
+35
-10
35 additions, 10 deletions
controls/ScreenOverlaying.h
with
82 additions
and
17 deletions
controls/ScreenOverlaying.cpp
+
47
−
7
View file @
c0c0f984
#include
"ScreenOverlaying.h"
#include
<QDebug>
ScreenOverlaying
::
ScreenOverlaying
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
ScreenOverlaying
::
ScreenOverlaying
(
QWidget
*
a_parent
)
:
QWidget
(
a_parent
),
blurRadius
(
0
),
opacity
(
0
)
{
}
ScreenOverlaying
::
ScreenOverlaying
(
QWidget
*
blure_parent
,
QWidget
*
opacity_parent
)
:
QWidget
(
opacity_parent
),
blurRadius
(
0
),
opacity
(
0
)
{
setObjectName
(
"ScreenBlureOpocityEffect"
);
m_blurParent
=
blure_parent
;
m_opacityParent
=
opacity_parent
;
this
->
setVisible
(
false
);
}
void
ScreenOverlaying
::
mousePressEvent
(
QMouseEvent
*
event
){
Q_UNUSED
(
event
);
emit
mousePressed
();
void
ScreenOverlaying
::
showEvent
(
QShowEvent
*
event
)
{
QGraphicsBlurEffect
*
blurEffect
=
new
QGraphicsBlurEffect
(
m_blurParent
);
blurEffect
->
setBlurRadius
(
blurRadius
);
m_blurParent
->
setGraphicsEffect
(
blurEffect
);
setGeometry
(
0
,
0
,
m_opacityParent
->
width
(),
m_opacityParent
->
height
());
QGraphicsOpacityEffect
*
opacityEffect
=
new
QGraphicsOpacityEffect
(
this
);
opacityEffect
->
setOpacity
(
opacity
);
setGraphicsEffect
(
opacityEffect
);
QWidget
::
showEvent
(
event
);
}
void
ScreenOverlaying
::
hideEvent
(
QHideEvent
*
event
)
{
delete
m_blurParent
->
graphicsEffect
();
delete
graphicsEffect
();
QWidget
::
hideEvent
(
event
);
}
void
ScreenOverlaying
::
setBlurRadius
(
int
&
a_blurRadius
)
{
blurRadius
=
a_blurRadius
;
}
void
ScreenOverlaying
::
paintEvent
(
QPaintEvent
*
event
){
QPainter
painter
(
this
);
pa
inter
.
fillRect
(
event
->
rect
(),
palette
().
color
(
QPalette
::
Window
))
;
void
ScreenOverlaying
::
setOpacity
(
qreal
&
a_opacity
)
{
o
pa
city
=
a_opacity
;
}
This diff is collapsed.
Click to expand it.
controls/ScreenOverlaying.h
+
35
−
10
View file @
c0c0f984
...
...
@@ -2,24 +2,49 @@
#define SCREENOVERLAYING_H
#include
<QWidget>
#include
<Q
Painter
>
#include
<Q
PaintEven
t>
#include
<Q
GraphicsOpacityEffect
>
#include
<Q
GraphicsBlurEffec
t>
//claass wich fill screen under menu
/* css style
#ScreenBlureOpocityEffect
{
background-color: color
qproperty-blureRadius: integer property
qproperty-opocity: double property 0...1
}
*/
class
ScreenOverlaying
:
public
QWidget
{
Q_OBJECT
Q_PROPERTY
(
int
blurRadius
WRITE
setBlurRadius
DESIGNABLE
true
)
Q_PROPERTY
(
qreal
opacity
WRITE
setOpacity
DESIGNABLE
true
)
public:
ScreenOverlaying
(
QWidget
*
parent
=
nullptr
);
ScreenOverlaying
(
QWidget
*
a_
parent
);
protected:
/// Constructor with two widgets specified. 1st widget for creating blurring.
/// The second widget must be the parent of the first and the parent
/// of this class to create a transparent background.
/// @param blure_parent.
/// @param opocity_parent
ScreenOverlaying
(
QWidget
*
blur_parent
,
QWidget
*
opacity_parent
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
paintEvent
(
QPaintEvent
*
event
);
protected:
void
showEvent
(
QShowEvent
*
event
)
override
;
void
hideEvent
(
QHideEvent
*
event
)
override
;
/// Setting a parameter for the BlurEffect.
/// @param a_blureRadius.
void
setBlurRadius
(
int
&
a_blurRadius
);
/// Setting a parameter for the OpacityEffect.
/// @param a_opocity.
void
setOpacity
(
qreal
&
a_opacity
);
signals:
void
mousePressed
();
};
private:
QWidget
*
m_blurParent
;
QWidget
*
m_opacityParent
;
int
blurRadius
;
qreal
opacity
;
};
#endif // SCREENOVERLAYING_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment