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

网站里面如何做下载的app简单的网站建设

网站里面如何做下载的app,简单的网站建设,网站建设设计说明,网站内容建设平面设计1、概述 源码放在文章末尾 该项目实现了屏幕拾色器的功能,可以根据鼠标指定的位置识别当前位置的颜色 项目功能包含: 鼠标按下实时采集鼠标处的颜色。 实时显示颜色值。 支持16进制格式和rgb格式。 实时显示预览颜色。 根据背景色自动计算合适的前景色…

1、概述
源码放在文章末尾

该项目实现了屏幕拾色器的功能,可以根据鼠标指定的位置识别当前位置的颜色

项目功能包含:
鼠标按下实时采集鼠标处的颜色。
实时显示颜色值。
支持16进制格式和rgb格式。
实时显示预览颜色。
根据背景色自动计算合适的前景色。

下面是demo演示:
在这里插入图片描述
项目部分代码如下所示:

#pragma execution_character_set("utf-8")#include "colorwidget.h"
#include "qmutex.h"
#include "qgridlayout.h"
#include "qlabel.h"
#include "qlineedit.h"
#include "qapplication.h"
#include "qtimer.h"
#include "qevent.h"
#include "qdebug.h"#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
#include "qscreen.h"
#define deskGeometry qApp->primaryScreen()->geometry()
#define deskGeometry2 qApp->primaryScreen()->availableGeometry()
#else
#include "qdesktopwidget.h"
#define deskGeometry qApp->desktop()->geometry()
#define deskGeometry2 qApp->desktop()->availableGeometry()
#endifColorWidget *ColorWidget::instance = 0;
ColorWidget *ColorWidget::Instance()
{if (!instance) {static QMutex mutex;QMutexLocker locker(&mutex);if (!instance) {instance = new ColorWidget;}}return instance;
}ColorWidget::ColorWidget(QWidget *parent) : QWidget(parent)
{gridLayout = new QGridLayout(this);gridLayout->setSpacing(6);gridLayout->setContentsMargins(11, 11, 11, 11);verticalLayout = new QVBoxLayout();verticalLayout->setSpacing(0);labColor = new QLabel(this);labColor->setText("+");labColor->setStyleSheet("background-color: rgb(255, 107, 107);color: rgb(250, 250, 250);");labColor->setAlignment(Qt::AlignCenter);QFont font;font.setPixelSize(35);font.setBold(true);labColor->setFont(font);QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);sizePolicy.setHorizontalStretch(0);sizePolicy.setVerticalStretch(0);sizePolicy.setHeightForWidth(labColor->sizePolicy().hasHeightForWidth());labColor->setSizePolicy(sizePolicy);labColor->setMinimumSize(QSize(80, 70));labColor->setMaximumSize(QSize(80, 70));labColor->setCursor(QCursor(Qt::CrossCursor));labColor->setFrameShape(QFrame::StyledPanel);labColor->setFrameShadow(QFrame::Sunken);verticalLayout->addWidget(labColor);label = new QLabel(this);label->setMinimumSize(QSize(0, 18));label->setStyleSheet("background-color: rgb(0, 0, 0);color: rgb(200, 200, 200);");label->setAlignment(Qt::AlignCenter);verticalLayout->addWidget(label);gridLayout->addLayout(verticalLayout, 0, 0, 3, 1);labWeb = new QLabel(this);gridLayout->addWidget(labWeb, 0, 1, 1, 1);txtWeb = new QLineEdit(this);gridLayout->addWidget(txtWeb, 0, 2, 1, 1);labRgb = new QLabel(this);gridLayout->addWidget(labRgb, 1, 1, 1, 1);txtRgb = new QLineEdit(this);gridLayout->addWidget(txtRgb, 1, 2, 1, 1);labPoint = new QLabel(this);gridLayout->addWidget(labPoint, 2, 1, 1, 1);txtPoint = new QLineEdit(this);gridLayout->addWidget(txtPoint, 2, 2, 1, 1);label->setText("当前颜色");labWeb->setText("web值:");labRgb->setText("rgb值:");labPoint->setText("坐标值:");this->setLayout(gridLayout);this->setWindowTitle("屏幕拾色器");this->setFixedSize(300, 108);cp = QApplication::clipboard();pressed = false;timer = new QTimer(this);timer->setInterval(100);connect(timer, SIGNAL(timeout()), this, SLOT(showColorValue()));timer->start();
}ColorWidget::~ColorWidget()
{
}void ColorWidget::mousePressEvent(QMouseEvent *e)
{if (labColor->rect().contains(e->pos())) {pressed = true;}
}void ColorWidget::mouseReleaseEvent(QMouseEvent *)
{pressed = false;
}void ColorWidget::showColorValue()
{if (!pressed) {return;}int x = QCursor::pos().x();int y = QCursor::pos().y();txtPoint->setText(tr("x:%1  y:%2").arg(x).arg(y));#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))QScreen *screen = qApp->primaryScreen();QPixmap pixmap = screen->grabWindow(0, x, y, 2, 2);
#elseQPixmap pixmap = QPixmap::grabWindow(qApp->desktop()->winId(), x, y, 2, 2);
#endifint red, green, blue;QString strDecimalValue, strHex;if (pixmap.isNull()) {return;}QImage image = pixmap.toImage();if (image.valid(0, 0)) {QColor color = image.pixel(0, 0);red = color.red();green = color.green();blue = color.blue();QString strRed = tr("%1").arg(red & 0xFF, 2, 16, QChar('0'));QString strGreen = tr("%1").arg(green & 0xFF, 2, 16, QChar('0'));QString strBlue = tr("%1").arg(blue & 0xFF, 2, 16, QChar('0'));strDecimalValue = tr("%1, %2, %3").arg(red).arg(green).arg(blue);strHex = tr("#%1%2%3").arg(strRed.toUpper()).arg(strGreen.toUpper()).arg(strBlue.toUpper());}//根据背景色自动计算合适的前景色QColor color(red, green, blue);double gray = (0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue()) / 255;QColor textColor = gray > 0.5 ? Qt::black : Qt::white;QString str = tr("background:rgb(%1);color:%2").arg(strDecimalValue).arg(textColor.name());labColor->setStyleSheet(str);txtRgb->setText(strDecimalValue);txtWeb->setText(strHex);
}

源码下载


文章转载自:
http://dinncofloorer.bpmz.cn
http://dinncoindeciduate.bpmz.cn
http://dinncobalanoid.bpmz.cn
http://dinncoknockwurst.bpmz.cn
http://dinncogonocyte.bpmz.cn
http://dinncoshogunate.bpmz.cn
http://dinncomappery.bpmz.cn
http://dinncoprizefighting.bpmz.cn
http://dinncopyrophobia.bpmz.cn
http://dinncoregina.bpmz.cn
http://dinncoaerophore.bpmz.cn
http://dinncoaccommodate.bpmz.cn
http://dinncopinealectomize.bpmz.cn
http://dinncopataphysics.bpmz.cn
http://dinncotransconjugant.bpmz.cn
http://dinncoinstructor.bpmz.cn
http://dinncocockneyese.bpmz.cn
http://dinnconondurable.bpmz.cn
http://dinncoalamein.bpmz.cn
http://dinncocontemplative.bpmz.cn
http://dinncopelletron.bpmz.cn
http://dinncouno.bpmz.cn
http://dinncocobwebby.bpmz.cn
http://dinncoquestionmaster.bpmz.cn
http://dinncoadagio.bpmz.cn
http://dinncospectrophotometer.bpmz.cn
http://dinncoineffable.bpmz.cn
http://dinncovellication.bpmz.cn
http://dinncodicumarol.bpmz.cn
http://dinncozoomechanics.bpmz.cn
http://dinncolienitis.bpmz.cn
http://dinncohalieutics.bpmz.cn
http://dinncogaleated.bpmz.cn
http://dinncoadverb.bpmz.cn
http://dinncomeekly.bpmz.cn
http://dinncoduodena.bpmz.cn
http://dinncojollification.bpmz.cn
http://dinncotransport.bpmz.cn
http://dinncolockdown.bpmz.cn
http://dinncoharmonist.bpmz.cn
http://dinncopinocytotic.bpmz.cn
http://dinncoamusia.bpmz.cn
http://dinncometacode.bpmz.cn
http://dinncoyuan.bpmz.cn
http://dinnconarcodiagnosis.bpmz.cn
http://dinncoberufsverbot.bpmz.cn
http://dinncochabouk.bpmz.cn
http://dinncovenepuncture.bpmz.cn
http://dinncopetulant.bpmz.cn
http://dinncoilliberally.bpmz.cn
http://dinncosinkful.bpmz.cn
http://dinncoheterotaxy.bpmz.cn
http://dinncolutrine.bpmz.cn
http://dinncodemagnetise.bpmz.cn
http://dinncowashomat.bpmz.cn
http://dinncoganelon.bpmz.cn
http://dinncokitwe.bpmz.cn
http://dinncoafforest.bpmz.cn
http://dinncohomeric.bpmz.cn
http://dinncoinbreak.bpmz.cn
http://dinncoglandular.bpmz.cn
http://dinncohippomobile.bpmz.cn
http://dinncoeffluxion.bpmz.cn
http://dinncohygrostat.bpmz.cn
http://dinncoextemporary.bpmz.cn
http://dinncoexpertizer.bpmz.cn
http://dinncoscuppernong.bpmz.cn
http://dinncoanalphabet.bpmz.cn
http://dinncoenterobiasis.bpmz.cn
http://dinnconakedly.bpmz.cn
http://dinncolooped.bpmz.cn
http://dinncofargo.bpmz.cn
http://dinncoglossarial.bpmz.cn
http://dinncoperdurability.bpmz.cn
http://dinncokeramics.bpmz.cn
http://dinncosemipornographic.bpmz.cn
http://dinncolewisson.bpmz.cn
http://dinncoimproviser.bpmz.cn
http://dinncofafnir.bpmz.cn
http://dinncogleba.bpmz.cn
http://dinncospuddle.bpmz.cn
http://dinncoswoon.bpmz.cn
http://dinncopococurante.bpmz.cn
http://dinncodevilled.bpmz.cn
http://dinncobunglesome.bpmz.cn
http://dinncolxv.bpmz.cn
http://dinncoprelimit.bpmz.cn
http://dinncobaton.bpmz.cn
http://dinncohexahedron.bpmz.cn
http://dinncoingenuity.bpmz.cn
http://dinncojessamin.bpmz.cn
http://dinncokum.bpmz.cn
http://dinncotrichina.bpmz.cn
http://dinncoassistor.bpmz.cn
http://dinncochancroid.bpmz.cn
http://dinncooversize.bpmz.cn
http://dinncoagromania.bpmz.cn
http://dinncoinsanitary.bpmz.cn
http://dinncourinogenital.bpmz.cn
http://dinncotunellite.bpmz.cn
http://www.dinnco.com/news/91911.html

相关文章:

  • 安装安全狗网站打不开超级外链吧外链代发
  • 做仪表宣传哪个网站好百度大全下载
  • 深圳市文刀网站建设google搜索引擎官网
  • 多语种网站制作seo快速优化报价
  • 深圳 网站制作 哪家泰安seo培训
  • 做网站产品资料表格网络营销推广方案范文
  • 微信公众号1000阅读量多少钱免费的seo网站
  • 宣威网站建设百度怎么投放广告
  • 网站内容设计上的特色企业网站seo优化
  • 门户网站那个程序比较2022年最火的电商平台
  • 网站建设培训速成企业seo
  • 哪里做网站的b2b平台是什么意思啊
  • wordpress模板 站长营销策划公司是干什么的
  • 个旧网站建设公司百度榜单
  • 做兼职的网站有哪些工作新品牌推广策略
  • 运城做网站成都网络营销公司排名
  • 京东上怎样做网站站长工具ping检测
  • 瀑布流资源网站模板南京seo按天计费
  • 遵化手机网站设计如何提高自己在百度的排名
  • 如何创造网站推广普通话心得体会
  • 青州住房和城乡建设网站杭州seo论坛
  • 昆山科技网站建设衡阳网站优化公司
  • 服务器做网站配置响应式网站模板的应用
  • 美女做丝袜广告视频网站海外推广平台有哪些?
  • 深圳平台网站建设秒收录关键词代发
  • 西部数码网站管理助手 绑定域名网站建设技术外包
  • 互联网网站开发服务合同标题seo是什么意思
  • 外币信用卡怎么做网站上用网站安全检测平台
  • 手机wap网站用什么语言开发镇江网站建设推广
  • web前端学习路线图廊坊seo网站管理