中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

免費(fèi)做封面的網(wǎng)站新聞稿件

免費(fèi)做封面的網(wǎng)站,新聞稿件,19網(wǎng)站建設(shè),amp for wordpressQT 二維坐標(biāo)系顯示坐標(biāo)點(diǎn)及點(diǎn)與點(diǎn)的連線-通過定時(shí)器自動(dòng)添加隨機(jī)數(shù)據(jù)點(diǎn) 功能介紹頭文件C文件運(yùn)行過程 功能介紹 上面的代碼實(shí)現(xiàn)了一個(gè)簡單的 Qt 應(yīng)用程序,其功能包括: 創(chuàng)建一個(gè) MainWindow 類,繼承自 QMainWindow,作為應(yīng)用程序的…

QT 二維坐標(biāo)系顯示坐標(biāo)點(diǎn)及點(diǎn)與點(diǎn)的連線-通過定時(shí)器自動(dòng)添加隨機(jī)數(shù)據(jù)點(diǎn)

  • 功能介紹
  • 頭文件
  • C文件
  • 運(yùn)行過程

功能介紹

上面的代碼實(shí)現(xiàn)了一個(gè)簡單的 Qt 應(yīng)用程序,其功能包括:

  1. 創(chuàng)建一個(gè) MainWindow 類,繼承自 QMainWindow,作為應(yīng)用程序的主窗口。

  2. 在主窗口中添加了一個(gè)圖表 (QChart) 和一個(gè)圖表視圖 (QChartView),用于顯示圖表內(nèi)容。

  3. 在圖表中添加了一個(gè)線系列 (QLineSeries),用于繪制數(shù)據(jù)點(diǎn)。

  4. 設(shè)置了圖表的 X 軸和 Y 軸范圍、顏色和標(biāo)題。

  5. 使用 QTimer 創(chuàng)建了一個(gè)定時(shí)器,每隔5秒觸發(fā)一次 addPoint() 槽函數(shù)。

  6. addPoint() 槽函數(shù)中,生成了一個(gè)隨機(jī)的 x 坐標(biāo)和 y 坐標(biāo),并將它們添加到線系列中,以實(shí)現(xiàn)動(dòng)態(tài)添加點(diǎn)的效果。

頭文件

// mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include <QtCharts>
#include <QChartView>
#include <QSplineSeries>
#include <QTimer>QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACEclass MainWindow : public QMainWindow
{Q_OBJECTpublic:MainWindow(QWidget *parent = nullptr);~MainWindow();private slots:void addPoint();private:Ui::MainWindow *ui;QTimer *timer;QLineSeries *series1;QChart *chart;
};#endif // MAINWINDOW_H

C文件

// mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QRandomGenerator>MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui->setupUi(this);QValueAxis *xAxis = new QValueAxis();xAxis->setRange(-10, 10);xAxis->setLabelsColor(QColor(255, 0, 0));xAxis->setTitleText("X");QValueAxis *yAxis = new QValueAxis();yAxis->setRange(-10, 10);yAxis->setLabelsColor(QColor(255,0, 0));yAxis->setTitleText("Y");series1 = new QLineSeries();chart = new QChart();chart->legend()->hide();chart->addSeries(series1);chart->createDefaultAxes();chart->setTitle(" www ");chart->addAxis(xAxis, Qt::AlignBottom);chart->addAxis(yAxis, Qt::AlignLeft);series1->attachAxis(xAxis);series1->attachAxis(yAxis);series1->setColor(QColor(255, 0, 0));series1->setUseOpenGL();QChartView *chartView = new QChartView(chart);chartView->setChart(chart);chartView->setRubberBand(QChartView::RectangleRubberBand);chartView->setRenderHint(QPainter::Antialiasing,true);this->setCentralWidget(chartView);// 設(shè)置定時(shí)器timer = new QTimer(this);connect(timer, SIGNAL(timeout()), this, SLOT(addPoint()));timer->start(1000); // 每隔5秒觸發(fā)timeout()信號(hào)
}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::addPoint()
{// 添加隨機(jī)點(diǎn)int X = QRandomGenerator::global()->bounded(-100, 100 + 1);int Y = QRandomGenerator::global()->bounded(-100, 100 + 1);series1->append(X, Y);
}

運(yùn)行過程

在這里插入圖片描述

http://www.risenshineclean.com/news/5093.html

相關(guān)文章:

  • 建設(shè)校園網(wǎng)站必要性網(wǎng)站營銷網(wǎng)站營銷推廣
  • 左側(cè)導(dǎo)航網(wǎng)站站外推廣方式有哪些
  • 網(wǎng)站數(shù)據(jù)庫怎么做同步網(wǎng)站seo推廣營銷
  • 做磁力網(wǎng)站qq群怎么優(yōu)化排名靠前
  • 甘肅省城鄉(xiāng)住房建設(shè)廳網(wǎng)站首頁快速排名點(diǎn)擊工具
  • 做網(wǎng)站的策劃需要做什么seo免費(fèi)軟件
  • 可信網(wǎng)站辦理今天疫情最新消息
  • 護(hù)膚品網(wǎng)站建設(shè)前的行業(yè)分析營銷軟文怎么寫
  • 網(wǎng)易企業(yè)郵箱怎么發(fā)送文件seo網(wǎng)絡(luò)營銷技巧
  • 唐山企業(yè)建網(wǎng)站山東seo推廣公司
  • 旅游攻略網(wǎng)站開發(fā)龍崗網(wǎng)站設(shè)計(jì)
  • 鎮(zhèn)江門戶網(wǎng)站是哪個(gè)百度精準(zhǔn)引流推廣
  • 個(gè)人設(shè)計(jì)網(wǎng)站模板競價(jià)托管 微競價(jià)
  • 怎么做網(wǎng)站制作網(wǎng)絡(luò)營銷競價(jià)推廣
  • 修改網(wǎng)站需要什么凡科建站
  • 企業(yè)手機(jī)端網(wǎng)站設(shè)計(jì)模板有域名了怎么建立網(wǎng)站
  • 大豐網(wǎng)站建設(shè)全網(wǎng)推廣軟件
  • 寧波建設(shè)網(wǎng)站價(jià)格seo是怎么優(yōu)化推廣的
  • 網(wǎng)站建設(shè)的作用網(wǎng)站流量來源
  • 做游戲下載網(wǎng)站賺錢中央人民政府網(wǎng)
  • 什么網(wǎng)站做設(shè)計(jì)可以賺錢搜索引擎營銷是什么
  • 公司在網(wǎng)上做網(wǎng)站怎么做賬怎么注冊網(wǎng)站平臺(tái)
  • 無錫網(wǎng)站建設(shè)企業(yè)排名無錫營銷型網(wǎng)站制作
  • 制作網(wǎng)站的策劃方案網(wǎng)站自建
  • 17網(wǎng)站一起做網(wǎng)店不發(fā)貨網(wǎng)上售賣平臺(tái)有哪些
  • 做短視頻網(wǎng)站產(chǎn)品營銷方案案例范文
  • 網(wǎng)站怎么做谷歌權(quán)重色盲眼鏡
  • 武漢模板建站平臺(tái)哪家好鏈接提交工具
  • 杭州網(wǎng)站制如何在其他平臺(tái)做推廣
  • 濟(jì)南建站免費(fèi)模板瀏覽器網(wǎng)站進(jìn)入口