Results 1 to 9 of 9

Thread: How to make a column read-only in QSqlRelationalTableModel?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make a column read-only in QSqlRelationalTableModel?

    Let me explain more in our .h we call relationaltable below,

    QSqlRelationalTableModel *model = new QSqlRelationalTableModel;
    model->setTable("stokdakiler");
    model->setFilter("stokid = " + Stokid);
    model->setEditStrategy(QSqlRelationalTableModel::OnField Change);
    model->setRelation(2, QSqlRelation("marka", "markaid", "marka"));
    model->setRelation(4, QSqlRelation("birimler", "birimid", "birim"));
    model->select();

    table->setModel(model);
    table->resizeColumnsToContents ();
    table->resizeRowsToContents ();
    table->setColumnHidden (0, true);
    table->setColumnHidden (1, true);
    table->setItemDelegate(new QSqlRelationalDelegate(tablestokda));
    table->setSortingEnabled (true);

    And after this what should we do?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make a column read-only in QSqlRelationalTableModel?

    You should substitute all occurences to QSqlRelationalTableModel with "MyModel" (based on the code I have given you - if you change the class name, change it here as well).

  3. The following user says thank you to wysota for this useful post:

    aekilic (28th May 2007)

  4. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to make a column read-only in QSqlRelationalTableModel?

    Quote Originally Posted by aekilic View Post
    Let me explain more in our .h we call relationaltable below,
    And after this what should we do?
    Build it..

    other crude sample....
    http://www.qtcentre.org/forum/f-qt-s...dmin-6807.html

  5. The following user says thank you to patrik08 for this useful post:

    aekilic (28th May 2007)

  6. #4
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make a column read-only in QSqlRelationalTableModel?

    Thank you very much both of you, we were able to solve the problem easly!

Similar Threads

  1. QIODevice read()
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 00:29
  2. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43
  3. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  4. Replies: 0
    Last Post: 10th November 2006, 13:46
  5. hidden QListView column suddenly visible
    By edb in forum Qt Programming
    Replies: 10
    Last Post: 27th January 2006, 08:00

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.