transqwidget.cpp
来自「IP电话GUI界面设计及源代码,应用参考.」· C++ 代码 · 共 83 行
CPP
83 行
/** * Copyright (C) 2004 Savoir-Faire Linux inc. * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#include <qpoint.h>#include "transqwidget.h"TransQWidget::TransQWidget (QWidget *parent, const char *name, WFlags f) : QWidget (parent, name, f) { pixmap = NULL; _moved = false;}voidTransQWidget::setbgPixmap (QPixmap *pix) { this->pixmap = pix;}voidTransQWidget::setSourceImage (void) { this->SourceImage = pixmap->convertToImage ();}QImageTransQWidget::getSourceImage (void) { return this->SourceImage;}voidTransQWidget::transparencyMask (void) { this->ShowedImage = SourceImage; this->ImageMask = ShowedImage.createAlphaMask ();}/** * Reimplementation of paintEvent() to handle the transparency of the * widget. * This method is called everytime when the widget is redrawn. */voidTransQWidget::paintEvent (QPaintEvent *e) { if (e);// boring warning bitBlt (this, 0, 0, &ShowedImage, 0, Qt::CopyROP); setMask (ImageMask);}/** * Reimplementation of mouseMoveEvent() to handle the borderless window drag. */voidTransQWidget::mouseMoveEvent (QMouseEvent *e) { move (e->globalPos() - QPoint(mouse_x, mouse_y)); global_x = e->globalX(); global_y = e->globalY(); _moved = true;}/** * Reimplementation of mousePressEvent() to register mouse positions. */voidTransQWidget::mousePressEvent (QMouseEvent *e) { mouse_x = e->x(); mouse_y = e->y();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?