Results 1 to 8 of 8

Thread: Zooming..

  1. #1
    Join Date
    Oct 2007
    Location
    Bangalore
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Zooming..

    Hi all,

    Presently i am working in qt4.2.2. As the example given in the Examples and demos i understood the working Image Viewer ...

    But my problem is how to zoom the entire screen...

    In that example they have used the QLabel... In that they have Loaded iQPixmap ... and then RESIZE and SIZE Functions QLabel they are using...
    their they are getting the size of the image and multiplying with scale factor...
    How to get the size of entire screen that i want to zoom???

  2. #2
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Zooming..

    chethana,
    which widget you are using?
    check
    width()
    and height() function

  3. #3
    Join Date
    Oct 2007
    Location
    Bangalore
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Zooming..

    I am sending the .bmp image red rectangle portion as i showed in the attachment that portion i want to zoom ... How to get the size ???

  4. #4
    Join Date
    Oct 2007
    Location
    Bangalore
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Zooming..

    find out the attachment...
    Attached Files Attached Files

  5. #5
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Zooming..

    that area is may be some widget or frame or dialog, right?
    what is that? where you drawing these circle?
    if you drawing these circle on some widget then you can write two slots:
    void myWidget::zoomIn()
    {
    scale(1.25,1);
    update();
    }

    void myWidget::zoomOut()
    {
    scale(0.8,1);
    update();
    }

  6. #6
    Join Date
    Oct 2007
    Location
    Bangalore
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Zooming..

    HI ,

    In a paint event i have written the codefor concentric circle... QMainWindow is my widget...

    How to get control over client area... How to zoom the showed region...

  7. #7
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Zooming..

    try this:
    void MainWindow::zoomIn()
    {
    QPainter painter(this);
    painter.scale(width() *1.25, height() *1.25);
    update();
    }
    void MainWindow::zoomOut()
    {
    QPainter painter(this);
    painter.scale(width() *0.8, height() *0.8);
    update();
    }

  8. #8
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Zooming..

    OR
    you can implement like this:

    void MainWindow:aintEvent(QPaintEvent *event)
    {
    QPainter painter( this );
    painter.drawPixmap( 0,0, m_buffer );
    }
    void MainWindow::updateWidget()
    {
    QPixmap tmp( 1200,900 );
    tmp.fill(Qt::white);
    m_buffer = tmp;
    QPainter painter(&m_buffer);
    ...
    painter.setBrush( QColor(120,120,120) );
    painter.drawRect(rect);
    . . .
    }
    void MainWindow::zoomIn()
    {
    QSize size( width() *1.25, height() *1.25);
    m_buffer .scaled(size,Qt::KeepAspectRatio, Qt::SmoothTransformation)
    update();
    }

    QPixmap m_buffer ; in .h file

Similar Threads

  1. Zooming in but not out
    By nitriles in forum Qt Programming
    Replies: 1
    Last Post: 5th October 2007, 08:54
  2. Zooming scene Rect(Qt bug?)
    By maverick_pol in forum Qt Programming
    Replies: 31
    Last Post: 30th August 2007, 09:31
  3. Replies: 3
    Last Post: 11th March 2007, 13:04
  4. Zooming QCanvas: QCanvasLine problem
    By Pieter from Belgium in forum Qt Programming
    Replies: 1
    Last Post: 4th October 2006, 16:58
  5. Zooming a paricular selected region
    By Kapil in forum Newbie
    Replies: 8
    Last Post: 9th May 2006, 14:41

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.