|
@@ -61,11 +61,15 @@ PrinterSelector::PrinterSelector() : QComboBox(NULL)
|
61
|
61
|
}
|
62
|
62
|
|
63
|
63
|
@ The host environment is informed of this class in the usual way starting with
|
64
|
|
-a constructor function prototype.
|
|
64
|
+a constructor function prototype. Another prototype is also needed for adding
|
|
65
|
+this to a layout from XML.
|
65
|
66
|
|
66
|
67
|
@<Function prototypes for scripting@>=
|
67
|
68
|
QScriptValue constructPrinterSelector(QScriptContext *context,
|
68
|
69
|
QScriptEngine *engine);
|
|
70
|
+void addPrinterSelectorToLayout(QDomElement element,
|
|
71
|
+ QStack<QWidget *> *widgetStack,
|
|
72
|
+ QStack<QLayout *> *layoutStack);
|
69
|
73
|
|
70
|
74
|
@ The engine is informed of this function.
|
71
|
75
|
|
|
@@ -85,3 +89,28 @@ QScriptValue constructPrinterSelector(QScriptContext *, QScriptEngine *engine)
|
85
|
89
|
setQComboBoxProperties(object, engine);
|
86
|
90
|
return object;
|
87
|
91
|
}
|
|
92
|
+
|
|
93
|
+@ It should also be possible to add this to a layout from the XML portion of
|
|
94
|
+the configuration document.
|
|
95
|
+
|
|
96
|
+@<Functions for scripting@>=
|
|
97
|
+void addPrinterSelectorToLayout(QDomElement element, QStack<QWidget *> *,
|
|
98
|
+ QStack<QLayout *> *layoutStack)
|
|
99
|
+{
|
|
100
|
+ PrinterSelector *selector = new PrinterSelector;
|
|
101
|
+ if(element.hasAttribute("id"))
|
|
102
|
+ {
|
|
103
|
+ selector->setObjectName(element.attribute("id"));
|
|
104
|
+ }
|
|
105
|
+ QBoxLayout *layout = qobject_cast<QBoxLayout *>(layoutStack->top());
|
|
106
|
+ layout->addWidget(selector);
|
|
107
|
+}
|
|
108
|
+
|
|
109
|
+@ This is added in the usual way.
|
|
110
|
+
|
|
111
|
+@<Additional box layout elements@>=
|
|
112
|
+else if(currentElement.tagName() == "printerselector")
|
|
113
|
+{
|
|
114
|
+ addPrinterSelectorToLayout(currentElement, widgetStack, layoutStack);
|
|
115
|
+}
|
|
116
|
+
|