8 #include <QtCore/qhash.h> 9 #include <QtGui/qmenubar.h> 10 #include <QtGui/qbuttongroup.h> 11 #include <QtGui/qboxlayout.h> 12 #include <QtGui/qstackedwidget.h> 13 #include <QtCore/qmetaobject.h> 14 #include <QtCore/qcoreevent.h> 15 #include <QtGui/qtooltip.h> 36 top =
new QHBoxLayout();
37 bottom =
new QHBoxLayout();
38 left =
new QVBoxLayout();
39 mid =
new QVBoxLayout();
40 right =
new QVBoxLayout();
59 if(
top->count() == 0){
68 if(
right->count() > 0){
76 if(
left->count() > 0){
80 layout.addLayout(
mid,midStart,1,1,centerWidth);
84 layout.addLayout(
mid,midStart,0,1,centerWidth);
104 QList<QString> keys =
widgets.keys();
105 for(
int i=0;i<keys.size();i++)
118 QWidget *widget = widget_;
120 #if 0 //Not possible because ruby qt don't initialize all components as QWidget so we have no chance to get the right obect at this point 125 printf(
"Cast sucsessful\n");
128 printf(
"ARGHHHH: %s Name: %s \n",
typeid(widget).name(),widget->objectName().toStdString().c_str());
130 printf(
"QT Means: %s\n",widget->metaObject()->className());
131 const QMetaObject *o = widget->metaObject();
132 for(
int i=0; i<o->methodCount(); i++){
133 printf(
"Method found: %s\n",o->method(i).signature());
144 std::cerr <<
"A Widget with the name: [" << name.toStdString() <<
"] already exists!" << std::endl;
168 widgetButton->
setWidget(name, widget,
false);
169 widgets.insert(name, widgetButton);
170 mid->addWidget(widget);
178 widgets.insert(name, widgetButton);
185 left->addWidget(widgetButton);
188 right->addWidget(widgetButton);
191 top->addWidget(widgetButton);
194 bottom->addWidget(widgetButton);
201 left->addWidget(widgetButton);
204 right->addWidget(widgetButton);
207 bottom->addWidget(widgetButton);
210 top->addWidget(widgetButton);
215 connect(widgetButton, SIGNAL(clicked()),
this, SLOT(
widgetClicked()));
219 timer.setSingleShot(
true);
226 for(
int i=0;i<list.size();i++){
228 list[i]->setActive(
true);
230 list[i]->setActive(
false);
232 list[i]->corrcetName();
239 return widgets.value(name)->getWidget();
249 layout.removeWidget(widget);
250 mid->removeWidget(button);
251 top->removeWidget(button);
252 left->removeWidget(button);
253 right->removeWidget(button);
254 bottom->removeWidget(button);
262 if(event->type() == QEvent::ToolTip)
264 QToolTip::hideText();
268 return QWidget::event(event);
277 if(event->type() == QChildEvent::ChildAdded)
281 if(event->child()->isWidgetType())
285 if(testButton != NULL)
290 QWidget* child = (QWidget*)event->child();
291 if(child->windowTitle().isEmpty())
299 else if(event->type() == QChildEvent::ChildRemoved)
303 if(event->child()->isWidgetType())
306 QWidget* child = (QWidget*)event->child();
307 QList<QString> keys =
widgets.keys();
308 for(
int i=0;i<keys.size();i++)
315 layout.removeWidget(widget);
316 mid->removeWidget(button);
317 left->removeWidget(button);
318 right->removeWidget(button);
319 bottom->removeWidget(button);
320 top->removeWidget(button);
342 fprintf(stderr,
"FATAL: Cannot Handle unknown Widget %s:%i\n",__FILE__,__LINE__);
367 widget->setEnabled(
true);
373 mid->addWidget(widget);
376 QList<QString> keys =
widgets.keys();
377 for(
int i=0;i<keys.size();i++)