Results 1 to 6 of 6

Thread: How to display text messages without any buttons

  1. #1
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How to display text messages without any buttons

    Hi All,

    I want a piece of code where an qt app starts, it should display text messages(using setText) printed to Lineedit / textedit boxes.
    There should not be any buttons etc, just text boxes and display it as soon as application start.
    How to do this?

    Thanks & Regards,
    Arun

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

    Default Re: How to display text messages without any buttons

    Either use a splashscreen or a custom dialog box which you will feed with data.

  3. #3
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to display text messages without any buttons

    Thanks for reply. I modified my code and had text boxes in my custom dialog window.

    I am not getting any idea on calling a function which display text messages. How can I connect to that function which will display messages.
    Without any buttons how the application should call this display text function as soon as it start. Please help me out.

    Here is snippet of my code:
    Qt Code:
    1. TestWindow::TestWindow(QWidget* parent,Qt::WindowFlags f)
    2. : QDialog(parent, f)
    3. {
    4. setupUi(this);
    5. }
    6.  
    7. void TestWindow::displayText()
    8. {
    9. ...........
    10. ...........
    11. }
    To copy to clipboard, switch view to plain text mode 


    Thanks & Regards,
    Arun.
    Last edited by jpn; 1st February 2008 at 10:04. Reason: missing [code] tags

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

    Default Re: How to display text messages without any buttons

    What do you mean how should it call it? You have to call it in your code where you need it.

  5. #5
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to display text messages without any buttons

    Normally I use connect with the help buttons to call such functions.
    But here in this case as there are no buttons, how to use connect to call such slot functions.

    Here is my previous application example code:

    Qt Code:
    1. MainWindow::MainWindow(QMainWindow* parent)
    2. : QMainWindow(parent)
    3. {
    4. setupUi(this);
    5. QObject::connect(Start, SIGNAL(clicked()), this, SLOT(initializeEGUI()));
    6. QObject::connect(Stop, SIGNAL(clicked()), this, SLOT(stopEGUI()));
    7. }
    To copy to clipboard, switch view to plain text mode 

    Present application example code:
    Qt Code:
    1. MainWindow::MainWindow(QMainWindow* parent)
    2. : QMainWindow(parent)
    3. {
    4. setupUi(this);
    5. }
    6.  
    7. void MainWindow::displayText(GPSDataType *data)
    8. {
    9. Valid->setText(Q_valid.setNum(data->status));
    10. FixQuality->setText(Q_fixquality.setNum(data->fixquality));
    11. GroundSpeed->setText(Q_groundspeed.setNum(data->groundspeed, 'f', 3));
    12. --------------
    13. -------------
    14. ------------
    15. }
    To copy to clipboard, switch view to plain text mode 

    So my question is how to connect such slots without help of any buttons etc. As soon as application starts, the application should connect to displayText function and display the fields.

    Thanks & Regards,
    Arun.
    Last edited by jpn; 1st February 2008 at 21:32. Reason: missing [code] tags

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

    Default Re: How to display text messages without any buttons

    You can call the slot directly as it would be a normal method (actually it is a normal method). If you really need to connect to a slot, use a QTimer.

Similar Threads

  1. QLogText & QLogTable : 2 widgets to display text log
    By fcoiffie in forum Qt-based Software
    Replies: 7
    Last Post: 28th April 2019, 07:52
  2. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  3. Replies: 1
    Last Post: 19th May 2007, 05:19
  4. widget for text AND buttons
    By nongentesimus in forum Newbie
    Replies: 2
    Last Post: 16th June 2006, 13:43
  5. Can't change the text display of a QTreeview item.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2006, 01:03

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.