[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeutils/okteta/kasten/controllers/view/structures
From:       Alexander Richardson <alex.richardson () gmx ! de>
Date:       2010-01-11 14:30:24
Message-ID: 1263220224.417506.30101.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1073060 by arichardson:

keep marking when changing cursor position

 M  +1 -0      structtool.cpp  
 M  +2 -1      structtool.h  
 M  +19 -10    structview.cpp  
 M  +2 -2      structview.h  


--- trunk/KDE/kdeutils/okteta/kasten/controllers/view/structures/structtool.cpp \
#1073059:1073060 @@ -119,6 +119,7 @@
     {
         mCursorIndex = pos;
         updateData();
+        emit cursorIndexChanged();
     }
 }
 
--- trunk/KDE/kdeutils/okteta/kasten/controllers/view/structures/structtool.h \
#1073059:1073060 @@ -77,10 +77,11 @@
     {
         return mManager;
     }
-Q_SIGNALS: // changes to the setting currently not signaled, because only controlled \
by view +Q_SIGNALS: // changes to the settings currently not signaled, because only \
controlled by view  void dataChanged();
     void dataCleared();
     void byteOrderChanged();
+    void cursorIndexChanged();
 
 public Q_SLOTS:
     void setByteOrder(int order);
--- trunk/KDE/kdeutils/okteta/kasten/controllers/view/structures/structview.cpp \
#1073059:1073060 @@ -50,7 +50,8 @@
 {
 
 StructView::StructView(StructTool* tool, QWidget* parent) :
-    QWidget(parent), mTool(tool), mDelegate(new StructViewItemDelegate(this)), \
mStructTreeViewFocusChild(0) +    QWidget(parent), mTool(tool), mDelegate(new \
StructViewItemDelegate(this)), +            mStructTreeViewFocusChild(0)
 {
     QBoxLayout* baseLayout = new QVBoxLayout(this);
     setLayout(baseLayout);
@@ -104,8 +105,16 @@
     connect(mStructTreeView->selectionModel(),
             SIGNAL(currentRowChanged( const QModelIndex&, const QModelIndex& )),
             SLOT(onCurrentRowChanged( const QModelIndex&, const QModelIndex& )));
+    connect(mTool, SIGNAL(cursorIndexChanged()), SLOT(onCursorIndexChange()));
 }
 
+void StructView::onCursorIndexChange()
+{
+    QModelIndex idx = mStructTreeView->currentIndex();
+    if (idx.isValid())
+        mTool->mark(idx);
+}
+
 void StructView::openSettingsDlg(int page)
 {
     //An instance of your dialog could be already created and could be cached,
@@ -132,8 +141,8 @@
     }
     KPageWidgetItem* structs = dialog->addPage(structsWidget, i18n("Structures"),
             "configure");
-    KPageWidgetItem* management = dialog->addPage(structureSettings, \
                i18n("Structures management"),
-            "preferences-plugin");
+    KPageWidgetItem* management = dialog->addPage(structureSettings, i18n(
+            "Structures management"), "preferences-plugin");
     //User edited the configuration - update your local copies of the
     //configuration data
     connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(update()));
@@ -171,24 +180,24 @@
         else if (event->type() == QEvent::FocusOut)
         {
             QWidget* treeViewFocusWidget = mStructTreeView->focusWidget();
-            const bool subChildHasFocus = ( treeViewFocusWidget != mStructTreeView \
                );
-            if( subChildHasFocus )
+            const bool subChildHasFocus = (treeViewFocusWidget != mStructTreeView);
+            if (subChildHasFocus)
             {
                 mStructTreeViewFocusChild = treeViewFocusWidget;
-                mStructTreeViewFocusChild->installEventFilter( this );
+                mStructTreeViewFocusChild->installEventFilter(this);
             }
             else
                 mTool->unmark();
         }
     }
-    else if( object == mStructTreeViewFocusChild )
+    else if (object == mStructTreeViewFocusChild)
     {
         // TODO: it is only assumed the edit widget will be removed if it loses the \
                focus
-        if( event->type() == QEvent::FocusOut )
+        if (event->type() == QEvent::FocusOut)
         {
-            if( ! mStructTreeView->hasFocus() )
+            if (!mStructTreeView->hasFocus())
                 mTool->unmark();
-            mStructTreeViewFocusChild->removeEventFilter( this );
+            mStructTreeViewFocusChild->removeEventFilter(this);
             mStructTreeViewFocusChild = 0;
         }
     }
--- trunk/KDE/kdeutils/okteta/kasten/controllers/view/structures/structview.h \
#1073059:1073060 @@ -61,9 +61,9 @@
 
 protected Q_SLOTS:
     void openSettingsDlg(int page = 0);
-    void
-            onCurrentRowChanged(const QModelIndex& current,
+    void onCurrentRowChanged(const QModelIndex& current,
                     const QModelIndex& previous);
+    void onCursorIndexChange();
 };
 
 inline StructTool* StructView::tool() const


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic