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

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

網(wǎng)站里面如何做下載的app全國31省市疫情最新消息今天

網(wǎng)站里面如何做下載的app,全國31省市疫情最新消息今天,廣州網(wǎng)絡(luò)推廣外包,濟(jì)寧做網(wǎng)站1、概述 源碼放在文章末尾 該項(xiàng)目實(shí)現(xiàn)了屏幕拾色器的功能,可以根據(jù)鼠標(biāo)指定的位置識別當(dāng)前位置的顏色 項(xiàng)目功能包含: 鼠標(biāo)按下實(shí)時采集鼠標(biāo)處的顏色。 實(shí)時顯示顏色值。 支持16進(jìn)制格式和rgb格式。 實(shí)時顯示預(yù)覽顏色。 根據(jù)背景色自動計算合適的前景色…

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

該項(xiàng)目實(shí)現(xiàn)了屏幕拾色器的功能,可以根據(jù)鼠標(biāo)指定的位置識別當(dāng)前位置的顏色

項(xiàng)目功能包含:
鼠標(biāo)按下實(shí)時采集鼠標(biāo)處的顏色。
實(shí)時顯示顏色值。
支持16進(jìn)制格式和rgb格式。
實(shí)時顯示預(yù)覽顏色。
根據(jù)背景色自動計算合適的前景色。

下面是demo演示:
在這里插入圖片描述
項(xiàng)目部分代碼如下所示:

#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("當(dāng)前顏色");labWeb->setText("web值:");labRgb->setText("rgb值:");labPoint->setText("坐標(biāo)值:");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());}//根據(jù)背景色自動計算合適的前景色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://www.risenshineclean.com/news/12073.html

相關(guān)文章:

  • html電子商務(wù)網(wǎng)站模板百度信息流推廣教程
  • 網(wǎng)站做支付功能培訓(xùn)計劃和培訓(xùn)內(nèi)容
  • 用自己的電腦做網(wǎng)站需要備案嗎旅游最新資訊
  • 網(wǎng)站建設(shè)jutuibao線上推廣的渠道和方法
  • 媒體公司網(wǎng)站模板百度指數(shù)1000搜索量有多少
  • 怎么做網(wǎng)站像淘寶這樣的免費(fèi)發(fā)布產(chǎn)品信息的網(wǎng)站
  • 廣州的一起做網(wǎng)站網(wǎng)絡(luò)軟文廣告
  • 幫客戶做網(wǎng)站內(nèi)容網(wǎng)頁關(guān)鍵詞排名優(yōu)化
  • 免費(fèi)自助建站系統(tǒng)平臺 貼吧網(wǎng)站分析工具
  • 廣州網(wǎng)站設(shè)計我選刻在線識別圖片來源
  • 自貢做網(wǎng)站的公司百度官網(wǎng)認(rèn)證申請
  • 有沒有專門做航拍婚禮網(wǎng)站公司網(wǎng)站建設(shè)公司
  • 現(xiàn)在個人做網(wǎng)站還能盈利營銷策略有哪些方法
  • 出國越南做網(wǎng)站8000保底seo是什么專業(yè)的課程
  • 保定網(wǎng)站 優(yōu)百度關(guān)鍵詞模擬點(diǎn)擊軟件
  • 查詢系統(tǒng)網(wǎng)站模板電商網(wǎng)站鏈接買賣
  • 獨(dú)立商城系統(tǒng)網(wǎng)站建設(shè)站長工具ping檢測
  • 重慶網(wǎng)站產(chǎn)品推廣汕頭網(wǎng)站制作設(shè)計
  • 怎么用自己電腦做服務(wù)器搭建網(wǎng)站深圳龍華區(qū)大浪社區(qū)
  • 網(wǎng)站注冊人查詢某個產(chǎn)品營銷推廣方案
  • 保險官方網(wǎng)站如何進(jìn)行品牌營銷
  • 聽完米課做的網(wǎng)站網(wǎng)絡(luò)營銷公司好不好
  • 買了域名怎么用免費(fèi)seo教程
  • 品牌高端網(wǎng)站建設(shè)公司網(wǎng)絡(luò)公司網(wǎng)頁設(shè)計
  • 做傳銷網(wǎng)站違法嗎自己搭建網(wǎng)站需要什么
  • 星海灣建設(shè)管理中心網(wǎng)站百度知道登錄
  • 網(wǎng)站建設(shè)優(yōu)化文檔網(wǎng)站外包
  • 網(wǎng)站和管理系統(tǒng)的區(qū)別會計培訓(xùn)班要多少錢一般要學(xué)多久
  • 網(wǎng)站專題頁面設(shè)計欣賞騰訊企業(yè)郵箱登錄入口
  • 武漢網(wǎng)站制作公司排名中國進(jìn)入一級戰(zhàn)備狀態(tài)了嗎