Hi all,
I'm developing a program for my final year project in Nokia using Qt. In that i need to send an sms using Qt Mobility. I used the code below
mainwindow.cpp
mainwindow.hCode:#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QObject::connect(&service,SIGNAL(stateChanged(QMessageService::State)),this,SLOT(stateChanged(QMessageService::State))); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_toolButton_clicked() { QMessage message; message.setType(QMessage::Sms); message.setTo(QMessageAddress(QMessageAddress::Phone,"+919791504579")); message.setBody("Hi this is the message"); if(service.send(message)) { QMessageBox::information(this,"","Message Sent!"); } } void MainWindow::stateChanged(QMessageService::State s) { if(s==QMessageService::ActiveState) QMessageBox::information(this,"State","Active State"); if(s==QMessageService::InactiveState) QMessageBox::information(this,"State","Inactive State"); if(s==QMessageService::CanceledState) QMessageBox::information(this,"State","Cancelled State"); else QMessageBox::information(this,"State","Finished"); }
and when clicking the button is shows that messsage is sent, but when I click the button for the second time the Application Output in the Qt Creator shows that Action is currently busy and after pressing the exit it shows this errorCode:#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QMessage> #include <QMessageService> #include <QMessageAddress> #include <QMessageBox> QTM_USE_NAMESPACE namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; QMessageService service; private slots: void on_toolButton_clicked(); void stateChanged(QMessageService::State); }; #endif // MAINWINDOW_H
QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
I think I,m using Qt Mobility version 4.6. Is there anything that I have done wrong. Kindly help me because I have less time to finish my final year project.



