Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. My QSqlTableModel displaying userid as 1 for all Rows
Forum Updated to NodeBB v4.3 + New Features

My QSqlTableModel displaying userid as 1 for all Rows

Scheduled Pinned Locked Moved Solved Mobile and Embedded
2 Posts 1 Posters 338 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ChickenTurtleC Offline
    ChickenTurtleC Offline
    ChickenTurtle
    wrote on last edited by VRonin
    #1
     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.

    1 Reply Last reply
    0
    • ChickenTurtleC Offline
      ChickenTurtleC Offline
      ChickenTurtle
      wrote on last edited by
      #2

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

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved