title: QTableWidget: Only numbers via delegate
body: <p>I'm currently trying to let my QTableWidget only display numbers. I read that I'd need a QAbstractItemDelegate to do so, so I read through the documentation and found the createEditor void. Here's my code I'm currently using:</p>
  
  <pre><code>#include "tabledelegate.h"
  
  TableDelegate::TableDelegate(QObject *parent) : QStyledItemDelegate(parent)
  {
  }
  
  QWidget* TableDelegate::createEditor(QWidget* parent,const QStyleOptionViewItem &amp;option,const QModelIndex &amp;index) const
  {
      QLineEdit* editor = new QLineEdit(parent);
      QDoubleValidator* val = new QDoubleValidator(editor);
      val-&gt;setBottom(0);
      val-&gt;setNotation(QDoubleValidator::StandardNotation);
      editor-&gt;setValidator(val);
      return editor;
  }
  </code></pre>
  
  <p>And I'm trying to call the Delegate by doing this in the constructor of MainWindow:</p>
  
  <pre><code>ui-&gt;tableWidget-&gt;setItemDelegate(new TableDelegate(ui-&gt;tableWidget));
  </code></pre>
  
  <p>But it gives me this error:</p>
  
  <blockquote>
    <p>no matching function for call to 'QTableWidget::setItemDelegate(TableDelegate*)'
         ui->tableWidget->setItemDelegate(new TableDelegate(ui->tableWidget));
                                                                            ^</p>
  </blockquote>
  
  <p>Why?</p>