Results 1 to 4 of 4

Thread: Create and Use a status dialog

  1. #1
    Join Date
    Jan 2016
    Posts
    5
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Create and Use a status dialog

    I would like to create and use a dialog to hold user and application status. Similar in nature to the progress bar, but using words. The dialog itself is is a QTextEdit set to read-only. What would be the best way to get information to the dialog, both from other Qt dialogs (e.g. mouse pick information) and analysis code (e.g. information where at in an algorithm).

    Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Create and Use a status dialog

    I would implement slots in the dialog to receive information and update the dialog's text. Create signals in the application that are emitted when the status changes. When you create the dialog, connect those signals to the proper slots in the dialog.

    When you show the dialog, be sure you do it using show() and not exec(), otherwise the dialog will be modal and you will not be able to interact with anything else in your app.

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

    JAD (29th January 2016)

  4. #3
    Join Date
    Jan 2016
    Posts
    5
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Create and Use a status dialog

    Thanks.

    I am attempting to do this with some success.

    I am able to emit a int or QString signal from a QCLWidget and the slot is called.

    When I emit the same int and QString signals from another dialog nothing happens.

    The signals, emit() and connect() are set the same.

    extern DisplayOptionsDialog * displayOptionsDialog;
    extern GLWidget *glWidget;

    connect(displayOptionsDialog, SIGNAL(updateStatus(QString)), this, SLOT(WriteStatus(QString))):
    connect(displayOptionsDialog, SIGNAL(updateStatus2(int)), this, SLOT(WriteStatus2(int)));

    connect(glWidget, SIGNAL(updateStatus(QString)), this, SLOT(WriteStatus(QString))):
    connect(glWidget, SIGNAL(updateStatus2(int)), this, SLOT(WriteStatus2(int)));

    Thanks!


    Added after 1 5 minutes:


    I figured it out, the displayOptionsDialog wasn't yet created. This is how:

    I am using Visual Studio 2013. In Debug Configuration

    Right click on application -> Properties -> Configuration Properties -> Debugging -> Environment -> <Edit...>

    Add the line:

    QT_FATAL_WARNINGS=1

    I then ran the program in debug, no breaks set. It broke on the line connect(displayOptionsDialog,...) line and which allowed me to interrogate the variables and see that displayOptionsDialog hadn't been created.
    Last edited by JAD; 29th January 2016 at 17:23.

  5. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Create and Use a status dialog

    Insufficient information. I presume you mean that the "DisplayOptionsDialog" is the one that doesn't work.

    1 - When the dialog instance is shown, is is modal (invoked using exec()) or non-modal (invoked using show())? If it is modal, it is running its own event loop and blocking the app's event loop.
    2 - Are the pointers correct? I.e. are they pointing to the instances you think they are?
    3 - Does the class definition declare updateStatus() and updateStatus2() in a "signals:" section?

    ---
    In response to your edit, then the problem was addressed by my question #2.

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

    JAD (1st February 2016)

Similar Threads

  1. how to create circular dialog
    By Askar in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2012, 18:34
  2. Replies: 3
    Last Post: 8th July 2010, 08:41
  3. Create a numeric keypad Dialog
    By gt.beta2 in forum Newbie
    Replies: 11
    Last Post: 27th January 2009, 17:40
  4. How to create a save as dialog box?
    By gurinder in forum Qt Programming
    Replies: 1
    Last Post: 6th February 2008, 14:01
  5. how to create a popup dialog
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 19th November 2006, 17:40

Tags for this Thread

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.