Results 1 to 9 of 9

Thread: How to view images ???

  1. #1
    Join Date
    Dec 2010
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Post How to view images ???

    I have placed images in QLabel and want to view it larger when I clicks it ......
    Regards:

    Prajnaranjan Das
    e mail: prajnaranjan.das@gmail.com

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to view images ???

    What is the problem you have?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Dec 2010
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to view images ???

    I want to perform click operation on QLabel so that the image I have used should become larger...I have used keyPressEvent(QKeyEvent *event) but Its not showing anything ....
    Regards:

    Prajnaranjan Das
    e mail: prajnaranjan.das@gmail.com

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to view images ???

    show your code.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Dec 2010
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to view images ???

    Qt Code:
    1. void CodeEditor::keyPressEvent(QKeyEvent *event)
    2. {
    3. switch (event->key()) {
    4. case Qt::Key_Home:
    5. if (event->modifiers() & Qt::ControlModifier) {
    6. goToBeginningOfDocument();
    7. } else {
    8. goToBeginningOfLine();
    9. }
    10. break;
    11. case Qt::Key_End:
    12. ...
    13. default:
    14. QWidget::keyPressEvent(event);
    15. }
    16. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by high_flyer; 17th December 2010 at 12:49.
    Regards:

    Prajnaranjan Das
    e mail: prajnaranjan.das@gmail.com

  6. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to view images ???

    And where is the code that should enlarge the image ?

    You have reimplemented keyPressEvent, which is responsible for keyboard events.
    I want to perform click operation on QLabel so that the image I have used should become larger...I have used keyPressEvent(QKeyEvent *event) but Its not showing anything ....
    If you want to perform actions on mouse button click, you need to reimplement QWidget::mousePressEvent.

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to view images ???

    I want to perform click operation on QLabel so that the image I have used should become larger
    Where is code that is supposed to enlarge the image?

    EDIT: oops, someone was faster :-)
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. #8
    Join Date
    Dec 2010
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to view images ???

    thanks for your reply….Can you please give me a link related to keyPress and mousePressEvent or any example for this….
    Regards:

    Prajnaranjan Das
    e mail: prajnaranjan.das@gmail.com

  9. #9
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to view images ???

    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. including qjpeg4.dll to view images
    By aash_89 in forum Qt Programming
    Replies: 8
    Last Post: 26th July 2010, 07:52
  2. Unable to view images in an application created for Windows ce
    By mistertwister in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 4th March 2010, 19:23
  3. Replies: 4
    Last Post: 27th July 2009, 15:45
  4. how to browse images in thumbnail view?
    By zl2k in forum Qt Programming
    Replies: 12
    Last Post: 23rd April 2009, 02:20
  5. How to view images using QT
    By Pitso in forum Newbie
    Replies: 1
    Last Post: 16th April 2007, 14:00

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
  •  
Qt is a trademark of The Qt Company.