summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2011-12-01 09:11:17 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2011-12-01 09:11:17 +0100
commit5d5595b9e1c1c22f7033a262b8174a5f3d05adc8 (patch)
tree187aabd3d372e628ebfac73355cdbed14c847ae0 /client
parent367c84c20b89a6fbcba4f1b6f5815f3f3865b634 (diff)
Reorganise TabOrder according to child nesting order.
Diffstat (limited to 'client')
-rw-r--r--client/macrowindow.cc33
-rw-r--r--client/macrowindow.h1
2 files changed, 34 insertions, 0 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index 2e0f52a..48ace4e 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -52,6 +52,7 @@ MacroWindow::MacroWindow(NetCom &n, QString course, QString templ,
MacroDrawer *d)
: Collapser(NULL, is_static?NULL:scrollarea), netcom(n)
{
+ this->scrollarea = scrollarea;
drawer = d;
this->is_static = is_static;
@@ -279,6 +280,36 @@ void MacroWindow::clear()
}
}
+QWidgetList getRecursiveWidgetList(QWidget *w)
+{
+ QWidgetList list;
+
+ list.append(w);
+
+ QObjectList objs = w->children();
+ for(int i = 0; i < objs.size(); i++) {
+ if(objs[i]->isWidgetType()) {
+ QWidget *cw = (QWidget*)objs[i];
+ list.append(getRecursiveWidgetList(cw));
+ }
+ }
+
+ return list;
+}
+
+void setTabOrderRecursive(QWidget *w)
+{
+ QWidgetList list = getRecursiveWidgetList(w);
+ QWidget *last = NULL;
+ for(int i = 0; i < list.size(); i++) {
+ QWidget *w = list[i];
+ if((w->focusPolicy() & Qt::TabFocus) != 0) {
+ if(last) QWidget::setTabOrder(last, w);
+ last = w;
+ }
+ }
+}
+
void MacroWindow::animated(QWidget *w)
{
if(w == resumewidget) {
@@ -294,6 +325,8 @@ void MacroWindow::animated(QWidget *w)
if(is_static) return;
+ setTabOrderRecursive(scrollarea);
+
// Set keyboard focus on the first focusable widget in the macro.
mainwidget->setKeyboardFocus();
}
diff --git a/client/macrowindow.h b/client/macrowindow.h
index afc144d..65a0d87 100644
--- a/client/macrowindow.h
+++ b/client/macrowindow.h
@@ -94,6 +94,7 @@ private:
bool is_static;
MacroDrawer *drawer;
+ QWidget *scrollarea;
};
#endif/*__PRACRO_MACROWINDOW_H__*/