[rkward-cvs] SF.net SVN: rkward: [1545] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Mar 7 15:42:40 UTC 2007
Revision: 1545
http://svn.sourceforge.net/rkward/?rev=1545&view=rev
Author: tfry
Date: 2007-03-07 07:42:39 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
Some improvements to focus setting
Modified Paths:
--------------
trunk/rkward/rkward/misc/rkobjectlistview.cpp
trunk/rkward/rkward/misc/rkobjectlistview.h
trunk/rkward/rkward/robjectbrowser.cpp
trunk/rkward/rkward/robjectbrowser.h
trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp
trunk/rkward/rkward/windows/rkhelpsearchwindow.h
Modified: trunk/rkward/rkward/misc/rkobjectlistview.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.cpp 2007-03-07 12:39:51 UTC (rev 1544)
+++ trunk/rkward/rkward/misc/rkobjectlistview.cpp 2007-03-07 15:42:39 UTC (rev 1545)
@@ -2,7 +2,7 @@
rkobjectlistview - description
-------------------
begin : Wed Sep 1 2004
- copyright : (C) 2004, 2006 by Thomas Friedrichsmeier
+ copyright : (C) 2004, 2006, 2007 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -75,6 +75,19 @@
delete tip;
}
+void RKObjectListView::setObjectCurrent (RObject *object, bool only_if_none_current) {
+ RK_TRACE (APP);
+
+ if (!object) return;
+ RKListViewItem *item = findObjectItem (object);
+
+ if (!item) return; // this may happen during initialization!
+ if (only_if_none_current && selectedItem ()) return;
+
+ ensureItemVisible (item);
+ setCurrentItem (item);
+}
+
void RKObjectListView::objectBrowserSettingsChanged () {
setColumnWidthMode (0, QListView::Maximum);
if (settings->settingActive (RKObjectListViewSettings::ShowFieldsLabel)) {
Modified: trunk/rkward/rkward/misc/rkobjectlistview.h
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.h 2007-03-07 12:39:51 UTC (rev 1544)
+++ trunk/rkward/rkward/misc/rkobjectlistview.h 2007-03-07 15:42:39 UTC (rev 1545)
@@ -2,7 +2,7 @@
rkobjectlistview - description
-------------------
begin : Wed Sep 1 2004
- copyright : (C) 2004, 2006 by Thomas Friedrichsmeier
+ copyright : (C) 2004, 2006, 2007 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -53,6 +53,9 @@
RObject *menuObject () { return menu_object; };
RKObjectListViewSettings *getSettings () { return settings; };
+
+/** Scrolls so that the item representing object becomes visible, and makes it current */
+ void setObjectCurrent (RObject *object, bool only_if_none_current=false);
signals:
void listChanged ();
/** This signal is emitted just before the context-menu is shown. If you connect to this signal, you can make some adjustments to the context-menu.
Modified: trunk/rkward/rkward/robjectbrowser.cpp
===================================================================
--- trunk/rkward/rkward/robjectbrowser.cpp 2007-03-07 12:39:51 UTC (rev 1544)
+++ trunk/rkward/rkward/robjectbrowser.cpp 2007-03-07 15:42:39 UTC (rev 1545)
@@ -83,6 +83,14 @@
RK_TRACE (APP);
}
+void RObjectBrowser::focusInEvent (QFocusEvent *e) {
+ RK_TRACE (APP);
+
+ if (e->reason () != QFocusEvent::Mouse) {
+ list_view->setObjectCurrent (RObjectList::getGlobalEnv (), true);
+ }
+}
+
void RObjectBrowser::initialize () {
RK_TRACE (APP);
Modified: trunk/rkward/rkward/robjectbrowser.h
===================================================================
--- trunk/rkward/rkward/robjectbrowser.h 2007-03-07 12:39:51 UTC (rev 1544)
+++ trunk/rkward/rkward/robjectbrowser.h 2007-03-07 15:42:39 UTC (rev 1545)
@@ -58,6 +58,9 @@
void popupRename ();
/** when an object in the list is double clicked, insert its name in the current RKCommandEditor window */
void slotListDoubleClicked (QListViewItem *item, const QPoint &pos, int);
+protected:
+/** reimplemnented from QWidget to make show the globalenv object when activated (other than by mouse click) */
+ void focusInEvent (QFocusEvent *e);
private:
QPushButton *update_button;
RKObjectListView *list_view;
Modified: trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp 2007-03-07 12:39:51 UTC (rev 1544)
+++ trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp 2007-03-07 15:42:39 UTC (rev 1545)
@@ -110,6 +110,14 @@
RK_TRACE (APP);
}
+void RKHelpSearchWindow::focusInEvent (QFocusEvent *e) {
+ RK_TRACE (APP);
+
+ if (e->reason () != QFocusEvent::Mouse) {
+ field->setFocus ();
+ }
+}
+
void RKHelpSearchWindow::getContextHelp (const QString &context_line, int cursor_pos) {
RK_TRACE (APP);
QString result = RKCommonFunctions::getCurrentSymbol (context_line, cursor_pos);
Modified: trunk/rkward/rkward/windows/rkhelpsearchwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkhelpsearchwindow.h 2007-03-07 12:39:51 UTC (rev 1544)
+++ trunk/rkward/rkward/windows/rkhelpsearchwindow.h 2007-03-07 15:42:39 UTC (rev 1545)
@@ -49,7 +49,10 @@
static RKHelpSearchWindow *mainHelpSearch () { return main_help_search; };
public slots:
void slotFindButtonClicked();
- void slotResultsListDblClicked( QListViewItem *item, const QPoint &, int );
+ void slotResultsListDblClicked (QListViewItem *item, const QPoint &, int);
+protected:
+/** reimplemnented from QWidget to make the input focus default to the input field */
+ void focusInEvent (QFocusEvent *e);
private:
QComboBox* field;
QComboBox* fieldsList;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list