Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QStyledItemDelegate and QStandardItem preventing change text , enable only select and copy
Forum Updated to NodeBB v4.3 + New Features

QStyledItemDelegate and QStandardItem preventing change text , enable only select and copy

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    have a simple QStandardItem and QTableView and QStyledItemDelegate. They have delegates , I would like to disable the possibility for user to change the content of a column in the table, and allow only select and copy. I guess it related to QStyledItemDelegate::createEditor.

    When I set it to return 0, it just disable everything.

    @QWidget *InfoTableItemDelegate::createEditor(QWidget *parent,
    const QStyleOptionViewItem &option,
    const QModelIndex &index) const
    {
    // return QStyledItemDelegate::createEditor(parent, option, index);
    return 0;
    }@

    my question is , how can i defined it so i can only select and copy , and disable the option to edit it like delete or change the text

    1 Reply Last reply
    0
    • T Offline
      T Offline
      terenty
      wrote on last edited by
      #2

      Hi! I am not sure but maybe "QStandardItem::setFlags":http://doc.qt.digia.com/qt/qstandarditem.html#setFlags will help

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved