Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
21a32def
O
Obs Studio
项目概览
小白菜888
/
Obs Studio
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Obs Studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
21a32def
编写于
4月 20, 2019
作者:
C
Clayton Groeneveld
提交者:
jp9000
4月 22, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI: Simplify locked/visibility checkboxes
上级
189e4883
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
0 addition
and
108 deletion
+0
-108
UI/locked-checkbox.cpp
UI/locked-checkbox.cpp
+0
-42
UI/locked-checkbox.hpp
UI/locked-checkbox.hpp
+0
-12
UI/visibility-checkbox.cpp
UI/visibility-checkbox.cpp
+0
-42
UI/visibility-checkbox.hpp
UI/visibility-checkbox.hpp
+0
-12
未找到文件。
UI/locked-checkbox.cpp
已删除
100644 → 0
浏览文件 @
189e4883
#include <QPaintEvent>
#include <QPixmap>
#include <QPainter>
#include "locked-checkbox.hpp"
#include <util/c99defs.h>
LockedCheckBox
::
LockedCheckBox
()
:
QCheckBox
()
{
QString
lockedFile
;
QString
unlockedFile
;
if
(
devicePixelRatio
()
>=
2
)
{
lockedFile
=
":/res/images/locked_mask_2x.png"
;
unlockedFile
=
":/res/images/unlocked_mask_2x.png"
;
}
else
{
lockedFile
=
":/res/images/locked_mask.png"
;
unlockedFile
=
":/res/images/unlocked_mask.png"
;
}
lockedImage
=
QPixmap
::
fromImage
(
QImage
(
lockedFile
));
unlockedImage
=
QPixmap
::
fromImage
(
QImage
(
unlockedFile
));
setMinimumSize
(
16
,
16
);
setStyleSheet
(
"outline: none;"
);
}
void
LockedCheckBox
::
paintEvent
(
QPaintEvent
*
event
)
{
UNUSED_PARAMETER
(
event
);
QPixmap
&
pixmap
=
isChecked
()
?
lockedImage
:
unlockedImage
;
QImage
image
(
pixmap
.
size
(),
QImage
::
Format_ARGB32
);
QPainter
draw
(
&
image
);
draw
.
setCompositionMode
(
QPainter
::
CompositionMode_Source
);
draw
.
drawPixmap
(
0
,
0
,
pixmap
.
width
(),
pixmap
.
height
(),
pixmap
);
draw
.
setCompositionMode
(
QPainter
::
CompositionMode_SourceIn
);
draw
.
fillRect
(
QRectF
(
QPointF
(
0.0
f
,
0.0
f
),
pixmap
.
size
()),
palette
().
color
(
foregroundRole
()));
QPainter
p
(
this
);
p
.
drawPixmap
(
0
,
0
,
16
,
16
,
QPixmap
::
fromImage
(
image
));
}
UI/locked-checkbox.hpp
浏览文件 @
21a32def
#pragma once
#include <QCheckBox>
#include <QPixmap>
class
QPaintEvernt
;
class
LockedCheckBox
:
public
QCheckBox
{
Q_OBJECT
QPixmap
lockedImage
;
QPixmap
unlockedImage
;
public:
LockedCheckBox
();
protected:
void
paintEvent
(
QPaintEvent
*
event
)
override
;
};
UI/visibility-checkbox.cpp
已删除
100644 → 0
浏览文件 @
189e4883
#include <QPaintEvent>
#include <QPixmap>
#include <QPainter>
#include "visibility-checkbox.hpp"
#include <util/c99defs.h>
VisibilityCheckBox
::
VisibilityCheckBox
()
:
QCheckBox
()
{
QString
checkedFile
;
QString
uncheckedFile
;
if
(
devicePixelRatio
()
>=
2
)
{
checkedFile
=
":/res/images/visible_mask_2x.png"
;
uncheckedFile
=
":/res/images/invisible_mask_2x.png"
;
}
else
{
checkedFile
=
":/res/images/visible_mask.png"
;
uncheckedFile
=
":/res/images/invisible_mask.png"
;
}
checkedImage
=
QPixmap
::
fromImage
(
QImage
(
checkedFile
));
uncheckedImage
=
QPixmap
::
fromImage
(
QImage
(
uncheckedFile
));
setMinimumSize
(
16
,
16
);
setStyleSheet
(
"outline: none;"
);
}
void
VisibilityCheckBox
::
paintEvent
(
QPaintEvent
*
event
)
{
UNUSED_PARAMETER
(
event
);
QPixmap
&
pixmap
=
isChecked
()
?
checkedImage
:
uncheckedImage
;
QImage
image
(
pixmap
.
size
(),
QImage
::
Format_ARGB32
);
QPainter
draw
(
&
image
);
draw
.
setCompositionMode
(
QPainter
::
CompositionMode_Source
);
draw
.
drawPixmap
(
0
,
0
,
pixmap
.
width
(),
pixmap
.
height
(),
pixmap
);
draw
.
setCompositionMode
(
QPainter
::
CompositionMode_SourceIn
);
draw
.
fillRect
(
QRectF
(
QPointF
(
0.0
f
,
0.0
f
),
pixmap
.
size
()),
palette
().
color
(
foregroundRole
()));
QPainter
p
(
this
);
p
.
drawPixmap
(
0
,
0
,
16
,
16
,
QPixmap
::
fromImage
(
image
));
}
UI/visibility-checkbox.hpp
浏览文件 @
21a32def
#pragma once
#include <QCheckBox>
#include <QPixmap>
class
QPaintEvernt
;
class
VisibilityCheckBox
:
public
QCheckBox
{
Q_OBJECT
QPixmap
checkedImage
;
QPixmap
uncheckedImage
;
public:
VisibilityCheckBox
();
protected:
void
paintEvent
(
QPaintEvent
*
event
)
override
;
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录