QMessageBox with a timeout



  • Hello

    I like the message box of Outlook: When you receive a mail, a message box appears in the lower right corner. It remains visible a few seconds, becomes transparent and smoothly disappears after a while.

    This is a nice UI feature: you get informed but you aren't disturbed by the message (you don't have to click OK every minute).

    It would be nice to have the same feature in QMessageBox. (Just like what already exists with QStatusBar)

    @QMessageBox::information(this, tr(“New in 4.8”), tr(“Now, a QMessageBox can disappear after a timeout”), 2000);@

    I hope it can help

    Laurent



  • Of course you can mimic this using some construction like:

    @QMessageBox *mbox = new QMessageBox;
    mbox->setWindowTitle(tr("Title"));
    mbox->setText("Let this disappear automagically");
    mbox->show();
    QTimer::oneShot(2000, mbox, SLOT(hide()));@



  • Nice and simple Franzk



  • Well, I've made something similar, with a QTimer piloting the windowOpacity property, so that the message box smoothly disappears.

    I like the result. Hence, it'd be nice to have it... a cuter Qt



  • laurent bauer wrote:

    bq. Well, I’ve made something similar, with a QTimer piloting the windowOpacity property, so that the message box smoothly disappears. I like the result.

    Great to hear it. You must post your code in the wiki "here":http://developer.qt.nokia.com/wiki/Category:snippets :)



  • When i start work with Remote Desktop Client I starting hate animation effects in application. I think developers must add options when user can disable effects. Just keep it in mind.



  • [quote author="SABROG" date="1283839928"]When i start work with Remote Desktop Client I starting hate animation effects in application. I think developers must add options when user can disable effects. [/quote]

    I agree. I think that in general people try to make their applications too fancy. Fancy is good as long as it improves the tasks you support or improve the user interface. The ability to switch off eye candy is a good trade off as far as I'm concerned.



  • I agree somehow. However... A tool and its usage are two different things.

    Take an axe. One would cut wood to heat its family home, another one would cut its family with it ;o) . Is the axe responsible? No, it's the usage made of it.

    I remember when VGA appeared, all the ugly colored applications that were imagined. "Long life black & white!". Fortunately color survived.

    Don't kill animations too quick... (or kill quick... ;o) )



  • [quote author="laurent bauer" date="1283895325"]laurent bauer wrote:
    Don't kill animations too quick... (or kill quick... ;o) )
    [/quote]

    when I saw it for the first time in Qt, I loved the animations which were available for the basic qt widgets (e.g. tree expanding/collapsing) .. never felt like I'm loosing on performance or response time



  • Yes, in fact they hide when performance is sub-optimal.

    I read this thread a long time ago (before I was registered on here) and implemented it using Qt4.7.
    There's a workaround, involving adding a timer (first reply shows how to do it).

    It works quite well as a notification for loading files/images and such. I really wish more developers used it -- especially on Windows/Symbian where you get annoyed by boxes all the time.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.