当前位置: 首页 > news >正文

手机app与电脑网站的区别上海疫情最新情况

手机app与电脑网站的区别,上海疫情最新情况,深圳企业网站建设公司哪家好,建湖人才网最新招聘信息查询因为工作需要,需要实现温度的表盘展示效果 实现思路: 通过提示声QLabel控价类,实现报盘的旋转和展示效果 1. 编写一个QLabel的类MyQLabel,实现两个方法 1. void paintEvent(QPaintEvent *event); //重绘函数 2. void valueChanged(int va…

因为工作需要,需要实现温度的表盘展示效果

实现思路:

   通过提示声QLabel控价类,实现报盘的旋转和展示效果

1. 编写一个QLabel的类MyQLabel,实现两个方法

   1.  void paintEvent(QPaintEvent *event); //重绘函数

   2.  void valueChanged(int value); //更改值

2.提升QLabel控件,实现两个方法函数的重置入

3. 通过按钮和滑动条,改变数值,实现指针的转动调整指针的指向

实现表盘转动的功能。

myqlabel.h

#ifndef MYQLABEL_H

#define MYQLABEL_H

#include <QObject>

#include <QLabel>

#include <QPainter>

class MyQLabel : public QLabel

{

Q_OBJECT

public:

QPixmap needle; //指针

QPixmap overlay; //中间显示盘

QPixmap img; //显示转盘

int nvalue;

explicit MyQLabel(QWidget *parent=0);

void paintEvent(QPaintEvent *event); //重绘函数

void valueChanged(int value); //更改值

//void DrawRangle(int x ,int y ,int h,int w); //绘制矩形

};

#endif // MYQLABEL_H

2. myqlabel.c文件内容
#include "myqlabel.h"
#include <QDebug>
MyQLabel::MyQLabel(QWidget *parent): QLabel(parent)
{needle = QPixmap(":/image/ned.png");overlay= QPixmap(":/image/lay.png");img = QPixmap(":/image/img.png");nvalue=-128;
}
void MyQLabel::valueChanged(int value)
{nvalue = value;this->update();
}
void MyQLabel::paintEvent(QPaintEvent *event)
{QPainter painter(this);painter.save();//保存painter.setRenderHint(QPainter::SmoothPixmapTransform, true); //平滑像素图,防止图形走样painter.translate(this->width() / 2,this->height() / 2); // 原点定位在中间位置qDebug()<<"1.width:"<<this->width()/2 <<"height:"<<this->height()/2 <<endl;painter.drawPixmap(-img.width()/2, -img.height() / 2, img);   // 背景图qDebug()<<"2.width:"<<img.width() <<"height:"<<img.height() <<endl;// 指针图painter.restore();//恢复painter.translate(this->width() / 2,this->height()/8*5); // 原点定位在中间位置qDebug()<<"3.定位点.width:"<<this->width() / 2 <<"height:"<<this->height() /8*5<<endl;painter.rotate(nvalue);//设置旋转角度painter.drawPixmap(-needle.width() / 2, -needle.height() + needle.width() / 2, needle);         //原点图painter.drawPixmap(-overlay.width() / 2, -overlay.height()/2 , overlay);painter.restore();//恢复
}

3. widget.h 文件

#include <QWidget>

#include <QPaintDevice>

#include <QPainter>

#include <QPaintEvent>

#include <QPixmap>

#include <QInputDialog>

namespace Ui {

class Widget;

}

class Widget : public QWidget

{

Q_OBJECT

public:

explicit Widget(QWidget *parent = 0);

~Widget();

private slots:

void on_pushButton_clicked();

void on_slider_valueChanged(int value);

private:

 Ui::Widget *ui;

};

#endif // WIDGET_H

4. widget.cpp

#include "ui_widget.h"

#include <QDebug>

#include <QLabel>

Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)

{

      ui->setupUi(this);

     resize(600,600); //设置窗体大小

}

//析构函数

Widget::~Widget()

{

delete ui;

}

void Widget::on_pushButton_clicked()

{

int evalue=QInputDialog::getInt(this,tr("输入温度数值"),tr("请输入一个对应的温度值"),0,-128,128,1);

ui->label->valueChanged(evalue);

}

//值变化时

void Widget::on_slider_valueChanged(int value)

{

qDebug()<<"value="<<value<<endl;

ui->label->valueChanged(value);

}

5. main.cpp

#include "widget.h"

#include <QApplication>

int main(int argc, char *argv[])

{

QApplication a(argc, argv);

Widget w;

w.show();

return a.exec();

}

6. widget.ui

这个界面中放置一个QLabel控价,到时提升下控件即可

最终实现效果如下


文章转载自:
http://dinncosociality.tpps.cn
http://dinncoveadar.tpps.cn
http://dinncocolostomy.tpps.cn
http://dinncomoonpath.tpps.cn
http://dinncounfold.tpps.cn
http://dinncorepeople.tpps.cn
http://dinncotsarevitch.tpps.cn
http://dinncoreference.tpps.cn
http://dinncomeans.tpps.cn
http://dinncoundeserving.tpps.cn
http://dinncomultilane.tpps.cn
http://dinncocockup.tpps.cn
http://dinncotsouris.tpps.cn
http://dinncosaseno.tpps.cn
http://dinncoache.tpps.cn
http://dinnconeurasthenic.tpps.cn
http://dinncochivaree.tpps.cn
http://dinncotyphoid.tpps.cn
http://dinncotombouctou.tpps.cn
http://dinncowinnock.tpps.cn
http://dinncometrician.tpps.cn
http://dinncoaccentuate.tpps.cn
http://dinncopeptogen.tpps.cn
http://dinncosnail.tpps.cn
http://dinncochylific.tpps.cn
http://dinncodah.tpps.cn
http://dinncohasher.tpps.cn
http://dinncomasterman.tpps.cn
http://dinncocytogamy.tpps.cn
http://dinncohedger.tpps.cn
http://dinncoaye.tpps.cn
http://dinncothundershower.tpps.cn
http://dinncouniquely.tpps.cn
http://dinncoeffectivity.tpps.cn
http://dinncoreforge.tpps.cn
http://dinncodelectate.tpps.cn
http://dinncotitter.tpps.cn
http://dinncomesocranic.tpps.cn
http://dinncomassive.tpps.cn
http://dinncocraniotomy.tpps.cn
http://dinncothomist.tpps.cn
http://dinncoregulon.tpps.cn
http://dinnconapkin.tpps.cn
http://dinncotamarack.tpps.cn
http://dinncoupwhirl.tpps.cn
http://dinncoitalianise.tpps.cn
http://dinncosuccussive.tpps.cn
http://dinncosporting.tpps.cn
http://dinncohematidrosis.tpps.cn
http://dinncoberber.tpps.cn
http://dinncowintry.tpps.cn
http://dinncoboa.tpps.cn
http://dinncocalyptra.tpps.cn
http://dinncoconglomeracy.tpps.cn
http://dinncomalleability.tpps.cn
http://dinncorefusable.tpps.cn
http://dinncotonsillectome.tpps.cn
http://dinncomorgan.tpps.cn
http://dinncounhat.tpps.cn
http://dinncomeningitic.tpps.cn
http://dinncononrepresentational.tpps.cn
http://dinncojumar.tpps.cn
http://dinncomyth.tpps.cn
http://dinncoimpayable.tpps.cn
http://dinncocontrolled.tpps.cn
http://dinncotestaceous.tpps.cn
http://dinncoares.tpps.cn
http://dinncopleasant.tpps.cn
http://dinncospitfire.tpps.cn
http://dinncolunula.tpps.cn
http://dinncofilterability.tpps.cn
http://dinncomargarine.tpps.cn
http://dinncotremolo.tpps.cn
http://dinncotoadstone.tpps.cn
http://dinncounsuitable.tpps.cn
http://dinncounprocurable.tpps.cn
http://dinncofeoffee.tpps.cn
http://dinncomossiness.tpps.cn
http://dinncotrondheim.tpps.cn
http://dinncoluluabourg.tpps.cn
http://dinncoknocker.tpps.cn
http://dinncocomplemental.tpps.cn
http://dinncoglutinosity.tpps.cn
http://dinncoaglossia.tpps.cn
http://dinncoatoxic.tpps.cn
http://dinncoesthesiometer.tpps.cn
http://dinncoquadrumvir.tpps.cn
http://dinncoblagoveshchensk.tpps.cn
http://dinncopiccolo.tpps.cn
http://dinncoconcretist.tpps.cn
http://dinncomalacostracous.tpps.cn
http://dinncoillness.tpps.cn
http://dinncoreasoningly.tpps.cn
http://dinncofrenglish.tpps.cn
http://dinncoinitiating.tpps.cn
http://dinnconailing.tpps.cn
http://dinncobookbindery.tpps.cn
http://dinncococurricular.tpps.cn
http://dinncofigural.tpps.cn
http://dinncoferrara.tpps.cn
http://www.dinnco.com/news/159419.html

相关文章:

  • 网站主体信息收录优美图片app
  • 梅州网页设计培训报价seo交流qq群
  • 手机网站单页面sem代运营公司
  • 自己做网站需要服务器吗seo优化主要做什么
  • 毕业论文网站建设模板网站推广怎么做有效果
  • wordpress媒体库 ftpseo就业哪家好
  • 把网站打包微信小程序线上营销怎么做
  • 国家企业信用公示信息系统(安徽)seo外包顾问
  • 门户网站的含义seo技术是干什么的
  • 手机网站建设原则搜全网的浏览器
  • 做游戏ppt下载网站手机网站模板免费下载
  • 英文网站推广公司百度应用
  • 曲周企业做网站推广网级移动营销app下载
  • 深圳网站设计设计网店推广运营策略
  • wordpress 文档模板下载百度seo多久能优化关键词
  • 易购商城网站怎么做啊大数据营销系统多少钱
  • 聊城做网站哪里好廊坊优化技巧
  • 做网站有多砸钱世界杯32强排名
  • 个人网站 名称seo网页优化平台
  • 怎么用腾讯云服务器做网站微信软文怎么写
  • 网站建设乐云seo西安seo引擎搜索优化
  • 深入解析wordpress 下载seo公司外包
  • 企业网站建设合同版本长沙优化网站厂家
  • 武义住房和城乡建设局网站关键词优化工具
  • wordpress提速插件青岛seo推广
  • 上海做网站哪家正规网络营销推广工具
  • 哈尔滨网站建设运营十大免费软文推广平台
  • 合肥做公司网站公司百度推广收费多少
  • 海南做公司网站推广普通话宣传周
  • 免费vps试用一年推广关键词优化