diff demos/browser/edittableview.d @ 73:7bfd46c330dc

more porting
author mandel
date Fri, 22 May 2009 10:59:00 +0000
parents 71b382c10ef6
children a8d76a9a85aa
line wrap: on
line diff
--- a/demos/browser/edittableview.d	Wed May 20 22:44:31 2009 +0000
+++ b/demos/browser/edittableview.d	Fri May 22 10:59:00 2009 +0000
@@ -42,45 +42,44 @@
 module edittableview;
 
 
-import QtGui.QTableView;
+import qt.gui.QTableView;
 
 
 class EditTableView : public QTableView
 {
-    Q_OBJECT
+public:
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+	}
+
+	void keyPressEvent(QKeyEvent event)
+	{
+		if ((event.key() == Qt.Key_Delete || event.key() == Qt.Key_Backspace) && model()) {
+			removeOne();
+		} else {
+			QAbstractItemView.keyPressEvent(event);
+		}
+	}
 
 public:
-    EditTableView(QWidget *parent = null)
-{
-	super(parent);
-}
-
-    void keyPressEvent(QKeyEvent *event)
-{
-    if ((event.key() == Qt::Key_Delete
-        || event.key() == Qt::Key_Backspace)
-        && model()) {
-        removeOne();
-    } else {
-        QAbstractItemView::keyPressEvent(event);
-    }
+	
+	void removeOne()
+	{
+		if (!model() || !selectionModel())
+			return;
+		int row = currentIndex().row();
+		model().removeRow(row, rootIndex());
+		QModelIndex idx = model().index(row, 0, rootIndex());
+		if (!idx.isValid())
+			idx = model().index(row - 1, 0, rootIndex());
+		selectionModel().select(idx, QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows);
+	}
+	
+	void removeAll()
+	{
+		if (model())
+			model().removeRows(0, model().rowCount(rootIndex()), rootIndex());
+	}
 }
-
-public slots:
-    void removeOne()
-{
-    if (!model() || !selectionModel())
-        return;
-    int row = currentIndex().row();
-    model().removeRow(row, rootIndex());
-    QModelIndex idx = model().index(row, 0, rootIndex());
-    if (!idx.isValid())
-        idx = model().index(row - 1, 0, rootIndex());
-    selectionModel().select(idx, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
-}
-    void removeAll()
-{
-    if (model())
-        model().removeRows(0, model().rowCount(rootIndex()), rootIndex());
-}
-}