Results 1 to 20 of 21

Thread: alternative to QMessageBox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default alternative to QMessageBox

    Ok, I am thick, I can't even call it from my code.

    Qt Code:
    1. sendMsg sendMsg_dlg( this );
    2. if ( sendMsg_dlg.exec() )
    3. {
    4. WaitDialog::WaitDialog(200,sendMsg);
    5. }
    To copy to clipboard, switch view to plain text mode 
    This does not compile:
    447 C:\root\dev\Qt\sms data\sms\menu.cpp expected primary-expression before '(' token
    447 C:\root\dev\Qt\sms data\sms\menu.cpp expected primary-expression before ')' token

    All I am doing is trying random combination, without really understanding all to call your class. Hopeless

    But elsewhere I managed to set an icon to my application without asking on the forum. lol
    Last edited by incapacitant; 22nd May 2006 at 18:38.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: alternative to QMessageBox

    You should learn instead of shooting random. I won't give you the exact code, let it be your homework for today to think and learn how to do it. I'll give you a hint though. You use this dialog like any other dialog. The only difference is the time to wait parameter which you have to use while constructing the dialog.

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

    incapacitant (22nd May 2006)

  4. #3
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default alternative to QMessageBox

    ok, I already understood the way you think about all this and I think it is 100% sane.
    I will search and try... thanks

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: alternative to QMessageBox

    You don't have to search. Just look at the code you already have and *think*.

  6. The following user says thank you to wysota for this useful post:

    incapacitant (22nd May 2006)

  7. #5
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default alternative to QMessageBox

    You say that I should consider this dialog as any other one, so I think I found out how to instantiate it as it compiles :

    Qt Code:
    1. waitDialog_dlg = new WaitDialog::WaitDialog(200, this);
    To copy to clipboard, switch view to plain text mode 

    The trouble now is to invoke the dialog :
    Qt Code:
    1. if ( waitDialog_dlg.exec() )
    2. {
    3. }
    To copy to clipboard, switch view to plain text mode 

    compile error :
    445 C:\root\dev\Qt\sms data\sms\menu.cpp `exec' has not been declared

    With :
    Qt Code:
    1. if ( WaitDialog::waitDialog_dlg.exec() )
    2. {
    3. }
    To copy to clipboard, switch view to plain text mode 

    compile error :
    445 C:\root\dev\Qt\sms data\sms\menu.cpp `waitDialog_dlg' is not a member of `WaitDialog'

    waitDialog_dlg is a member of my ApplicationWindow class like my other dialogs.
    Qt Code:
    1. class ApplicationWindow: public QMainWindow
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. ApplicationWindow();
    7. ~ApplicationWindow();
    8.  
    9. // dialog
    10. Destinataires *Destinataires_dlg;
    11. Archives *Archives_dlg;
    12. sendMsg *sendMsg_dlg;
    13. WaitDialog *waitDialog_dlg;
    To copy to clipboard, switch view to plain text mode 


    I tried to declare the dialog in the WaitDialog class but things get worse...

  8. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: alternative to QMessageBox

    Oh man... I hate to do this, but I suggest you learn some C++ before trying with Qt.

    Check out our links section, especially the one with C++ links. You should start with Thinking in C++ and Correct C++ Tutorial.

  9. The following user says thank you to wysota for this useful post:

    incapacitant (23rd May 2006)

  10. #7
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default alternative to QMessageBox

    ok, I will read. Thanks.

  11. #8
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: alternative to QMessageBox

    Qt Code:
    1. waitDialog_dlg = new WaitDialog(200, this);
    To copy to clipboard, switch view to plain text mode 
    a life without programming is like an empty bottle

  12. The following user says thank you to zlatko for this useful post:

    incapacitant (23rd May 2006)

  13. #9
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default alternative to QMessageBox

    zlatko:
    Thanks I have done that bit to instantiate the dialog.
    The trouble remains how to call, display and start the dialog and its timer

  14. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: alternative to QMessageBox

    Please learn it yourself.

  15. #11
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default alternative to QMessageBox

    I knew zlatko was going to get trouble. Yes, master. I have downloaded the books.

  16. #12
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default alternative to QMessageBox

    wysota: It is true that I have to learn, and I thank you for your attitude.

    For info, your class had a bug, the correct code is :
    Qt Code:
    1. class WaitDialog : public QDialog {
    2. public:
    3. WaitDialog(uint interval, QWidget *p=0) : QDialog(p)
    4. {
    5. QVBoxLayout *l = new QVBoxLayout(this);
    6. QLabel *lab = new QLabel("Please wait");
    7. l->addWidget(lab);
    8. setLayout(l);
    9. timer.setSingleShot(true);
    10. timer.setInterval(interval);
    11. connect(&timer, SIGNAL(timeout()), this, SLOT(accept()));
    12. }
    13.  
    14. int exec() // rather than void
    15. {
    16. timer.start();
    17. return QDialog::exec(); // needed return
    18. }
    19.  
    20. private:
    21. QTimer timer;
    22. };
    To copy to clipboard, switch view to plain text mode 

    Then to call it :
    Qt Code:
    1. WaitDialog waitDialog_dlg( 2000, this );
    2. if ( waitDialog_dlg.exec() )
    3. {
    4. }
    To copy to clipboard, switch view to plain text mode 

    I learn slowly, but I am stubborn and I will get there.

Similar Threads

  1. QMessageBox missing icon
    By zanth in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2010, 21:20
  2. QMessageBox buttons appearance
    By yartov in forum Qt Programming
    Replies: 6
    Last Post: 26th June 2008, 01:36
  3. Display row Number in QMessageBox
    By arunvv in forum Newbie
    Replies: 6
    Last Post: 1st May 2008, 23:24
  4. Re: Help on QMessageBox
    By arunvv in forum Newbie
    Replies: 2
    Last Post: 25th March 2008, 23:45
  5. QMessageBox problem in Qtopia
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 8th February 2008, 09:22

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.