Results 1 to 20 of 20

Thread: Android: resizeevent in qt 5.3.1 does not detect orientation change anymore

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,329
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Android: resizeevent in qt 5.3.1 does not detect orientation change anymore

    In reading this thread, I am puzzled as to how the OP was able to use QResizeEvent to determine that the screen had been rotated. QResizeEvent contains absolutely no screen orientation information at all, just the old and new sizes of the *widget* to which it applies. If the OP was simply making the assumption that the orientation had changed by comparing width and height of the new and old rects, then that is a flawed interpretation of the event.

    I think I would be surprised if the resize event was sent at all after an orientation change, because the *widget* has not in fact undergone a change in size.

    I also fail to see why a connection can't be made to the QScreen::orientationChanged() signal from anywhere:

    Qt Code:
    1. QScreen * pScreen = QGuiApplication::primaryScreen();
    2. connect( pScreen, SIGNAL( orientationChanged( int ) ), this, SLOT( onScreenOrientationChanged( int ) ) );
    To copy to clipboard, switch view to plain text mode 
    where, of course, you have to write the slot code in your widget class to do whatever is required. Also note this important factoid from the docs:

    void QScreen::setOrientationUpdateMask(Qt::ScreenOrient ations mask)

    Sets the orientations that the application is interested in receiving updates for in conjunction with this screen.

    For example, to receive orientation() updates and thus have orientationChanged() signals being emitted for LandscapeOrientation and InvertedLandscapeOrientation, call setOrientationUpdateMask() with mask set to Qt::LandscapeOrientation | Qt::InvertedLandscapeOrientation.

    The default, 0, means no orientationChanged() signals are fired.
    (emphasis mine).

    If I were to make a guess, if the application sets this flag at the outset, there would be no need to handle orientationChanged() signals at all. The app would probably automatically rotate everything on its own. That the default setting is to ignore orientation changes implies that rotating the screen would have no effect on the app's orientation.
    Last edited by d_stranz; 24th August 2014 at 21:51.

Similar Threads

  1. detect system time change
    By ahmdsd_ostora in forum Qt Programming
    Replies: 5
    Last Post: 29th October 2019, 12:04
  2. Replies: 1
    Last Post: 19th July 2013, 23:20
  3. QLineedit's text orientation change
    By vivek.panchal in forum Qt Programming
    Replies: 0
    Last Post: 4th March 2013, 13:56
  4. QFileSystemWatcher best way to detect change
    By hakermania in forum Qt Programming
    Replies: 2
    Last Post: 12th October 2011, 15:51
  5. Change QTableView orientation
    By r2d2u2 in forum Qt Programming
    Replies: 2
    Last Post: 31st May 2010, 10:30

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.