资源简介
提供Qt实现Flat样式效果的常用控件,多达50多个常用控件。ToolBar、ToolButton、SplitView、LineEdit、PushButton等等。
代码片段和文件信息
/**
MIT License
Copyright (c) 2018 Michael Scopchanov
Permission is hereby granted free of charge to any person obtaining a copy
of this software and associated documentation files (the “Software“) to deal
in the Software without restriction including without limitation the rights
to use copy modify merge publish distribute sublicense and/or sell
copies of the Software and to permit persons to whom the Software is
furnished to do so subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include “AbstractButton.h“
#include yle>
#include
#include
#include
/*!
* \class AbstractButton
* \inmodule FlatGui
* \brief base class for all buttons.
*/
AbstractButton::AbstractButton(QWidget *parent) :
QWidget(parent)
m_pressed(false)
m_down(false)
{
setFocusPolicy(Qt::FocusPolicy(style()->styleHint(Qstyle::SH_Button_FocusPolicy)));
setSizePolicy(QSizePolicy(QSizePolicy::Minimum QSizePolicy::Fixed QSizePolicy::DefaultType));
setAttribute(Qt::WA_WState_OwnSizePolicy false);
setForegroundRole(QPalette::ButtonText);
setBackgroundRole(QPalette::Button);
}
bool AbstractButton::event(QEvent *event)
{
if (!isEnabled()) {
switch(event->type()) {
case QEvent::TabletPress:
case QEvent::TabletRelease:
case QEvent::TabletMove:
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtondblclick:
case QEvent::MouseMove:
case QEvent::HoverMove:
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::ContextMenu:
return true;
default:
break;
}
}
return QWidget::event(event);
}
void AbstractButton::actionEvent(QActionEvent *event)
{
QAction *action = event->action();
if (!action)
return;
QWidget::actionEvent(event);
connect(this &AbstractButton::clicked action &QAction::trigger);
}
void AbstractButton::mousePressEvent(QMouseEvent *event)
{
if (event->button() != Qt::LeftButton) {
event->ignore();
return;
}
if (clickArea().contains(event->pos())) {
setDown(true);
m_pressed = true;
repaint();
event->accept();
} else {
event->ignore();
}
}
void AbstractButton::mouseReleaseEvent(QMouseEvent *event)
{
m_pressed = false;
if (event->button() != Qt::LeftButton) {
event->ignore();
return;
}
if (!m_down) {
event->ignore();
return;
}
if (clickArea().contains(event->pos())) {
m_down = false;
repaint();
doClick();
e
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-25 18:22 flat-gui-master\
文件 378 2018-01-25 18:22 flat-gui-master\.gitattributes
文件 204 2018-01-25 18:22 flat-gui-master\.gitignore
文件 3569 2018-01-25 18:22 flat-gui-master\AbstractButton.cpp
文件 1775 2018-01-25 18:22 flat-gui-master\AbstractButton.h
文件 1783 2018-01-25 18:22 flat-gui-master\AbstractDataModel.cpp
文件 2022 2018-01-25 18:22 flat-gui-master\AbstractDataModel.h
文件 1372 2018-01-25 18:22 flat-gui-master\AbstractDataModel_p.h
文件 1297 2018-01-25 18:22 flat-gui-master\AbstractDecoration.cpp
文件 1384 2018-01-25 18:22 flat-gui-master\AbstractDecoration.h
文件 2061 2018-01-25 18:22 flat-gui-master\AbstractEditor.cpp
文件 1737 2018-01-25 18:22 flat-gui-master\AbstractEditor.h
文件 1313 2018-01-25 18:22 flat-gui-master\AbstractEditor_p.h
文件 7012 2018-01-25 18:22 flat-gui-master\AbstractField.cpp
文件 2292 2018-01-25 18:22 flat-gui-master\AbstractField.h
文件 1491 2018-01-25 18:22 flat-gui-master\AbstractField_p.h
文件 1706 2018-01-25 18:22 flat-gui-master\AbstractPanel.cpp
文件 1462 2018-01-25 18:22 flat-gui-master\AbstractPanel.h
文件 1292 2018-01-25 18:22 flat-gui-master\AbstractValidator.cpp
文件 1370 2018-01-25 18:22 flat-gui-master\AbstractValidator.h
文件 1756 2018-01-25 18:22 flat-gui-master\ActionNavigate.cpp
文件 1533 2018-01-25 18:22 flat-gui-master\ActionNavigate.h
文件 1335 2018-01-25 18:22 flat-gui-master\ActionNavigate_p.h
文件 5731 2018-01-25 18:22 flat-gui-master\Alert.cpp
文件 1871 2018-01-25 18:22 flat-gui-master\Alert.h
文件 1412 2018-01-25 18:22 flat-gui-master\Alert_p.h
文件 2512 2018-01-25 18:22 flat-gui-master\ButtonCategory.cpp
文件 1548 2018-01-25 18:22 flat-gui-master\ButtonCategory.h
文件 1334 2018-01-25 18:22 flat-gui-master\ButtonCategory_p.h
文件 2574 2018-01-25 18:22 flat-gui-master\DateDataModel.cpp
文件 1779 2018-01-25 18:22 flat-gui-master\DateDataModel.h
............此处省略116个文件信息
- 上一篇:UML嵌入式系统设计
- 下一篇:EasyWine3RC2.zip
相关资源
- MUI全套视频教程地址.txt
- Qt qml ListViewEx 下拉刷新上拉分页
- Qt qml pageview
- qt实现简单异步日志系统
- 开源QT串口调试助手
- 基于Qt的window service服务封装
- UGUI ScrollRect 带按钮翻页支持拖拽
- QT数据库的操作
- squirrel 语言手册
- QT串口编程库--qextserialport-1.2win-alpha
- ubuntu 12.04 +Qt+opencv采集、显示视频并拍
- 移动onenet 基于arduino IDE 的mqtt连接
- QT编写的局域网聊天工具仿飞秋
- ARM开发板QT编写的虚拟全键盘
- ListView实现字母索引类似通讯录
- source.zip
- 基于Qt的多线程工具
- arduino平台下CC2520 zigbee模块的驱动
- 数字信号处理库Aquila编译及使用说明
- Qt:利用ntp服务器获取网络时间
- MUI
- 利用qt creator 实现的mp3的功能,有界面
- easyui datagrid 表格 打印
- Qt实现周立功CAN
- Idea环境下Dubbo+SpringMVC+ZooKeeper+Zkui程序
- qtwinmigrate-2.8_1-opensource
- 基于QT的换肤整体解决方案(QSkinst<
- Qt txt文件读写
- PyQt5快速开发与实践
- ArduinoLED矩阵代码
评论
共有 条评论