summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
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__*/