Index: /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp	(revision 60469)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp	(revision 60470)
@@ -38,5 +38,4 @@
 # include "UIToolBar.h"
 # include "QITableView.h"
-# include "QIStyledItemDelegate.h"
 
 /* Other VBox includes: */
@@ -109,9 +108,4 @@
     Q_PROPERTY(NameData name READ name WRITE setName USER true);
 
-signals:
-
-    /** Notifies listener about data should be committed. */
-    void sigCommitData(QWidget *pThis);
-
 public:
 
@@ -122,13 +116,4 @@
         setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
         setValidator(new QRegExpValidator(QRegExp("[^,:]*"), this));
-        connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(sltTextEdited(const QString&)));
-    }
-
-private slots:
-
-    /** Drops the changed data to listener. */
-    void sltTextEdited(const QString&)
-    {
-        emit sigCommitData(this);
     }
 
@@ -154,9 +139,4 @@
     Q_PROPERTY(KNATProtocol protocol READ protocol WRITE setProtocol USER true);
 
-signals:
-
-    /** Notifies listener about data should be committed. */
-    void sigCommitData(QWidget *pThis);
-
 public:
 
@@ -166,13 +146,4 @@
         addItem(gpConverter->toString(KNATProtocol_UDP), QVariant::fromValue(KNATProtocol_UDP));
         addItem(gpConverter->toString(KNATProtocol_TCP), QVariant::fromValue(KNATProtocol_TCP));
-        connect(this, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(sltTextEdited(const QString&)));
-    }
-
-private slots:
-
-    /** Drops the changed data to listener. */
-    void sltTextEdited(const QString&)
-    {
-        emit sigCommitData(this);
     }
 
@@ -204,9 +175,4 @@
     Q_OBJECT;
     Q_PROPERTY(IpData ip READ ip WRITE setIp USER true);
-
-signals:
-
-    /** Notifies listener about data should be committed. */
-    void sigCommitData(QWidget *pThis);
 
 public:
@@ -218,13 +184,4 @@
         setAlignment(Qt::AlignCenter);
         setValidator(new IPv4Validator(this));
-        connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(sltTextEdited(const QString&)));
-    }
-
-private slots:
-
-    /** Drops the changed data to listener. */
-    void sltTextEdited(const QString&)
-    {
-        emit sigCommitData(this);
     }
 
@@ -249,9 +206,4 @@
     Q_OBJECT;
     Q_PROPERTY(IpData ip READ ip WRITE setIp USER true);
-
-signals:
-
-    /** Notifies listener about data should be committed. */
-    void sigCommitData(QWidget *pThis);
 
 public:
@@ -263,13 +215,4 @@
         setAlignment(Qt::AlignCenter);
         setValidator(new IPv6Validator(this));
-        connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(sltTextEdited(const QString&)));
-    }
-
-private slots:
-
-    /** Drops the changed data to listener. */
-    void sltTextEdited(const QString&)
-    {
-        emit sigCommitData(this);
     }
 
@@ -295,9 +238,4 @@
     Q_PROPERTY(PortData port READ port WRITE setPort USER true);
 
-signals:
-
-    /** Notifies listener about data should be committed. */
-    void sigCommitData(QWidget *pThis);
-
 public:
 
@@ -307,13 +245,4 @@
         setFrame(false);
         setRange(0, (1 << (8 * sizeof(ushort))) - 1);
-        connect(this, SIGNAL(valueChanged(const QString&)), this, SLOT(sltTextEdited(const QString&)));
-    }
-
-private slots:
-
-    /** Drops the changed data to listener. */
-    void sltTextEdited(const QString&)
-    {
-        emit sigCommitData(this);
     }
 
@@ -648,51 +577,48 @@
     }
 
-    /* Reinstall delegate: */
-    delete m_pTableView->itemDelegate();
-    QIStyledItemDelegate *pStyledItemDelegate = new QIStyledItemDelegate(this);
-    m_pTableView->setItemDelegate(pStyledItemDelegate);
-
-    /* Create new item editor factory: */
-    QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
-
-    /* Register name type: */
-    int iNameId = qRegisterMetaType<NameData>();
-    /* Register name editor: */
-    QStandardItemEditorCreator<NameEditor> *pNameEditorItemCreator = new QStandardItemEditorCreator<NameEditor>();
-    /* Link name type & editor: */
-    pNewItemEditorFactory->registerEditor((QVariant::Type)iNameId, pNameEditorItemCreator);
-
-    /* Register protocol type: */
-    int iProtocolId = qRegisterMetaType<KNATProtocol>();
-    /* Register protocol editor: */
-    QStandardItemEditorCreator<ProtocolEditor> *pProtocolEditorItemCreator = new QStandardItemEditorCreator<ProtocolEditor>();
-    /* Link protocol type & editor: */
-    pNewItemEditorFactory->registerEditor((QVariant::Type)iProtocolId, pProtocolEditorItemCreator);
-
-    /* Register ip type: */
-    int iIpId = qRegisterMetaType<IpData>();
-    /* Register ip editor: */
-    if (!fIPv6)
-    {
-        QStandardItemEditorCreator<IPv4Editor> *pIPv4EditorItemCreator = new QStandardItemEditorCreator<IPv4Editor>();
-        /* Link ip type & editor: */
-        pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv4EditorItemCreator);
-    }
-    else
-    {
-        QStandardItemEditorCreator<IPv6Editor> *pIPv6EditorItemCreator = new QStandardItemEditorCreator<IPv6Editor>();
-        /* Link ip type & editor: */
-        pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv6EditorItemCreator);
-    }
-
-    /* Register port type: */
-    int iPortId = qRegisterMetaType<PortData>();
-    /* Register port editor: */
-    QStandardItemEditorCreator<PortEditor> *pPortEditorItemCreator = new QStandardItemEditorCreator<PortEditor>();
-    /* Link port type & editor: */
-    pNewItemEditorFactory->registerEditor((QVariant::Type)iPortId, pPortEditorItemCreator);
-
-    /* Set newly created item editor factory for table delegate: */
-    pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
+    /* We do have abstract item delegate: */
+    QAbstractItemDelegate *pAbstractItemDelegate = m_pTableView->itemDelegate();
+    if (pAbstractItemDelegate)
+    {
+        /* But do we have styled item delegate? */
+        QStyledItemDelegate *pStyledItemDelegate = qobject_cast<QStyledItemDelegate*>(pAbstractItemDelegate);
+        if (pStyledItemDelegate)
+        {
+            /* Create new item editor factory: */
+            QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
+            {
+                /* Register NameEditor as the NameData editor: */
+                int iNameId = qRegisterMetaType<NameData>();
+                QStandardItemEditorCreator<NameEditor> *pNameEditorItemCreator = new QStandardItemEditorCreator<NameEditor>();
+                pNewItemEditorFactory->registerEditor((QVariant::Type)iNameId, pNameEditorItemCreator);
+
+                /* Register ProtocolEditor as the KNATProtocol editor: */
+                int iProtocolId = qRegisterMetaType<KNATProtocol>();
+                QStandardItemEditorCreator<ProtocolEditor> *pProtocolEditorItemCreator = new QStandardItemEditorCreator<ProtocolEditor>();
+                pNewItemEditorFactory->registerEditor((QVariant::Type)iProtocolId, pProtocolEditorItemCreator);
+
+                /* Register IPv4Editor/IPv6Editor as the IpData editor: */
+                int iIpId = qRegisterMetaType<IpData>();
+                if (!fIPv6)
+                {
+                    QStandardItemEditorCreator<IPv4Editor> *pIPv4EditorItemCreator = new QStandardItemEditorCreator<IPv4Editor>();
+                    pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv4EditorItemCreator);
+                }
+                else
+                {
+                    QStandardItemEditorCreator<IPv6Editor> *pIPv6EditorItemCreator = new QStandardItemEditorCreator<IPv6Editor>();
+                    pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv6EditorItemCreator);
+                }
+
+                /* Register PortEditor as the PortData editor: */
+                int iPortId = qRegisterMetaType<PortData>();
+                QStandardItemEditorCreator<PortEditor> *pPortEditorItemCreator = new QStandardItemEditorCreator<PortEditor>();
+                pNewItemEditorFactory->registerEditor((QVariant::Type)iPortId, pPortEditorItemCreator);
+
+                /* Set newly created item editor factory for table delegate: */
+                pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
+            }
+        }
+    }
 
     /* Retranslate dialog: */
