Results 1 to 2 of 2

Thread: script tableview problems..

  1. #1
    Join Date
    Mar 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    2

    Default script tableview problems..

    hi,
    how can I set the following properties using script... atleast I didnt find any prototype or properties to set this. And I wonder paint and resize event is not also available......any idea is appreciating

    setAutoScroll(false);
    setSelectionMode(QAbstractItemView.SingleSelection );
    setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff );
    setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff);

    thanks
    Last edited by akon; 6th April 2009 at 16:30.

  2. #2
    Join Date
    Mar 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    2

    Default Re: script tableview problems..

    function XPainter (parent){
    QAbstractItemDelegate.call(this, parent);
    }

    XPainter.prototype= new QAbstractItemDelegate();

    XPainter.prototype.sizeHint = function (option, index){
    return new QSize(45,45);
    }

    XPainter.prototype.paint= function(painter,option,index){
    if (option.state & QStyle.State_Selected)
    {
    painter.fillRect(option.rect, QColor(0,60,38));
    }
    // painter.setPen(QColor(254,251,236));
    // var rect= option.rect;
    // painter.drawText(rect.x, rect.y, rect.width, rect.height, Qt.AlignCenter, "tech", //undefined);
    delete painter;
    }

    function mViewModel(parent,cdate)
    {
    QTableView.call(this, parent);
    var xModel = new XMODEL(parent,fstDate);
    initView = new QTableView(parent);

    initView.setModel(xModel);
    var selectionModel = new QItemSelectionModel(xModel);
    initView.setSelectionModel(selectionModel);
    initView.cornerButtonEnabled=false;
    var xPainter = new XPainter(this);
    initView.setItemDelegate(xPainter);
    }

    if I setItemDelegate, I cant see any data in tableview. model and data set is fine, i just started scripting...so plz any kind of sugges.. will be helpful
    Last edited by akon; 7th April 2009 at 10:02.

Similar Threads

  1. Testing app with Qt Script
    By Angelo Moriconi in forum Qt Programming
    Replies: 5
    Last Post: 23rd October 2007, 09:20
  2. How to use PERL script in Qt
    By joseph in forum Qt Programming
    Replies: 1
    Last Post: 9th August 2007, 22:57
  3. Drag an item from QTreeWidget and drop in TableView
    By steg90 in forum Qt Programming
    Replies: 8
    Last Post: 18th May 2007, 12:42
  4. TreeView, TableView
    By rbrand in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2006, 09:54
  5. Modified tableview
    By dkite in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2006, 02:58

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.