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

List:       kde-commits
Subject:    KDE/kdevplatform/plugins/projectmanagerview
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2009-07-06 18:49:26
Message-ID: 1246906166.800549.7482.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 992395 by apaku:

Disable reading of kde-wide config for single-click behaviour. This
simply doesn't work with this treeview. Hence we now have:
- double click expands/collapses a node with children
- double click opens a file

 M  +2 -26     projecttreeview.cpp  
 M  +0 -5      projecttreeview.h  


--- trunk/KDE/kdevplatform/plugins/projectmanagerview/projecttreeview.cpp \
#992394:992395 @@ -52,7 +52,7 @@
 using namespace KDevelop;
 
 ProjectTreeView::ProjectTreeView( QWidget *parent )
-        : QTreeView( parent ), m_ctxProject( 0 ), mouseClickChangesSelection( false \
) +        : QTreeView( parent ), m_ctxProject( 0 )
 {
     header()->setResizeMode( QHeaderView::ResizeToContents );
     header()->hide();
@@ -65,19 +65,7 @@
     setIndentation(10);
 
     connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( \
                popupContextMenu( QPoint ) ) );
-    if( style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this) \
                == KGlobalSettings::singleClick() )
-    {
-        connect( this, SIGNAL( activated( QModelIndex ) ), this, SLOT( \
                slotActivated( QModelIndex ) ) );
-    } else
-    {
-        if( KGlobalSettings::singleClick() )
-        {
-            connect( this, SIGNAL( clicked( QModelIndex ) ), this, SLOT( \
                slotActivated( QModelIndex ) ) );
-        } else
-        {
-            connect( this, SIGNAL( doubleClicked( QModelIndex ) ), this, SLOT( \
                slotActivated( QModelIndex ) ) );
-        }
-    }
+    connect( this, SIGNAL( doubleClicked( QModelIndex ) ), this, SLOT( \
slotActivated( QModelIndex ) ) );  }
 
 ProjectTreeView::~ProjectTreeView()
@@ -103,13 +91,6 @@
     return 0;
 }
 
-void ProjectTreeView::mouseReleaseEvent( QMouseEvent* event )
-{
-    mouseClickChangesSelection = ( event->modifiers() & Qt::ControlModifier ) | ( \
                event->modifiers() & Qt::ShiftModifier );
-    rightButtonClicked = ( event->button() == Qt::RightButton );
-    QTreeView::mouseReleaseEvent( event );
-}
-
 ProjectFileItem *ProjectTreeView::currentFileItem() const
 
 {
@@ -160,16 +141,11 @@
 
 void ProjectTreeView::slotActivated( const QModelIndex &index )
 {
-    if( mouseClickChangesSelection || rightButtonClicked )
-        return;
     QAbstractProxyModel *proxy = qobject_cast<QAbstractProxyModel*>(model());
     KDevelop::ProjectBaseItem *item = projectModel()->item( \
proxy->mapToSource(index) );  if ( item && item->file() )
     {
         emit activateUrl( item->file()->url() );
-    }else if( model()->rowCount(index) != 0) {
-        if(!isExpanded(index))
-            expand(index);
     }
 }
 
--- trunk/KDE/kdevplatform/plugins/projectmanagerview/projecttreeview.h \
#992394:992395 @@ -67,14 +67,9 @@
         void popupContextMenu( const QPoint &pos );
         void openProjectConfig();
 
-    protected:
-        virtual void mouseReleaseEvent( QMouseEvent* );
-
     private:
         KDevelop::IProject* m_ctxProject;
         QPointer<KDevelop::NavigationToolTip> m_tooltip;
-        bool mouseClickChangesSelection;
-        bool rightButtonClicked;
         void appendActions(QMenu& menu, const QList<QAction*>& actions);
         QPersistentModelIndex m_idx;
 };


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

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