Results 1 to 2 of 2

Thread: how to resize video as lable with aspact ratio

  1. #1
    Join Date
    Sep 2012
    Posts
    7

    Default how to resize video as lable with aspact ratio

    How can i resize video with aspact ratio?
    the problem is i have video with 640 x 480 and my lable size 400x400, which means the part of my video cut from right to left
    i used :
    QImage and
    setPixmap(QPixmap::fromImage(qimgProcessed));

    any idea ..?

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: how to resize video as lable with aspact ratio

    When you have a QImage, your problem no longer has anything to do with video. It is just about resizing a QImage. Of course, you either get distortion or black borders (well, black or any colour you wish and program).

    Now, as it happens, the default thing to happen when you scale a QImage is that the aspect ration is ignored...
    QImage QImage::scaled ( const QSize & size, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation ) const

    If you want to keep the aspect ratio, change the obvious parameter to Qt::KeepAspectRatio.

    See the details in QImage class reference.

Similar Threads

  1. Replies: 0
    Last Post: 21st November 2011, 07:55
  2. Update of lable / changing the cursor
    By mw0001 in forum Newbie
    Replies: 3
    Last Post: 24th February 2010, 08:15
  3. How to increase size of the header lable in QTreeView
    By grsandeep85 in forum Qt Programming
    Replies: 1
    Last Post: 21st October 2009, 09:59
  4. problem in lable
    By wagmare in forum Qt Programming
    Replies: 3
    Last Post: 17th December 2008, 13:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.