Results 1 to 5 of 5

Thread: how i can do like this image

  1. #1
    Join Date
    Jul 2013
    Posts
    54
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question how i can do like this image

    Hi, every body

    i have a probleme with inserting a row from a table call tableProduct to another table call tableSalle

    when the user click entre key in the first table “tableProduct”

    i can’t figured out, how this work

    this is an image explains what i means

    sell1.jpg


    i think we implement insertrow function


    bool MyModel::insertRows(int position, int rows, const QModelIndex &parent)
    {
    beginInsertRows(QModelIndex(), position, position+rows-1);
    // i want to get the event when the user click "Keydown"
    if (true)
    {
    // we add row with empty fields to allow user to fill them
    }


    endInsertRows();
    return true;
    }

  2. #2
    Join Date
    Jul 2013
    Posts
    54
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how i can do like this image

    no body can help me ??

  3. #3
    Join Date
    Jan 2012
    Location
    Argentina
    Posts
    167
    Thanks
    33
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how i can do like this image

    You need to capture the signal click on the different tables, to move the rows to the table of interest. For example if you want to do it field by field, you can use
    Qt Code:
    1. QTableWidgetItem *newItem = new QTableWidgetItem ("No Data");
    2. newItem->setData (Qt::DisplayRole, prixVenteU);
    To copy to clipboard, switch view to plain text mode 
    that for the last field, and so on. After saving the value you insert it on the table you want. Try giving some code next time.
    Last edited by KillGabio; 24th July 2013 at 04:26. Reason: code instead of quote

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how i can do like this image

    I am going to assume the top table is a QTableWidget and the lower table is a QTableView that is displaying a separate model of some sort (the picture is not very helpful). When the user triggers the insert you need to:
    • Call insertRow() on the model underlying the lower table to insert a 'blank' row.
    • Keep a note of the new row number.
    • For each column in the top table:
      • Get the value in the column from the QTableWidgets model's data() function or through a QTableWidgetItem.
      • Create a QModelIndex in the lower model for the new row and column you want to put the value into.
      • Call setData() on the lower model to update the cell

  5. #5
    Join Date
    Jul 2013
    Posts
    54
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how i can do like this image

    example for application that uses this kind of thing is “ Inventory management system” like inflow inventory

    if the image is not helpful try this video, maybe you understandme , sorry for my english

    https://www.youtube.com/watch?v=hkfmZwuc-YY

Similar Threads

  1. Replies: 4
    Last Post: 15th May 2013, 13:58
  2. Replies: 3
    Last Post: 3rd August 2012, 10:35
  3. Replies: 1
    Last Post: 18th January 2012, 10:00
  4. Replies: 6
    Last Post: 21st September 2009, 10:55
  5. Replies: 3
    Last Post: 14th March 2007, 08:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.