title: Sorting QTreeWidget
body: <p>I am trying to sort values numerically instead of alphabetically in my QTreeWidget. Right now It's comparing as two strings, what I need is for it to compare as two integers.</p>
  
  <p>What I have so far:</p>
  
  <p>mainwindow.h:</p>
  
  <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  
  #include &lt;QSql&gt;
  //more include...
  #include &lt;QTreeWidget&gt;
  
  extern QSqlDatabase db;
  //more extern...
  
  namespace Ui {
  class mainwindow;
  class TreeWidgetItem;
  }
  
  class TreeWidgetItem : public QTreeWidgetItem
  {
      Q_OBJECT
  
  public:
      TreeWidgetItem(QTreeWidget *tree) : QTreeWidgetItem(tree)  {}
      TreeWidgetItem(QTreeWidget * parent, const QStringList &amp; strings)
                     : QTreeWidgetItem (parent,strings)  {}
      bool operator&lt; (const QTreeWidgetItem &amp;other) const
      {
          int column = treeWidget()-&gt;sortColumn();
          return text(column).toInt() &lt; other.text(column).toInt();
      }
  };
  
  class mainwindow : public QMainWindow
  {
      Q_OBJECT
  
  public:
      //...
  </code></pre>
  
  <p>but it doesn't work, any idea what else i need to do? Or am I completely off?</p>