/***************************************************************************
** **
** QCustomPlot, an easy to use, modern plotting widget for Qt **
** Copyright (C) 2011-2015 Emanuel Eichhammer **
** **
** This program is free software: you can redistribute it and/or modify **
** it under the terms of the GNU General Public License as published by **
** the Free Software Foundation, either version 3 of the License, or **
** (at your option) any later version. **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
** GNU General Public License for more details. **
** **
** You should have received a copy of the GNU General Public License **
** along with this program. If not, see http://www.gnu.org/licenses/. **
** **
****************************************************************************
** Author: Emanuel Eichhammer **
** Website/Contact: http://www.qcustomplot.com/ **
** Date: 22.12.15 **
** Version: 1.3.2 **
****************************************************************************/
#include "qcustomplot.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////// QCPPainter
////////////////////////////////////////////////////////////////////////////////////////////////////
/*! \class QCPPainter
\brief QPainter subclass used internally
This QPainter subclass is used to provide some extended functionality e.g. for tweaking position
consistency between antialiased and non-antialiased painting. Further it provides workarounds
for QPainter quirks.
\warning This class intentionally hides non-virtual functions of QPainter, e.g. setPen, save and
restore. So while it is possible to pass a QCPPainter instance to a function that expects a
QPainter pointer, some of the workarounds and tweaks will be unavailable to the function (because
it will call the base class implementations of the functions actually hidden by QCPPainter).
*/
/*!
Creates a new QCPPainter instance and sets default values
*/
QCPPainter::QCPPainter() :
QPainter(),
mModes(pmDefault),
mIsAntialiasing(false)
{
// don't setRenderHint(QPainter::NonCosmeticDefautPen) here, because painter isn't active yet and
// a call to begin() will follow
}
/*!
Creates a new QCPPainter instance on the specified paint \a device and sets default values. Just
like the analogous QPainter constructor, begins painting on \a device immediately.
Like \ref begin, this method sets QPainter::NonCosmeticDefaultPen in Qt versions before Qt5.
*/
QCPPainter::QCPPainter(QPaintDevice *device) :
QPainter(device),
mModes(pmDefault),
mIsAntialiasing(false)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) // before Qt5, default pens used to be cosmetic if NonCosmeticDefaultPen flag isn't set. So we set it to get consistency across Qt versions.
if (isActive())
setRenderHint(QPainter::NonCosmeticDefaultPen);
#endif
}
QCPPainter::~QCPPainter()
{
}
/*!
Sets the pen of the painter and applies certain fixes to it, depending on the mode of this
QCPPainter.
\note this function hides the non-virtual base class implementation.
*/
void QCPPainter::setPen(const QPen &pen)
{
QPainter::setPen(pen);
if (mModes.testFlag(pmNonCosmetic))
makeNonCosmetic();
}
/*! \overload
Sets the pen (by color) of the painter and applies certain fixes to it, depending on the mode of
this QCPPainter.
\note this function hides the non-virtual base class implementation.
*/
void QCPPainter::setPen(const QColor &color)
{
QPainter::setPen(color);
if (mModes.testFlag(pmNonCosmetic))
makeNonCosmetic();
}
/*! \overload
Sets the pen (by style) of the painter and applies certain fixes to it, depending on the mode of
this QCPPainter.
\note this function hides the non-virtual base class implementation.
*/
void QCPPainter::setPen(Qt::PenStyle penStyle)
{
QPainter::setPen(penStyle);
if (mModes.testFlag(pmNonCosmetic))
makeNonCosmetic();
}
/*! \overload
Works around a Qt bug introduced with Qt 4.8 which makes drawing QLineF unpredictable when
antialiasing is disabled. Thus when antialiasing is disabled, it rounds the \a line to
integer coordinates and then passes it to the original drawLine.
\note this function hides the non-virtual base class implementation.
*/
void QCPPainter::drawLine(const QLineF &line)
{
if (mIsAntialiasing || mModes.testFlag(pmVectorized))
QPainter::drawLine(line);
else
QPainter::drawLine(line.toLine());
}
/*!
Sets whether painting uses antialiasing or not. Use this method instead of using setRenderHint
with QPainter::Antialiasing directly, as it allows QCPPainter to regain pixel exactness between
antialiased and non-antialiased painting (Since Qt < 5.0 uses slightly different coordinate systems for
AA/Non-AA painting).
*/
void QCPPainter::setAntialiasing(bool enabled)
{
setRenderHint(QPainter::Antialiasing, enabled);
if (mIsAntialiasing != enabled)
{
mIsAntialiasing = enabled;
if (!mModes.testFlag(pmVectorized)) // antialiasing half-pixel shift only needed for rasterized outputs
{
if (mIsAntialiasing)
translate(0.5, 0.5);
else
translate(-0.5, -0.5);
}
}
}
/*!
Sets the mode of the painter. This controls whether the painter shall adjust its
fixes/workarounds optimized for certain output devices.
*/
void QCPPainter::setModes(QCPPainter::PainterModes modes)
{
mModes = modes;
}
/*!
Sets the QPainter::NonCosmeticDefaultPen in Qt versions before Qt5 after beginning painting on \a
device. This is necessary to get cosmetic pen consistency across Qt versions, because since Qt5,
all pens are non-cosmetic by default, and in Qt4 this render hint must be set to get that
behaviour.
The Constructor \ref QCPPainter(QPaintDevice *device) which directly starts painting also sets
the render hint as appropriate.
\note this function hides the non-virtual base class implementation.
*/
bool QCPPainter::begin(QPaintDevice *device)
{
bool result = QPainter::begin(device);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) // before Qt5, default pens used to be cosmetic if NonCosmeticDefaultPen flag isn't set. So we set it to get consistency across Qt versions.
if (result)
setRenderHint(QPainter::NonCosmeticDefaultPen);
#endif
return result;
}
/*! \overload
Sets the mode of the painter. This controls whether the painter shall adjust its
fixes/workarounds optimized for certain output devices.
*/
void QCPPainter::setMode(QCPPainter::PainterMode mode, bool enabled)
{
if (!enabled && mModes.testFlag(mode))
mModes &= ~mode;
else if (enabled && !mModes.testFlag(mode))
mModes |= mode;
}
/*!
Saves the painter (see QPainter::save). Since QCPPainter adds some new internal state to
QPainter, the save/restore functions are reimplemented to also save/restore those members.
\note this function hides the non-virtual base class implementation.
\see restore
*/
void QCPPainter::save()
{
mAntialiasingStack.push(mIsAntialiasing);
QPainter::save();
}
/*!
Restores the painter (see QPainter::restore). Since QCPPainter adds some new inte
没有合适的资源?快使用搜索试试~ 我知道了~
qt做的智能家居系统
共81个文件
png:34个
h:11个
cpp:11个
需积分: 42 74 下载量 73 浏览量
2018-09-29
16:17:14
上传
评论 6
收藏 1.66MB ZIP 举报
温馨提示
1项目概要 1.1项目名称 智能家电控制系统,简称IEACS。 1.2项目简介与要求 随着现代家电智能化时代的到来,越来越多的人追求家电的智能化管理,其特点是利用固定电话,移动电话,Internet等实现对家庭的各种电器的远程控制。本次项目要求完成智能家电控制系统的模拟实现。通过在PC上位机实现远端家电控制和信息接收,同时在pc下位机侧完成家电状态控制的模拟,并将控制结果反馈给PC上位机侧。PC上位机和pc下位机侧通过UART协议进行通信控制。
资源推荐
资源详情
资源评论
收起资源包目录
smartHome.zip (81个子文件)
smartHome
musicwidget.cpp 236B
curtainwidget.h 469B
myhelp.h 484B
kitchenwidget.cpp 2KB
images
2.png 156KB
curtain
curtain_open.png 5KB
curtain_close.png 7KB
curtain_stop.png 6KB
4.jpg 24KB
anfang.jpg 22KB
module
light_on.svg 5KB
light_on.png 8KB
light_off.svg 5KB
light_bulb_48.233009708738px_1185650_easyicon.net.png 3KB
light_off1.png 33KB
temp_add.png 8KB
temp_sub.png 7KB
light_on1.png 34KB
light_off.png 8KB
title.png 6KB
home_normal.png 1KB
css
style.css 5KB
3.jpg 120KB
6.jpg 29KB
midwidget
Bedroom.png 43KB
kitchen.png 45KB
kitchenPressed.png 45KB
ParlorHover.png 40KB
BedroomHover.png 43KB
Safety_hover.png 41KB
BedroomPressed.png 43KB
ParlorPressed.png 40KB
Parlor.png 40KB
Safety_pressed.png 41KB
Safety.png 41KB
kitchenHover.png 45KB
setting.png 142KB
7.jpg 47KB
setting_pressed.png 3KB
bottom
add.png 2KB
statistics.png 4KB
video.png 3KB
reset.png 2KB
night.png 3KB
music.png 2KB
control.png 3KB
woshi.jpg 120KB
chufang.jpg 49KB
8.jpg 5KB
5.jpg 128KB
smartHome.pro.user.62f6907 18KB
widget.ui 17KB
statisticwidget.h 2KB
parlourwidget.h 976B
widget.cpp 8KB
curtainwidget.ui 15KB
bedroomwidget.cpp 1KB
qcustomplot.cpp 832KB
modelchoosewidget.cpp 1KB
systemsettingdialog.ui 15KB
smartHome.pro 1KB
statisticwidget.ui 5KB
bedroomwidget.ui 10KB
musicwidget.h 317B
images.qrc 2KB
parlourwidget.ui 25KB
systemsettingdialog.cpp 2KB
musicwidget.ui 5KB
modelchoosewidget.h 598B
systemsettingdialog.h 548B
statisticwidget.cpp 9KB
parlourwidget.cpp 4KB
modelchoosewidget.ui 9KB
kitchenwidget.ui 15KB
qcustomplot.h 146KB
main.cpp 277B
smartHome.pro.user 23KB
widget.h 3KB
kitchenwidget.h 746B
curtainwidget.cpp 602B
bedroomwidget.h 570B
共 81 条
- 1
资源评论
qq_41180158
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功