Making a floatable widget in Qt
-
In my aplication when there shall be some validation happens, i need a widget or messagebox kind of concept which will pop up in the RIGHT HAND SIDE BOTTOM of my application for some time (for 5-10 sec) , after that specific time it should disapper ..
Can anyone give any idea how to implement this thing
-
A QLabel seems to be a good candidate, if you apply some QSS styles or custom painting.
-
for eg- when we are getting a mail in outlook some indication is being displayed in the rigt side corner .. i have to implment the same in my application ...
could you please give a small example on this ?? -
Take a look at "QFrame":http://qt-project.org/doc/qt-4.8/qframe.html it might give you a lot of styling options. QLabel inherits from QFrame.
Example? I'm kind of not in the mood for that, and quite busy, too. So just a quick, untested prototype:
@
QLabel *mylab = new QLabel(this);
mylab->setText("Blah blah");
mylab->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
mylab->setStyle("background: yellow"); // I don't remember inlined QSS syntax here, check docs for that
mylab->move(someX, someY); // Or use layouts, or modality, but that would be tricky and requre testing
@ -
is there any functionality to know the coordinate of the laptop screen (right hand side bottom ) ?
-
I don't know. I thought you meant bottom right corner of your window.
-
yes , bottom right corner ..
-
How about using [[doc:QDesktopWidget]] for information like that?
-
through QDesktopWidget we can know the coordinates of the bottom right corner of the desktop ..
is there any way to know the coordinates of bottom right corner of the application ? -
Are you serious?
Just take x() + width() and y() + height()... or make use of QWidget::geometry().
-
Use QWidget::frameGeometry() to get the size and position of the window including the surrounding decorations.