[mythtv] [PATCH] MythPopupBox losing focus
Philippe C. Cattin
cattin at vision.ee.ethz.ch
Sat Oct 11 02:57:44 EDT 2003
Well, here is my patch to solve the problem with losing focus in
MythPopupBox's.
I tried hard to override focusNextPrevChild() of MythDialog, however I
couldn't find a solution that didn't break other stuff. So here is my
solution that overrides it in MythPopupBox and solves my problem :-)
test it try.
regards, Philippe
-------------- next part --------------
Index: libs/libmyth/mythdialogs.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythdialogs.cpp,v
retrieving revision 1.22
diff -u -2 -r1.22 mythdialogs.cpp
--- libs/libmyth/mythdialogs.cpp 2 Oct 2003 07:43:35 -0000 1.22
+++ libs/libmyth/mythdialogs.cpp 10 Oct 2003 23:12:40 -0000
@@ -9,4 +9,5 @@
#include <qregexp.h>
#include <qaccel.h>
+#include <qfocusdata.h>
#include <iostream>
@@ -387,4 +388,29 @@
}
+bool MythPopupBox::focusNextPrevChild(bool next)
+{
+ QWidget *widget;
+ QFocusData *focusList = focusData();
+ QObjectList *objList = queryList(NULL,NULL,false,true);
+
+ widget = focusList->home();
+
+ int countdown = focusList->count();
+ if(next)
+ {
+ do
+ widget = focusList->next();
+ while( (objList->find((QObject*)widget) == -1) && (countdown-->0) );
+ }
+ else
+ {
+ do
+ widget = focusList->prev();
+ while( (objList->find((QObject*)widget) == -1) && (countdown-->0) );
+ }
+ widget->setFocus();
+ return true;
+}
+
void MythPopupBox::addWidget(QWidget *widget, bool setAppearance)
{
Index: libs/libmyth/mythdialogs.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythdialogs.h,v
retrieving revision 1.19
diff -u -2 -r1.19 mythdialogs.h
--- libs/libmyth/mythdialogs.h 2 Oct 2003 07:43:36 -0000 1.19
+++ libs/libmyth/mythdialogs.h 10 Oct 2003 23:12:41 -0000
@@ -144,4 +144,6 @@
static bool showOkCancelPopup(MythMainWindow *parent, QString title,
QString message, bool focusOk);
+ protected:
+ bool focusNextPrevChild(bool next);
protected slots:
More information about the mythtv-dev
mailing list