Results 1 to 16 of 16

Thread: how to maximaize the label by using mouse click?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to maximaize the label by using mouse click?

    before initialising my label i made my widget to full screen.
    my code:
    widget.cpp
    Qt Code:
    1. Widget::Widget(QWidget *parent) :
    2. QWidget(parent),
    3. ui(new Ui::Widget)
    4. {
    5.  
    6. showFullScreen();
    7. activateWindow();
    8. label=new QLabel(this);
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 
    displaying images in label:
    Qt Code:
    1. void displayimages()
    2. {
    3. ImageToLoad.load(dir.absoluteFilePath(remoteimagefilename)); //image name
    4. label->setPixmap(QPixmap::fromImage(ImageToLoad.scaled(1025,1025,Qt::KeepAspectRatio,Qt::FastTransformation))); label->showFullScreen();
    5. }
    To copy to clipboard, switch view to plain text mode 
    mouseclick event
    Qt Code:
    1. void Widget::mousePressEvent(QMouseEvent *event)
    2. {
    3. if (event->button() & (Qt::LeftButton | Qt::RightButton))
    4. {
    5. showMaximized();
    6. activateWindow();
    7. update();
    8.  
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 
    Quote Originally Posted by wysota View Post
    What have you tried so far to solve your problem?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to maximaize the label by using mouse click?

    The label is not a top-level widget, it cannot be shown as fullscreen.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    iswaryasenthilkumar (7th April 2015)

Similar Threads

  1. Replies: 2
    Last Post: 16th July 2012, 12:40
  2. Creating click events for label
    By InterFiction in forum Newbie
    Replies: 9
    Last Post: 25th November 2011, 02:31
  3. how to get the position of mouse click on a label
    By qt_user in forum Qt Programming
    Replies: 1
    Last Post: 9th August 2010, 09:14
  4. Detect click on QTableWidget label
    By Darthspawn in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2010, 10:50
  5. close window when click on a label
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 29th October 2007, 07:35

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.