The
To call
is derived from this class have a QSqlTableModel and submitted later to call it all () slot After the broke, here's the code.
Thanks for the help.
Customs.
#ifndef VWrealTABLEMODEL_H # Defined VWtraTABLEMODEL_H #include & lt; QSqlTableModel & gt; Class GraphicsPoint Landmark Unit; Class VWLandmarkTableModel: public QSqlTableModel {Q_OBJECT public: enum column {IdColumn = 0, IdImageColumn = 1, UsernameColumn = 2, NameColumn = 3, DefinitionColumn = 4}; VWLandmarkTableModel (QObject * Parents = 0); Int idImage () const {returns m_idImage; } Caststring user name () const {return m_username; } Zero set IDImage (Int idmage); Zero set USURN (Consteststring and Usman); Select Virtual Bull (); Bool insertPoint (GraphPoint Landmark item * item); Hint: Protected: Virtual Zero Set Filter (Constricted Strings and Filters) {QSqlTableModel :: setFilter (Filters); } Insert the Virtual Bull RowIntoTable (QSqlRecord & amp; value); Protected slots: zero set defaults (int row, QSclockRock & amp; amp; R); Private: QString m_username; Int m_idImage; }; #endif // VWLDTABLEMODEL_H # included "vwlandmarktablemodel.h" #includes & lt; QtGui & gt; #include & lt; QtSql & gt; # Include & lt; QtCore & gt; #include "graphicspointlandmarkitem.h" VWLandmarkTableModel :: VWLandmarkTableModel (QObject * parent): QSqlTableModel (original) {setTable ( "vwLandmark"); SetEditStrategy (OnManualSubmit); Connect (this signal (Prime insert (Int, Kyuessielarkord and amp)), slots (set Difolts (Int, Kyuessielarkord and amp));} void VWLandmarkTableModel :: setIdImage (int idImage) {m_idImage = idImage;} void VWLandmarkTableModel: : setUsername (const QString and user name) {m_username = username;} Bool VWLandmarkTableModel :: select () {Q_ASSERT (! username). IsEmpty ()); QString stmt = "IdImage =% 1 and user name = '% 2'"; SetFilter (.stmt.arg (idImage ()) arg (user name ())); Return QSqlTableModel :: Select (); } Bool VWLandmarkTableModel :: insertPoint (GraphicsPointLandmarkItem * Item) {QString text; QTextStream Out (& Text); Int row = rowCount (); Hair is fine; OK = insertRow (line); Q_ASSERT (OK); QModelIndex idx = index (line, definition column); From the outset & lt; & Lt; * item; OK = SetData (idx, text); Q_ASSERT (OK); Idx = index (row, name column); OK = Setdata (idx, tr ("new point milestone")); Q_ASSERT (OK); Okay; } Bool VWLandmarkTableModel :: insertRowIntoTable (const QSqlRecord and value) {QString sql = "EXEC InsertLandmark: IdImage ,: definition"; QSqlQuery q; Hair is fine; Ok = q.prepare (sql); Q_ASSERT (OK); Q.bindValue (": IdImage", values.value ("IdImage")); Q.bindValue (": Definition", values.value ("definition")); Q.setForwardOnly (true); If (! Q.exec ()) {setLastError (q.lastError ()); return false; } QDebug () & lt; & Lt; "Hola Mundo"; Back true; } Zero VWLandmarkTableModel :: setDefaults (int row, QSqlRecord & amp; r) {r.setValue ("IdImage", idImage ()); R.setValue ("name", "anonymous delimited"); R.setValue ("username", user name ()); } The problem was in my custom selection Calling Set Filter () An Infinite Calling Loop Reason Is created
Comments
Post a Comment