I want to code a notification window at the bottom right corner of the desktop, so it works like Skype notifications when someone comes online. Can someone help me get the screen size of the desktop, so I can place my notification window at the bottom right corner using my Qt Application?
You can use the QDesktopWidget
QRect rec = QApplication::desktop()->screenGeometry();
height = rec.height();
width = rec.width();
QScreen class (since Qt 5.0) provide information about size of screen (logical and physical), orientation and signals for changes.
QScreen *screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
int height = screenGeometry.height();
int width = screenGeometry.width();
upd:
QList <QScreen*> screens = QGuiApplication::screens();
screen->orientation()
and (since Qt 5.2)screen->nativeOrientation()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With