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. [SOLVED] Show a QMessagebox with QItemDelegate
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Show a QMessagebox with QItemDelegate

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.7k 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.
  • W Offline
    W Offline
    Woody
    wrote on last edited by
    #1

    I have a QTableView with a model and an itemdelegate set.

    In some columns it may not be possible to change the data. So in my createEditor, I return NULL as editor.

    But now I want for those columns to return a MessageBox that tells the user that editing in this version is not possible.

    So when the column is clicked for editing, it has to return a messagebox.

    Is this in any way possible to create?

    Thanks in advance

    File not found. Nobody leave the room!

    1 Reply Last reply
    0
    • W Offline
      W Offline
      Woody
      wrote on last edited by
      #2

      I found a solution myself.

      You don't return a QMessageBox like this:
      @
      if(kResColRank == index.column())
      {
      QSpinBox *editor = new QSpinBox(parent);
      editor->setMinimum(0);
      editor->setMaximum(1000);
      editor->setSingleStep(1);
      return QMessageBox::information(parent, tr("TEXT"), tr("TEXT.\n"));
      }
      @

      But you just pop up the messagebox:
      @
      if(kResColRank == index.column())
      {
      QSpinBox *editor = new QSpinBox(parent);
      editor->setMinimum(0);
      editor->setMaximum(1000);
      editor->setSingleStep(1);
      QMessageBox::information(parent, tr("TEXT"), tr("TEXT.\n"));
      return NULL;
      }
      @

      Easy solution actually. But didn't know it.

      File not found. Nobody leave the room!

      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