Results 1 to 3 of 3

Thread: How to disable mouse click over a QSplashScreen

  1. #1
    Join Date
    Sep 2008
    Location
    Portugal
    Posts
    171
    Thanks
    57
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to disable mouse click over a QSplashScreen

    Hi,
    This example show me a splash screen for 5 seconds, an then the main window.
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3. #include <QSplashScreen>
    4. #include <QTimer>
    5.  
    6. int main(int argc, char *argv[])
    7. {
    8. QApplication a(argc, argv);
    9. splash->setPixmap(QPixmap("f0.png"));
    10. splash->show();
    11. splash->showMessage(QObject::trUtf8("A preparar a janela principal ..."), Qt::AlignRight|Qt::AlignTop, Qt::black);
    12. MainWindow w;
    13. QTimer::singleShot(5000, splash, SLOT(close()));
    14. QTimer::singleShot(5000, &w, SLOT(show()));
    15. return a.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 

    During those 5 secs if i click on the QSplassScreen i have "nothing" until the main window shows up.

    Can i disable the possibiliti of clicking on the splashscreen?

    Thanks

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to disable mouse click over a QSplashScreen

    use eventFilter
    bool QObject::eventFilter ( QObject * watched, QEvent * event ) [virtual]
    and disable the mouse click event ..
    "Behind every great fortune lies a crime" - Balzac

  3. The following user says thank you to wagmare for this useful post:

    graciano (8th November 2009)

  4. #3
    Join Date
    Sep 2008
    Location
    Portugal
    Posts
    171
    Thanks
    57
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to disable mouse click over a QSplashScreen

    Hi,
    I did something like this:

    Qt Code:
    1. #include "mysplash.h"
    2.  
    3. mySplash::mySplash(QWidget *parent)
    4. :QSplashScreen(parent)
    5. {
    6. this->installEventFilter(this);
    7. }
    8.  
    9. bool mySplash::eventFilter(QObject *target, QEvent *event){
    10. return true;
    11. }
    To copy to clipboard, switch view to plain text mode 

    Now it filters EVERYTHING right?
    Nothing can kill mySplash

Similar Threads

  1. Replies: 1
    Last Post: 10th July 2009, 09:54
  2. Word at mouse click position in QGraphicsTextItem
    By pherthyl in forum Qt Programming
    Replies: 2
    Last Post: 3rd November 2008, 04:56
  3. Disable QTextCursor Mouse click repositioning
    By VireX in forum Qt Programming
    Replies: 2
    Last Post: 3rd April 2007, 08:08
  4. Replies: 1
    Last Post: 9th February 2007, 09:41

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.