menuBar()->addMenu(FileMenu);
EditMenu=new QMenu(QString("&Edit"));
EditMenu->addAction(tr("Co&nfig"), this, SLOT(lsconfig()), QKeySequence(tr("Ctrl+N", "Edit|Co&nfig")));
+ EditMenu->addAction(tr("c&reate database"), this, SLOT(createdb()), QKeySequence(tr("Ctrl+R", "Edit|Database")));
menuBar()->addMenu(EditMenu);
HelpMenu=new QMenu(QString("&Help"));
HelpMenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt()), QKeySequence(tr("ctrl+H", "About Qt")));
q->prepare(a);// make it
q->exec();// do it
QSqlError b=q->lastError();
- if (b.isValid())qDebug()<<"q->lastError():"<<b;
+ if (b.isValid())qDebug()<<"q->lastError():"<<b.text();
return q->size();
}
int MainWindow::alias(const QString & a){
flux << a << endl;
fichier.close();
qDebug()<<a<<" content added into file";
- q->prepare("INSERT INTO raw (date, texte) VALUES (:date :texte);");
+ q->prepare("INSERT INTO raw (date, texte) VALUES (:date, :texte);");
q->bindValue(":date", v.currentDateTime().toString(QString("yyyy-MM-dd hh:mm:ss")));
q->bindValue(":texte", texte->text());
q->exec();
+ QSqlError b=q->lastError();
+ if (b.isValid())qDebug()<<"q->lastError():"<<b.text();
texte->clear();
-
+}
+int MainWindow::createdb(){
+ exec(QString("create table ui(keyword text, label text, sql text);"));
+ exec(QString("create table raw(date timestamp, text text);"));
}