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

  • 大小: 8KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-02
  • 語言: 其他
  • 標簽: QT??桌面??時鐘??代碼??

資源簡介

1.用于桌面 2.顯示完全 3.可放大縮小 4.純代碼 5.并配置整點音效(但是我注釋了)

資源截圖

代碼片段和文件信息

#include?“clock.h“

#include?
#include?
#include?
#include?
#include?
#include?se>

const?QPoint?Clock::hourHand[4]?=?{
????QPoint(3?5)
????QPoint(0?13)
????QPoint(-3?5)
????QPoint(0?-40)
};?//?時針繪圖區域
const?QPoint?Clock::minuteHand[4]?=?{
????QPoint(3?5)
????QPoint(0?16)
????QPoint(-3?5)
????QPoint(0?-68)
};?//?分針繪圖區域
const?QPoint?Clock::secondHand[4]?=?{
????QPoint(3?5)
????QPoint(0?18)
????QPoint(-3?5)
????QPoint(0?-85)
};?//?秒針繪圖區域

Clock::Clock(QWidget?*parent)
????:?QWidget(parent)
{
????//this->setWindowFlags(Qt::framelessWindowHint?|?Qt::Tool?|?Qt::WindowStaysOnTopHint);?//?去掉標題欄去掉任務欄顯示,窗口置頂
????this->setWindowFlags(Qt::framelessWindowHint?|?Qt::Tool?);?//?去掉標題欄去掉任務欄顯示
????this->setWindowIcon(?QIcon(“:/ico/clock.ico“)?);
????this->setWindowtitle(?tr(“桌面時鐘“)?);
????this->resize(200?200);

????this->setAttribute(Qt::WA_TranslucentBackground?true);?//?窗口透明,去掉標題欄后方生效
//????this->setWindowOpacity(0.7);?//?窗口透明度設置,其控件或繪圖也透明,且達不到圓形窗口的效果

????/*?加載外部字體文件?*/
????m_fontList.clear();
????int?lcdFontId?=?QFontDatabase::addApplicationFont(“:/lcd/DS-DIGI.ttf“);?//?從source資源文件
????if?(lcdFontId?!=?-1)
????{
????????m_fontList?<se::applicationFontFamilies(lcdFontId);
????}

????/*?畫筆設置?*/
????mHourHandPen?=?QPen(palette().foreground()?2.0);
????mMinuteHandPen?=?QPen(palette().foreground()?1.0);

????QTimer?*pTimer?=?new?QTimer(this);
????pTimer->start(1000);
????connect(?pTimer?SIGNAL(timeout())?this?SLOT(update())?);

????/*?音效控制?*/
//????QString?dir?=?QCoreApplication::applicationDirPath();
//????QString?filename(dir?+?“/sounds/clockMoveSound.wav“);
????//m_pEffect?=?new?QSoundEffect(this);
????//m_pEffect->setLoopCount(QSoundEffect::Infinite);?//?循環播放
//????m_pEffect->setSource(?QUrl::fromLocalFile(filename)?);
????//m_pEffect->setSource(?QUrl::fromLocalFile(“:/sound/clockMoveSound.wav“)?);
????//m_pEffect->setVolume(1.0);?//?音量控制:0.0-1.0
//????m_pEffect->play();?//?播放
//????m_pEffect->stop();?//?停止

????/*?創建右鍵菜單?*/
????createMenu();

????/*?創建系統托盤項?*/
????createTray();
}

Clock::~Clock()
{
????delete?m_pRBMenu;
????delete?m_pCloseAct;
????delete?m_pMaxiMinimizeAct;
????delete?m_pSoundOnAct;
????delete?m_pSoundOffAct;
????//delete?m_pEffect;
}

/*?重寫繪圖事件?*/
void?Clock::paintEvent(QPaintEvent?*e)
{
????QPainter?painter(this);
????QFont?font(“Microsoft?Yahei“?10?75);?//?字體,大小,加粗等同于QFont::Bold
????painter.setFont(font);
????painter.setRenderHint(QPainter::Antialiasing?true);?//反鋸齒
//????painter.setWindow(0?0?200?200);

????int?side?=?qMin(this->width()?this->height());

????/*?圓形背景的繪制?*/
????painter.setPen(Qt::NoPen);?//?去掉外圈線
????painter.setBrush(QColor(255?255?255?125));??????????????//?背景顏色以及透明度
????painter.drawEllipse(?QPoint(width()/2?height()/2)?side/2?side/2?);?//?繪制背景

????painter.setPen(QPen(?QColor(233?233?216?)?4?));?//?外邊框顏色以及大小

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????11289??2018-07-25?16:09??clock\clock.cpp

?????文件???????1545??2018-07-25?15:59??clock\clock.h

?????文件???????1036??2018-07-25?15:51??clock\clock.pro

?????文件??????23921??2018-07-25?16:09??clock\clock.pro.user

?????文件????????438??2018-07-25?15:51??clock\clock.ui

?????文件????????173??2018-07-25?15:59??clock\main.cpp

?????目錄??????????0??2018-07-25?16:09??clock

-----------?---------??----------?-----??----

????????????????38402????????????????????7


評論

共有 條評論