Results 1 to 3 of 3

Thread: Onde datatable with difirent cursors

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: One datatable with difirent cursors

    Try:
    Qt Code:
    1. void QFormAdmin::OnPhysicTbPressed(int nId)
    2. {
    3. // Do, or do not. There is no try. ;)
    4. const int nCols = dtMain->numCols();
    5. for (int i=0; i<nCols; i++) {
    6. dtMain->removeColumn(0);
    7. }
    8.  
    9. switch(nId)
    10. {
    11. // виклик редактора гілок
    12. case 1:
    13. {
    14. QSqlSelectCursor* curBr = new QSqlSelectCursor( ... );
    15.  
    16. dtMain->setSqlCursor(curBr,false,true );
    17.  
    18. dtMain->addColumn("deleted", tr("Імя1"));
    19.  
    20. dtMain->refresh( QDataTable::RefreshAll );
    21. break;
    22. }
    23.  
    24. // виклик редактора контролерів
    25. case 2:
    26. {
    27. QSqlSelectCursor* curCtl = new QSqlSelectCursor( ... );
    28.  
    29. dtMain->setSqlCursor(curCtl,false,true );
    30.  
    31. dtMain->addColumn("description", tr("Імя"));
    32. ...
    33. dtMain->addColumn("ip_address", tr("IP-адрес"));
    34.  
    35. dtMain->refresh( QDataTable::RefreshAll );
    36. break;
    37. }
    38. }
    39. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to jacek for this useful post:

    zlatko (28th April 2006)

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.