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. Delete QTableWidget selected rows
Forum Updated to NodeBB v4.3 + New Features

Delete QTableWidget selected rows

Scheduled Pinned Locked Moved Solved General and Desktop
22 Posts 5 Posters 4.0k Views 2 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.
  • VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by VRonin
    #21

    @hbatalha said in Delete QTableWidget selected rows:

    Is it possible to have something like that?

    class CheckBoxDelegate : public QStyledItemDelegate{
        Q_DISABLE_COPY(CheckBoxDelegate)
    public:
        using QStyledItemDelegate::QStyledItemDelegate;
    protected:
        void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override{
            QStyledItemDelegate::initStyleOption(option,index);
            option->palette.setColor( QPalette::Active, QPalette::Base, Qt::blue );
        }
    };
    

    tableWidget->setItemDelegate(new CheckBoxDelegate(this));

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    H 1 Reply Last reply
    1
    • VRoninV VRonin

      @hbatalha said in Delete QTableWidget selected rows:

      Is it possible to have something like that?

      class CheckBoxDelegate : public QStyledItemDelegate{
          Q_DISABLE_COPY(CheckBoxDelegate)
      public:
          using QStyledItemDelegate::QStyledItemDelegate;
      protected:
          void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override{
              QStyledItemDelegate::initStyleOption(option,index);
              option->palette.setColor( QPalette::Active, QPalette::Base, Qt::blue );
          }
      };
      

      tableWidget->setItemDelegate(new CheckBoxDelegate(this));

      H Offline
      H Offline
      hbatalha
      wrote on last edited by
      #22

      @VRonin worked like charm. Thank you for all your help and for your time. I really appreciate it.

      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