My QSqlTableModel displaying userid as 1 for all Rows



  •  QSqlRecord record = this->record();
                qDebug() << user_id <<user_name;
                record.setValue("user_name", user_name);
                record.setValue("users_ids", user_id);
                record.setValue("user_type", user_type);
                record.setValue("create_datetime", create_datetime);
                record.setValue("msg_satus", msg_satus);
                record.setValue("friend_request", friend_request);
                record.setValue("post_status", post_status);
                if(this->insertRecord(-1, record)){
                    qDebug()<<"successful insertion";
                    this->submitAll();
                }
                else{
                }
    

    My Qml Code is following

     SimpleRow {
            image.radius: image.height
            image.fillMode: Image.PreserveAspectCrop
            autoSizeImage: true
            text: user_name.toString();
            detailText: users_ids.toString();
            style.showDisclosure: false
            imageMaxSize: dp(48)
            detailTextItem.maximumLineCount: 3
            detailTextItem.elide: Text.ElideRight
            onSelected : {
                globalNavStack.popAllExceptFirstAndPush(detailPageComponent, {
                                                            person: text,
                                                            newMsgs: [{me: true, text: detailText}]
                                                        })
            }
    
    

    in place of user id it displaying name as what i passed and userid as 1. but i am passing userid as someid. But same related code displaying the content what i am passing.

    Can any one help me out of this.



  • Yah i got solution for this. i.e arranging roles in order how database tables are. Thank you.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.