Results 1 to 2 of 2

Thread: QModelIndex.column() error in QColumnView?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Unhappy QModelIndex.column() error in QColumnView?

    Hello.
    I have pretty simple QColumnView and I have assigned to it simple model:

    Qt Code:
    1. QColumnView *columnView = new QColumnView(this);
    2.  
    3. QStandardItem *parentItem = model->invisibleRootItem();
    4. for (int i = 0; i < 4; ++i) {
    5. QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
    6. parentItem->appendRow(item);
    7. parentItem = item;
    8. }
    9.  
    10. columnView->setModel(model);
    To copy to clipboard, switch view to plain text mode 

    But now when I for example use signal QColumnView::activated(const QModelIndex &index), the index.row() and index.column() is always 0, no matter on what item I click. And it's same also for other signals/functions. Is it a bug or am I doing something wrong? I just need to know, what item in QColumnView was activated.

    Thank for help,
    tlustoch
    Last edited by jpn; 28th December 2008 at 20:34. Reason: missing [code] tags

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.