目录存档: 多媒体

14 2012

转载:Qt 4.7.4 – problem with libpng

- no title specified


转载:Qt 4.7.4 – problem with libpng

QT4.7.4的Windows版本有臭虫,在操作PNG图片时會报告勒個警告:libpng warning: Interlace handling should be turned on when using png_read_image。将QT升级到4.8.0就可以解决。软件有臭虫很正常,不必惊慌。

http://www.qtcentre.org/threads/44544-Qt-4-7-4-problem-with-libpng

亮点:

Hi,

This bug was identified and will be fixed. See:

[ https://bugreports.qt.nokia.com/brow...comment-164128 ]

Leonard Lee commented on QTBUG-21408:
————————————-

This issue was fixed in QTBUG-13298 for Qt 4.8.

Permanent link to this article: http://stupidbeauty.com/ShangHaiYanMoJi/2012/02/%e8%bd%ac%e8%bd%bd%ef%bc%9aqt-4-7-4-problem-with-libpng/

05 2012

转载:Capturing screenshot with Phonon::VideoWidget::snapshot()

- no title specified


转载:Capturing screenshot with Phonon::VideoWidget::snapshot()

在这漏洞满天飞的年代,遇到臭虫很正常。Phonon有臭虫,导致VideoWidget::snapshot()函数无效。替代方法是QPixmap snapshot = QPixmap::grabWindow(vwidget->winId());

http://developer.qt.nokia.com/forums/viewthread/2487

亮点:

inally I got it working by changing this line:

  1. 1.const QPixmap& snapshot = QPixmap::grabWidget(m_videoPlayer->videoWidget());

to

  1. 1.const QPixmap& snapshot = QPixmap::grabWindow(m_videoPlayer->videoWidget()->winId());

As from the documentation, the QPixmap::grabWindow() function grabs pixels from the screen, not from the window, i.e. if there is another window partially or entirely over the one you grab, you get pixels from the overlying window, too. The mouse cursor is generally not grabbed.

The window system identifier (WId) can be retrieved using the QWidget::winId() function. The rationale for using a window identifier and not a QWidget, is to enable grabbing of windows that are not part of the application, window system frames, and so on.

Anyway I think it is definitely a bug in Phonon, so I will submit a test report soon. Thanks again for your time! :)

Permanent link to this article: http://stupidbeauty.com/ShangHaiYanMoJi/2012/01/%e8%bd%ac%e8%bd%bd%ef%bc%9acapturing-screenshot-with-phononvideowidgetsnapshot/

05 2012

Qt4.7文档翻译:VideoWidget类参考,VideoWidget Class Reference

- no title specified


Qt4.7文档翻译:VideoWidget类参考,VideoWidget Class Reference

(Phonon::VideoWidget)

成员函数文档

QImage VideoWidget::snapshot () const

返回此部件中显示的当前幀的截图。

这個函数是从Qt 4.7 开始提供的。

Permanent link to this article: http://stupidbeauty.com/ShangHaiYanMoJi/2012/01/qt4-7%e6%96%87%e6%a1%a3%e7%bf%bb%e8%af%91%ef%bc%9avideowidget%e7%b1%bb%e5%8f%82%e8%80%83videowidget-class-reference/

04 2012

转载:phonon 视频 播放器

- no title specified


转载:phonon 视频 播放器

使用phonon来做播放器非常简单。

http://www.diybl.com/course/3_program/c++/cppjs/20091228/185844.html

亮点:

02

03

#include <QApplication>

04

#include <QWidget>

05

06

#include <Phonon/MediaObject>

07

#include <Phonon/VideoWidget>

08

#include <Phonon/AudioOutput>

09

#include <QUrl>

10

#include <QObject>

11

#include <QVBoxLayout>

12

#include <QHBoxLayout>

13

#include <QLabel>

14

#include <Phonon/VolumeSlider>

15

#include <Phonon/SeekSlider>

16

17

int main(int argc, char *argv[]) {

18

QApplication app(argc, argv);

19

20

QWidget *widget = new QWidget;

21

widget->setWindowTitle(“Media Player”);

22

widget->resize(400,400);

23

24

Phonon::MediaObject *media = new Phonon::MediaObject;

25

media->setCurrentSource(Phonon::MediaSource(“fable.avi”));

26

27

Phonon::VideoWidget *vwidget = new Phonon::VideoWidget(widget);

28

Phonon::createPath(media, vwidget);

29

vwidget->setAspectRatio(Phonon::VideoWidget::AspectRatioAuto);

30

Phonon::AudioOutput *aOutput = new Phonon::AudioOutput(Phonon::VideoCategory);

31

Phonon::createPath(media, aOutput);

32

33

QLabel *label = new QLabel(“Volume: “);

34

Phonon::VolumeSlider *volumeSlider = new Phonon::VolumeSlider;

35

volumeSlider->setAudioOutput(aOutput);

36

volumeSlider->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

37

38

Phonon::SeekSlider *seekSlider = new Phonon::SeekSlider;

39

seekSlider->setMediaObject(media);

40

41

QHBoxLayout *hLayout = new QHBoxLayout;

42

hLayout->addWidget(label);

43

hLayout->addWidget(volumeSlider);

44

hLayout->addStretch();

45

46

QVBoxLayout *vLayout = new QVBoxLayout;

47

vLayout->addWidget(vwidget);

48

vLayout->addWidget(seekSlider);

49

vLayout->addLayout(hLayout);

50

51

widget->setLayout(vLayout);

52

53

widget->show();

54

media->play();

55

return app.exec();

56

}

Permanent link to this article: http://stupidbeauty.com/ShangHaiYanMoJi/2012/01/%e8%bd%ac%e8%bd%bd%ef%bc%9aphonon-%e8%a7%86%e9%a2%91-%e6%92%ad%e6%94%be%e5%99%a8/

十二 27 2011

转载:QT4工作笔记之QLabel Qmovie绘图

- no title specified


转载:QT4工作笔记之QLabel Qmovie绘图

当妳在一個QLabel中显示的图片既可能是静态图片也可能是动画图片时,直接使用QMovie就行咯。

http://blog.chinaunix.net/space.php?uid=26388681&do=blog&id=3027521

亮点:

我之所以使用QMovie而不是用QPixmap(其实也是可以的)主要是我想把绘制静态图片和动画都封装在统一的一个接口中,而用QPixmap绘制的动画是不动的。

Permanent link to this article: http://stupidbeauty.com/ShangHaiYanMoJi/2011/12/%e8%bd%ac%e8%bd%bd%ef%bc%9aqt4%e5%b7%a5%e4%bd%9c%e7%ac%94%e8%ae%b0%e4%b9%8bqlabel-qmovie%e7%bb%98%e5%9b%be/

十二 27 2011

转载:QT练习5:显示GIF图片

- no title specified


QT练习5:显示GIF图片

对于gif图片的显示,无论该图片是动态的,还是静态的,都可以用QMovie。

http://www.cnblogs.com/hnrainll/archive/2011/05/22/2053701.html

亮点:

#include “widget.h”

#include “ui_widget.h”

#include <QLabel>

#include <QMovie>

Widget::Widget(QWidget *parent) :

QWidget(parent),

ui(new Ui::Widget)

{

ui->setupUi(this);

QMovie *movie = new QMovie(“D:/Project/Qt/testclass/2.gif”);

ui->label->setMovie(movie);

movie->start();

}

Widget::~Widget()

{

delete ui;

}

Permanent link to this article: http://stupidbeauty.com/ShangHaiYanMoJi/2011/12/qt%e7%bb%83%e4%b9%a05%e6%98%be%e7%a4%bagif%e5%9b%be%e7%89%87/

16 2011

Qt4.7文档翻译:QAbstractAnimation类参考,QAbstractAnimation Class Reference

- no title specified


Qt4.7文档翻译:QAbstractAnimation类参考,QAbstractAnimation Class Reference

成员函数文档

void QAbstractAnimation::start ( QAbstractAnimation::DeletionPolicy policy = KeepWhenStopped ) [slot]

启动这个动画。policy参数控制的是在这个动画结束之后是否应当被删除。当这个动画启动时,会发射stateChanged()信号,并且state()返回的是Running(正在进行)。当控制权返回到事件循环时,这个动画就会自动运行,随着动画往前进行而定时调用updateCurrentTime()。

如果这个动画当前是停止的或者已经达到它的末尾的话,那么调用start()就会重置这个动画的位置并且从头启动动画。当动画达到它的末尾时,可能会停止,或者,如果循环级别大于1的话,它会重新开始运行。

如果动画已经在运行咯,那麽这个函数不起作用。

参见stop()和state()。