Results 1 to 9 of 9

Thread: How to resize QWidget to be larger than screen?

  1. #1

    Default How to resize QWidget to be larger than screen?

    Suppose the screen resolution is 800x600, resize(1000,1000) does not work. It will resize the widget to the size of the screen, i.e., 800x600. But resize(300,300) works.i.e., can resize the widget smaller than the screen.

    So how to resize a widget to be larger than the screen?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,940
    Thanks
    231
    Thanked 619 Times in 609 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to resize QWidget to be larger than screen?

    Embed the QWidget inside of a QScrollArea and call QScrollArea::setWidgetResizable() with a "true" argument.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3

    Default Re: How to resize QWidget to be larger than screen?

    Thanks! I notice some widgets such as QWebEngineView can be larger than screen, so I wonder if there exists some function I can use to set a widget larger than screen as QWebEngineView is also a QWidget based class.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,940
    Thanks
    231
    Thanked 619 Times in 609 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to resize QWidget to be larger than screen?

    It might be possible with some widgets, but what is the point? If your widget is larger than the screen size, you can't see all of it so you will need to invent some way to scroll it around so you can see the parts that are off screen. That's the point of QScrollArea - it adds the UI controls needed for that.

    If you simply want to display a smaller area of your widget full screen without scrolling support, then that's what QPainter viewports and transformations are used for.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Mar 2019
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to resize QWidget to be larger than screen?

    widget->setGeometry(geometry())

    it will set new geometry of widget.

  6. #6

    Default Re: How to resize QWidget to be larger than screen?

    I tested QWebEngineView and found it can not be larger than screen, either. I want to expand QWebEngineView to fit its content, which is larger than screen, in order to render full web page into an image. Using QScrollArea to contain QWebEngineView does not work; the QWebEngineView contained in it is still constrained to screen size. I'm curious if this size constraint is what Qt is designed for all platforms, or just for Windows, or it is a bug on my system. I do not think it has no point to have a window larger than screen because you can drag the window bar to see the hidden part of window.


    Quote Originally Posted by d_stranz View Post
    It might be possible with some widgets, but what is the point? If your widget is larger than the screen size, you can't see all of it so you will need to invent some way to scroll it around so you can see the parts that are off screen. That's the point of QScrollArea - it adds the UI controls needed for that.

    If you simply want to display a smaller area of your widget full screen without scrolling support, then that's what QPainter viewports and transformations are used for.
    Quote Originally Posted by pdpanchal115 View Post
    widget->setGeometry(geometry())

    it will set new geometry of widget.
    Unfortunately, setGeometry can not set a size larger than screen, either.

  7. #7
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,940
    Thanks
    231
    Thanked 619 Times in 609 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to resize QWidget to be larger than screen?

    you can drag the window bar to see the hidden part of window.
    Only if the window bar (or some other draggable part of the window) is visible on screen. If the window is 2x the size of the screen in both x and y, and you center it on screen, then there is nothing to grab to drag unless you implement it as part of the widget. It is the window system (Windows) that puts the title bar and other handles on windows so you can drag them.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  8. #8

    Default Re: How to resize QWidget to be larger than screen?

    Quote Originally Posted by d_stranz View Post
    Only if the window bar (or some other draggable part of the window) is visible on screen. If the window is 2x the size of the screen in both x and y, and you center it on screen, then there is nothing to grab to drag unless you implement it as part of the widget. It is the window system (Windows) that puts the title bar and other handles on windows so you can drag them.
    Yes, you are right. If the window bar is hidden also, it would be hard to drag the window. But I see many applications(maybe not developed using qt) have windows larger than screen, so it would not be the constraint of Windows. It could cause problem in some cases. In my case, I cannot figure out how to render the whole web page in QWebEngineView to an image.

  9. #9
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,249
    Thanks
    36
    Thanked 1,508 Times in 1,459 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to resize QWidget to be larger than screen?

    Maybe QWebEngineView is setting a maximum size?

    Usually widgets don't have such a restriction but since WebEngineView is sharing a buffer with the rendering process it might have.

    Cheers,
    _

Similar Threads

  1. QGrapgicsView : Black screen when resize (not always)
    By Alundra in forum Qt Programming
    Replies: 0
    Last Post: 20th October 2016, 03:53
  2. Touch screen need larger (bigger) widgets
    By creatron in forum Qt Programming
    Replies: 0
    Last Post: 31st May 2014, 12:20
  3. QTableWidget resize to screen
    By Archa4 in forum Newbie
    Replies: 4
    Last Post: 31st March 2011, 11:37
  4. Detect screen rotation or resize
    By leoalvesmachado in forum Newbie
    Replies: 2
    Last Post: 9th April 2010, 01:20
  5. How to get screen resize event?
    By kamlesh.sangani in forum Qt Programming
    Replies: 8
    Last Post: 10th March 2010, 08:46

Tags for this Thread

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.