重新改进支持Qt4.6-Qt6.1
This commit is contained in:
@@ -12,13 +12,13 @@ frmSmoothCurve::frmSmoothCurve(QWidget *parent) : QWidget(parent), ui(new Ui::fr
|
||||
ui->setupUi(this);
|
||||
|
||||
//初始化随机数种子
|
||||
qsrand(QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||
srand(QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||
|
||||
//随机生成曲线上的点
|
||||
int x = -300;
|
||||
while (x < 300) {
|
||||
datas << QPointF(x, qrand() % 300 - 100);
|
||||
x += qMin(qrand() % 30 + 5, 300);
|
||||
datas << QPointF(x, rand() % 300 - 100);
|
||||
x += qMin(rand() % 30 + 5, 300);
|
||||
}
|
||||
|
||||
//正常曲线
|
||||
@@ -28,14 +28,14 @@ frmSmoothCurve::frmSmoothCurve(QWidget *parent) : QWidget(parent), ui(new Ui::fr
|
||||
}
|
||||
|
||||
//平滑曲线1
|
||||
qDebug() << TIMEMS << "createSmoothCurve start";
|
||||
//qDebug() << TIMEMS << "createSmoothCurve start";
|
||||
pathSmooth1 = SmoothCurve::createSmoothCurve(datas);
|
||||
qDebug() << TIMEMS << "createSmoothCurve stop";
|
||||
//qDebug() << TIMEMS << "createSmoothCurve stop";
|
||||
|
||||
//平滑曲线2
|
||||
qDebug() << TIMEMS << "createSmoothCurve2 start";
|
||||
//qDebug() << TIMEMS << "createSmoothCurve2 start";
|
||||
pathSmooth2 = SmoothCurve::createSmoothCurve2(datas);
|
||||
qDebug() << TIMEMS << "createSmoothCurve2 stop";
|
||||
//qDebug() << TIMEMS << "createSmoothCurve2 stop";
|
||||
|
||||
ui->ckShowPoint->setChecked(true);
|
||||
connect(ui->ckShowPoint, SIGNAL(clicked(bool)), this, SLOT(update()));
|
||||
|
||||
@@ -9,7 +9,7 @@ int main(int argc, char *argv[])
|
||||
QApplication a(argc, argv);
|
||||
a.setFont(QFont("Microsoft Yahei", 9));
|
||||
|
||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
#if _MSC_VER
|
||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||
#else
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
|
||||
|
||||
TARGET = smoothcurve
|
||||
TEMPLATE = app
|
||||
|
||||
Reference in New Issue
Block a user