91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.29M
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-08-29
  • 語言: 其他
  • 標簽: 其他??

資源簡介

SmartHomeV2.tar.gz

資源截圖

代碼片段和文件信息

#include?“mytbn.h“
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?

extern?int?TOOLWIDGET_W;
extern?int?TOOLWIDGET_H;
extern?int?TOOLICON_WH;

MyTbn::MyTbn(const?QString?&strImage?const?QString?&strInfo?QWidget?*parent)?:
????QToolButton(parent)m_bOver(false)m_bPress(false)m_strImage(strImage)m_strInfo(strInfo)
{
????//文本顏色
????QPalette?objPalette?=?palette();
????objPalette.setColor(QPalette::ButtonText?QColor(220220220));
????setPalette(objPalette);
????//文本粗體
????QFont?&objFont?=?const_cast(font());
????objFont.setWeight(QFont::Bold);
????//樣式
????setstyleSheet(QLatin1String(“QToolButton{border:0px;}“));
????//大小
????setIconSize(QSize(3535));
????resize(3636);
????//設(shè)置文本在圖標下邊
????setToolButtonstyle(Qt::ToolButtonTextUnderIcon);
????//設(shè)置圖像文本
????setIcon(QPixmap(strImage));
????setText(strInfo);
????//連接press信號槽,表示按鈕按下時
????connect(thisSIGNAL(pressed())thisSLOT(slot_pressed()));
}

MyTbn::MyTbn(QWidget?*parent)

{
}

MyTbn::~MyTbn()
{
}

void?MyTbn::setPicName(QString?pic_name)
{
????this->pic_name?=?pic_name;
????setFixedSize(QPixmap(pic_name).size());
}

void?MyTbn::paintEvent(QPaintEvent?*event)
{
????QPainter?painter(this);
????//如果按鈕被按下
????if(m_bPress)
????{
????????//繪制被按下時的效果
????????painterinfo(30200&painter);
????}
????else?if(m_bOver)//如果按鈕沒有被按下并且鼠標移到按鈕上
????{
????????//繪制鼠標移到按鈕上的按鈕效果
????????painterinfo(40100&painter);
????}
????//調(diào)用基類的重繪事件以顯示圖像文本等
????QToolButton::paintEvent(event);
}

void?MyTbn::enterEvent(QEvent?*event)
{
????SetOver(true);
}

void?MyTbn::leaveEvent(QEvent?*event)
{
????SetOver(false);
}

void?MyTbn::SetPress(bool?bEnable)
{
????if?(bEnable!=?m_bPress)
????{
????????//設(shè)置m_bOver標志位
????????m_bPress?=?bEnable;
????????//更新
????????update();
????}
}

void?MyTbn::painterinfo(int?nTopPartOpacity?int?nBottomPartOpacity?QPainter?*pPainter)
{
????//設(shè)置畫筆
????QPen?objPen(Qt::NoBrush1);
????pPainter->setPen(objPen);
????//設(shè)置漸變畫刷
????QLinearGradient?objLinear(rect().topLeft()rect().bottomLeft());
????//頂部顏色和透明度
????objLinear.setColorAt(0QColor(150150150nTopPartOpacity));
????//中間顏色和透明度---白色--透明度%50
????objLinear.setColorAt(0.5QColor(25525525550));
????//底部顏色和透明度
????objLinear.setColorAt(1QColor(255255255nBottomPartOpacity));
????QBrush?objBrush(objLinear);
????pPainter->setBrush(objBrush);
????//畫圓角矩形
????pPainter->drawRoundedRect(rect()55);
}

void?MyTbn::slot_pressed()
{
????SetPress(true);
????emit?signal_parent(this);
}

void?MyTbn::SetOver(bool?bEnable)
{
????if?(bEnable?!=?m_bOver)
????{
????????//設(shè)置m_bOver標志位
????????m_bOver?=?bEnable;
????????//更新
????????update();
????}
}

評論

共有 條評論