更新文档
This commit is contained in:
@@ -2,6 +2,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
|
||||
greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11
|
||||
#lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11
|
||||
|
||||
#将当前目录加入到头文件路径
|
||||
INCLUDEPATH += $$PWD
|
||||
DEFINES += qcustomplot
|
||||
|
||||
#引入平滑曲线类
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
QPainterPath SmoothCurve::createSmoothCurve(const QVector<QPointF> &points)
|
||||
{
|
||||
QPainterPath path;
|
||||
int len = points.size();
|
||||
int len = points.count();
|
||||
if (len < 2) {
|
||||
return path;
|
||||
}
|
||||
@@ -24,13 +24,13 @@ QPainterPath SmoothCurve::createSmoothCurve(const QVector<QPointF> &points)
|
||||
QPainterPath SmoothCurve::createSmoothCurve2(const QVector<QPointF> &points)
|
||||
{
|
||||
//采用Qt原生方法不做任何处理
|
||||
int size = points.size();
|
||||
if (size == 0) {
|
||||
int count = points.count();
|
||||
if (count == 0) {
|
||||
return QPainterPath();
|
||||
}
|
||||
|
||||
QPainterPath path(points.at(0));
|
||||
for (int i = 0; i < size - 1; ++i) {
|
||||
for (int i = 0; i < count - 1; ++i) {
|
||||
//控制点的 x 坐标为 sp 与 ep 的 x 坐标和的一半
|
||||
//第一个控制点 c1 的 y 坐标为起始点 sp 的 y 坐标
|
||||
//第二个控制点 c2 的 y 坐标为结束点 ep 的 y 坐标
|
||||
@@ -68,7 +68,7 @@ void SmoothCurve::calculateControlPoints(const QVector<QPointF> &datas,
|
||||
QVector<QPointF> *firstControlPoints,
|
||||
QVector<QPointF> *secondControlPoints)
|
||||
{
|
||||
int n = datas.size() - 1;
|
||||
int n = datas.count() - 1;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
firstControlPoints->append(QPointF());
|
||||
secondControlPoints->append(QPointF());
|
||||
|
||||
@@ -1145,15 +1145,15 @@ void QCPLayer::drawToPaintBuffer()
|
||||
if (painter->isActive()) {
|
||||
draw(painter);
|
||||
} else {
|
||||
qDebug() << Q_FUNC_INFO << "paint buffer returned inactive painter";
|
||||
//qDebug() << Q_FUNC_INFO << "paint buffer returned inactive painter";
|
||||
}
|
||||
delete painter;
|
||||
mPaintBuffer.data()->donePainting();
|
||||
} else {
|
||||
qDebug() << Q_FUNC_INFO << "paint buffer returned zero painter";
|
||||
//qDebug() << Q_FUNC_INFO << "paint buffer returned zero painter";
|
||||
}
|
||||
} else {
|
||||
qDebug() << Q_FUNC_INFO << "no valid paint buffer associated with this layer";
|
||||
//qDebug() << Q_FUNC_INFO << "no valid paint buffer associated with this layer";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1173,15 +1173,15 @@ void QCPLayer::drawToPaintBuffer()
|
||||
if (painter->isActive()) {
|
||||
draw(painter);
|
||||
} else {
|
||||
qDebug() << Q_FUNC_INFO << "paint buffer returned inactive painter";
|
||||
//qDebug() << Q_FUNC_INFO << "paint buffer returned inactive painter";
|
||||
}
|
||||
delete painter;
|
||||
pb->donePainting();
|
||||
} else {
|
||||
qDebug() << Q_FUNC_INFO << "paint buffer returned nullptr painter";
|
||||
//qDebug() << Q_FUNC_INFO << "paint buffer returned nullptr painter";
|
||||
}
|
||||
} else {
|
||||
qDebug() << Q_FUNC_INFO << "no valid paint buffer associated with this layer";
|
||||
//qDebug() << Q_FUNC_INFO << "no valid paint buffer associated with this layer";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject
|
||||
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
||||
int fontId = fontDb.addApplicationFont(fontFile);
|
||||
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
||||
if (listName.size() == 0) {
|
||||
if (listName.count() == 0) {
|
||||
qDebug() << QString("load %1 error").arg(fontName);
|
||||
}
|
||||
}
|
||||
@@ -265,8 +265,8 @@ void IconHelper::setStyle1(QWidget *widget, QList<QToolButton *> btns, QList<int
|
||||
|
||||
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
||||
{
|
||||
int btnCount = btns.size();
|
||||
int iconCount = icons.size();
|
||||
int btnCount = btns.count();
|
||||
int iconCount = icons.count();
|
||||
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
||||
return;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
|
||||
|
||||
//可能会重复调用设置所以先要移除上一次的
|
||||
for (int i = 0; i < btnCount; ++i) {
|
||||
for (int j = 0; j < this->btns.size(); j++) {
|
||||
for (int j = 0; j < this->btns.count(); j++) {
|
||||
if (this->btns.at(j) == btns.at(i)) {
|
||||
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
||||
this->btns.at(j)->removeEventFilter(this);
|
||||
|
||||
Reference in New Issue
Block a user