• 大小: 846KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-29
  • 语言: 其他
  • 标签: Qt  嵌入式  

资源简介

实用Qt编写的图片浏览器的程序,非常容易移植到各种嵌入式开发平台。代码简洁容易上手。

资源截图

代码片段和文件信息

#include “imagewidget.h“

ImageWidget::ImageWidget(QWidget *parent)
    : QWidget(parent)
{
    QDesktopWidget desktop;
    pixmap = QPixmap(desktop.width()desktop.height());
    scale = 1;
    angle = 0;
    bFit = true;
}

ImageWidget::~ImageWidget()
{

}

void ImageWidget::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    if(angle)
    {
        QPointF center(width()/2.0height()/2.0);
        painter.translate(center);
        painter.rotate(angle);
        painter.translate(-center);
    }

    if(bFit)
    {
        QPixmap fitPixmap = pixmap.scaled(width()height()Qt::IgnoreAspectRatio);
        painter.drawPixmap(00fitPixmap);
    }
    else
        painter.drawPixmap(00pixmap);
}

void ImageWidget::setPixmap(QString fileName)
{
    pixmap.load(fileName);
    update();
}

QPixmap ImageWidget::getPixmap()
{
    return pixmap;
}

void ImageWidget::setAngle(qreal rotateAngle)
{
    angle += rotateAngle;
    update();
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-07-08 16:33  imageMainWindow\
     目录           0  2011-07-11 09:50  imageMainWindow-build-desktop\
     目录           0  2011-07-11 09:50  imageMainWindow-build-desktop\debug\
     文件     1450309  2011-07-12 10:14  imageMainWindow-build-desktop\debug\imageMainWindow.exe
     文件      277500  2011-07-12 08:48  imageMainWindow-build-desktop\debug\imagewidget.o
     文件        4566  2011-07-12 08:48  imageMainWindow-build-desktop\debug\image_res.o
     文件      164997  2011-07-12 09:32  imageMainWindow-build-desktop\debug\main.o
     文件      390870  2011-07-12 10:14  imageMainWindow-build-desktop\debug\mainwindow.o
     文件        2159  2011-07-12 08:48  imageMainWindow-build-desktop\debug\moc_imagewidget.cpp
     文件      126016  2011-07-12 08:48  imageMainWindow-build-desktop\debug\moc_imagewidget.o
     文件        3350  2011-07-12 09:32  imageMainWindow-build-desktop\debug\moc_mainwindow.cpp
     文件      188901  2011-07-12 09:32  imageMainWindow-build-desktop\debug\moc_mainwindow.o
     文件      219182  2011-07-12 09:35  imageMainWindow-build-desktop\debug\qrc_imagewidget.cpp
     文件       52265  2011-07-12 09:35  imageMainWindow-build-desktop\debug\qrc_imagewidget.o
     文件        6977  2011-07-12 08:47  imageMainWindow-build-desktop\Makefile
     文件        8552  2011-07-12 08:47  imageMainWindow-build-desktop\Makefile.Debug
     文件        8689  2011-07-12 08:47  imageMainWindow-build-desktop\Makefile.Release
     目录           0  2011-07-11 09:50  imageMainWindow-build-desktop\release\
     文件        4286  2011-07-12 08:32  imageMainWindow\image.ico
     文件          38  2011-07-12 08:47  imageMainWindow\image.rc
     文件         409  2011-07-12 08:47  imageMainWindow\imageMainWindow.pro
     文件       14565  2011-07-12 10:13  imageMainWindow\imageMainWindow.pro.user
     目录           0  2011-07-11 17:06  imageMainWindow\images\
     文件        4286  2011-07-11 16:56  imageMainWindow\images\actualsize.ico
     文件        4286  2011-07-12 09:34  imageMainWindow\images\close.ico
     文件        4286  2011-07-11 16:57  imageMainWindow\images\fitscreen.ico
     文件        4286  2011-07-11 16:49  imageMainWindow\images\fullscreen.ico
     文件        4286  2011-07-12 08:32  imageMainWindow\images\image.ico
     文件        4286  2011-07-11 17:02  imageMainWindow\images\left.ico
     文件        4286  2011-07-11 16:47  imageMainWindow\images\next.ico
     文件        4286  2011-07-11 16:44  imageMainWindow\images\open.ico
............此处省略10个文件信息

评论

共有 条评论