PDA

View Full Version : How to display text messages without any buttons



arunvv
31st January 2008, 21:34
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

wysota
31st January 2008, 21:39
Either use a splashscreen or a custom dialog box which you will feed with data.

arunvv
1st February 2008, 00:20
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:

TestWindow::TestWindow(QWidget* parent,Qt::WindowFlags f)
: QDialog(parent, f)
{
setupUi(this);
}

void TestWindow::displayText()
{
...........
...........
}


Thanks & Regards,
Arun.

wysota
1st February 2008, 09:52
What do you mean how should it call it? You have to call it in your code where you need it.

arunvv
1st February 2008, 17:42
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:


MainWindow::MainWindow(QMainWindow* parent)
: QMainWindow(parent)
{
setupUi(this);
QObject::connect(Start, SIGNAL(clicked()), this, SLOT(initializeEGUI()));
QObject::connect(Stop, SIGNAL(clicked()), this, SLOT(stopEGUI()));
}

Present application example code:

MainWindow::MainWindow(QMainWindow* parent)
: QMainWindow(parent)
{
setupUi(this);
}

void MainWindow::displayText(GPSDataType *data)
{
Valid->setText(Q_valid.setNum(data->status));
FixQuality->setText(Q_fixquality.setNum(data->fixquality));
GroundSpeed->setText(Q_groundspeed.setNum(data->groundspeed, 'f', 3));
--------------
-------------
------------
}

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.

wysota
1st February 2008, 18:10
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.