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

List:       kde-commits
Subject:    koffice/kspread/dialogs
From:       Marijn Kruisselbrink <m.kruisselbrink () student ! tue ! nl>
Date:       2008-11-09 22:16:30
Message-ID: 1226268990.225420.21784.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 882146 by mkruisselbrink:

add some code to the formula dialog to make it somewhat usable with a style where \
single-clicking is used to activate items in a listview (like I think all kde \
styles).


 M  +16 -0     FormulaDialog.cpp  
 M  +5 -0      FormulaDialog.h  


--- trunk/koffice/kspread/dialogs/FormulaDialog.cpp #882145:882146
@@ -120,6 +120,12 @@
     functions->setSelectionModel(selectionmodel);
     connect(selectionmodel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
             this, SLOT(slotSelected()));
+    // When items are activated on single click, also change the help page on \
mouse-over, otherwise there is no (easy) way to get +    // the help without \
inserting the function +    if \
(functions->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, \
functions)) { +        connect(functions, SIGNAL(entered(QModelIndex)), this, \
SLOT(slotIndexSelected(QModelIndex))); +        functions->setMouseTracking(true);
+    }
     //connect(proxyModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, \
SLOT(slotDataChanged(QModelIndex,QModelIndex)));  
     selectFunction = new QPushButton( page );
@@ -689,6 +695,16 @@
     slotChangeText( "" );
 }
 
+void FormulaDialog::slotIndexSelected( const QModelIndex& index )
+{
+    // This slot is only called when single-click to activate is uesd in the \
listbox, when the mouse moves over a item; to prevent +    // the active selection to \
change after the user activated one, slotSelected is only called when the current tab \
is the Help tab, +    // and not when the parameters tab is active
+    if ( m_tabwidget->currentIndex() != 0 ) return;
+    QString function = proxyModel->data( index ).toString();
+    slotSelected(function);
+}
+
 void FormulaDialog::slotSelected( const QString& afunction )
 {
     QString function = afunction;
--- trunk/koffice/kspread/dialogs/FormulaDialog.h #882145:882146
@@ -83,6 +83,11 @@
      */
     void slotSelected( const QString& function = QString() );
     /**
+     * Called if a function name was selected but not double clicked.
+     * This will just show the help page for the function.
+     */
+    void slotIndexSelected( const QModelIndex& index );
+    /**
      * Called if the user clicked on one of the "related function"
      * This will switch the active function and show help page
      * of the function as well.


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

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