Exemple #1
0
void pListView::constructor() {
  qtWidget = qtListView = new QTreeWidget;
  qtListView->setAllColumnsShowFocus(true);
  qtListView->setRootIsDecorated(false);

  connect(qtListView, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onActivate()));
  connect(qtListView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(onChange(QTreeWidgetItem*)));
  connect(qtListView, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onToggle(QTreeWidgetItem*)));

  pWidget::synchronizeState();
  setCheckable(listView.state.checkable);
  setHeaderText(listView.state.headerText.size() ? listView.state.headerText : lstring{ " " });
  setHeaderVisible(listView.state.headerVisible);
  for(auto& row : listView.state.text) append(row);
  if(listView.state.checkable) {
    for(unsigned n = 0; n < listView.state.checked.size(); n++) {
      setChecked(n, listView.state.checked[n]);
    }
  }
  setSelected(listView.state.selected);
  if(listView.state.selected) setSelection(listView.state.selection);
  autoSizeColumns();
}
Exemple #2
0
void Stack::showHeader()
{
	QPoint point = mapFromGlobal(QCursor::pos());
	setHeaderVisible(window()->rect().contains(point) && point.y() <= m_header_margin);
}
int QCalendarWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: selectionChanged(); break;
        case 1: clicked((*reinterpret_cast< const QDate(*)>(_a[1]))); break;
        case 2: activated((*reinterpret_cast< const QDate(*)>(_a[1]))); break;
        case 3: currentPageChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 4: setSelectedDate((*reinterpret_cast< const QDate(*)>(_a[1]))); break;
        case 5: setDateRange((*reinterpret_cast< const QDate(*)>(_a[1])),(*reinterpret_cast< const QDate(*)>(_a[2]))); break;
        case 6: setCurrentPage((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 7: setGridVisible((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 8: setNavigationBarVisible((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: showNextMonth(); break;
        case 10: showPreviousMonth(); break;
        case 11: showNextYear(); break;
        case 12: showPreviousYear(); break;
        case 13: showSelectedDate(); break;
        case 14: showToday(); break;
        case 15: d_func()->_q_slotShowDate((*reinterpret_cast< const QDate(*)>(_a[1]))); break;
        case 16: d_func()->_q_slotChangeDate((*reinterpret_cast< const QDate(*)>(_a[1]))); break;
        case 17: d_func()->_q_slotChangeDate((*reinterpret_cast< const QDate(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 18: d_func()->_q_editingFinished(); break;
        case 19: d_func()->_q_prevMonthClicked(); break;
        case 20: d_func()->_q_nextMonthClicked(); break;
        case 21: d_func()->_q_yearEditingFinished(); break;
        case 22: d_func()->_q_yearClicked(); break;
        case 23: d_func()->_q_monthChanged((*reinterpret_cast< QAction*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 24;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QDate*>(_v) = selectedDate(); break;
        case 1: *reinterpret_cast< QDate*>(_v) = minimumDate(); break;
        case 2: *reinterpret_cast< QDate*>(_v) = maximumDate(); break;
        case 3: *reinterpret_cast< Qt::DayOfWeek*>(_v) = firstDayOfWeek(); break;
        case 4: *reinterpret_cast< bool*>(_v) = isGridVisible(); break;
        case 5: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break;
        case 6: *reinterpret_cast< HorizontalHeaderFormat*>(_v) = horizontalHeaderFormat(); break;
        case 7: *reinterpret_cast< VerticalHeaderFormat*>(_v) = verticalHeaderFormat(); break;
        case 8: *reinterpret_cast< bool*>(_v) = isHeaderVisible(); break;
        case 9: *reinterpret_cast< bool*>(_v) = isNavigationBarVisible(); break;
        case 10: *reinterpret_cast< bool*>(_v) = isDateEditEnabled(); break;
        case 11: *reinterpret_cast< int*>(_v) = dateEditAcceptDelay(); break;
        }
        _id -= 12;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setSelectedDate(*reinterpret_cast< QDate*>(_v)); break;
        case 1: setMinimumDate(*reinterpret_cast< QDate*>(_v)); break;
        case 2: setMaximumDate(*reinterpret_cast< QDate*>(_v)); break;
        case 3: setFirstDayOfWeek(*reinterpret_cast< Qt::DayOfWeek*>(_v)); break;
        case 4: setGridVisible(*reinterpret_cast< bool*>(_v)); break;
        case 5: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        case 6: setHorizontalHeaderFormat(*reinterpret_cast< HorizontalHeaderFormat*>(_v)); break;
        case 7: setVerticalHeaderFormat(*reinterpret_cast< VerticalHeaderFormat*>(_v)); break;
        case 8: setHeaderVisible(*reinterpret_cast< bool*>(_v)); break;
        case 9: setNavigationBarVisible(*reinterpret_cast< bool*>(_v)); break;
        case 10: setDateEditEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 11: setDateEditAcceptDelay(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 12;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 12;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
int QCalendarWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 24)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 24;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QDate*>(_v) = selectedDate(); break;
        case 1: *reinterpret_cast< QDate*>(_v) = minimumDate(); break;
        case 2: *reinterpret_cast< QDate*>(_v) = maximumDate(); break;
        case 3: *reinterpret_cast< Qt::DayOfWeek*>(_v) = firstDayOfWeek(); break;
        case 4: *reinterpret_cast< bool*>(_v) = isGridVisible(); break;
        case 5: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break;
        case 6: *reinterpret_cast< HorizontalHeaderFormat*>(_v) = horizontalHeaderFormat(); break;
        case 7: *reinterpret_cast< VerticalHeaderFormat*>(_v) = verticalHeaderFormat(); break;
        case 8: *reinterpret_cast< bool*>(_v) = isHeaderVisible(); break;
        case 9: *reinterpret_cast< bool*>(_v) = isNavigationBarVisible(); break;
        case 10: *reinterpret_cast< bool*>(_v) = isDateEditEnabled(); break;
        case 11: *reinterpret_cast< int*>(_v) = dateEditAcceptDelay(); break;
        }
        _id -= 12;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setSelectedDate(*reinterpret_cast< QDate*>(_v)); break;
        case 1: setMinimumDate(*reinterpret_cast< QDate*>(_v)); break;
        case 2: setMaximumDate(*reinterpret_cast< QDate*>(_v)); break;
        case 3: setFirstDayOfWeek(*reinterpret_cast< Qt::DayOfWeek*>(_v)); break;
        case 4: setGridVisible(*reinterpret_cast< bool*>(_v)); break;
        case 5: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        case 6: setHorizontalHeaderFormat(*reinterpret_cast< HorizontalHeaderFormat*>(_v)); break;
        case 7: setVerticalHeaderFormat(*reinterpret_cast< VerticalHeaderFormat*>(_v)); break;
        case 8: setHeaderVisible(*reinterpret_cast< bool*>(_v)); break;
        case 9: setNavigationBarVisible(*reinterpret_cast< bool*>(_v)); break;
        case 10: setDateEditEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 11: setDateEditAcceptDelay(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 12;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 12;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemple #5
0
void pListView::constructor() {
  gtkWidget = gtk_scrolled_window_new(0, 0);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkWidget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkWidget), GTK_SHADOW_ETCHED_IN);

  lstring headerText = listView.state.headerText;
  if(headerText.size() == 0) headerText.append("");  //ListView must have at least one column

  column.reset();
  vector<GType> gtype;
  for(auto& text : headerText) {
    GtkColumn cell;
    cell.label = gtk_label_new(text);
    cell.column = gtk_tree_view_column_new();
    gtk_tree_view_column_set_resizable(cell.column, true);
    gtk_tree_view_column_set_title(cell.column, "");

    if(column.size() == 0) {  //first column checkbutton
      cell.checkbutton = gtk_cell_renderer_toggle_new();
      gtk_tree_view_column_pack_start(cell.column, cell.checkbutton, false);
      gtk_tree_view_column_set_attributes(cell.column, cell.checkbutton, "active", gtype.size(), nullptr);
      gtype.append(G_TYPE_BOOLEAN);
      g_signal_connect(cell.checkbutton, "toggled", G_CALLBACK(ListView_toggle), (gpointer)&listView);
    }

    cell.icon = gtk_cell_renderer_pixbuf_new();
    gtk_tree_view_column_pack_start(cell.column, cell.icon, false);
    gtk_tree_view_column_set_attributes(cell.column, cell.icon, "pixbuf", gtype.size(), nullptr);
    gtype.append(GDK_TYPE_PIXBUF);

    cell.text = gtk_cell_renderer_text_new();
    gtk_tree_view_column_pack_start(cell.column, cell.text, false);
    gtk_tree_view_column_set_attributes(cell.column, cell.text, "text", gtype.size(), nullptr);
    gtype.append(G_TYPE_STRING);

    column.append(cell);
  }

  store = gtk_list_store_newv(gtype.size(), gtype.data());
  subWidget = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
  gtk_container_add(GTK_CONTAINER(gtkWidget), subWidget);
  g_object_unref(G_OBJECT(store));

  for(auto& cell : column) {
    gtk_tree_view_column_set_widget(GTK_TREE_VIEW_COLUMN(cell.column), cell.label);
    gtk_tree_view_append_column(GTK_TREE_VIEW(subWidget), cell.column);
    gtk_widget_show(cell.label);
  }

  gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(subWidget), headerText.size() >= 2);  //two or more columns + checkbutton column
  gtk_tree_view_set_search_column(GTK_TREE_VIEW(subWidget), 2);

  g_signal_connect(G_OBJECT(subWidget), "cursor-changed", G_CALLBACK(ListView_change), (gpointer)&listView);
  g_signal_connect(G_OBJECT(subWidget), "row-activated", G_CALLBACK(ListView_activate), (gpointer)&listView);

  gtk_widget_show(subWidget);

  setHeaderVisible(listView.state.headerVisible);
  setCheckable(listView.state.checkable);
  for(auto& text : listView.state.text) append(text);
  for(unsigned n = 0; n < listView.state.checked.size(); n++) setChecked(n, listView.state.checked[n]);
  if(listView.state.selected) setSelection(listView.state.selection);
  autoSizeColumns();
}
int QtTreePropertyBrowser::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QtAbstractPropertyBrowser::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 6)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 6;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 6)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 6;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = indentation(); break;
        case 1: *reinterpret_cast< bool*>(_v) = rootIsDecorated(); break;
        case 2: *reinterpret_cast< bool*>(_v) = alternatingRowColors(); break;
        case 3: *reinterpret_cast< bool*>(_v) = isHeaderVisible(); break;
        case 4: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break;
        case 5: *reinterpret_cast< int*>(_v) = splitterPosition(); break;
        case 6: *reinterpret_cast< bool*>(_v) = propertiesWithoutValueMarked(); break;
        default: break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setIndentation(*reinterpret_cast< int*>(_v)); break;
        case 1: setRootIsDecorated(*reinterpret_cast< bool*>(_v)); break;
        case 2: setAlternatingRowColors(*reinterpret_cast< bool*>(_v)); break;
        case 3: setHeaderVisible(*reinterpret_cast< bool*>(_v)); break;
        case 4: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break;
        case 5: setSplitterPosition(*reinterpret_cast< int*>(_v)); break;
        case 6: setPropertiesWithoutValueMarked(*reinterpret_cast< bool*>(_v)); break;
        default: break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 7)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
void CPropBrowserEngineGeneral::show(QWidget* parentWindow)
{
	setPropertiesWithoutValueMarked(true); // so that group properties stand out
	setRootIsDecorated(true); // keep true, otherwise subcategories won't work correctly
	setAlternatingRowColors(true);
	setHeaderVisible(true);
	//setIndentation(60);
	//setStatusTip("bla");
	//setToolTip("Bla");
	setResizeMode(QtTreePropertyBrowser::Interactive);
	setSplitterPosition(_splitterPos);
	setWindowTitle("Physics Engines Properties - General");


	variantManager = new QtVariantPropertyManager();
	variantFactory = new QtVariantEditorFactory();
	setFactoryForManager(variantManager,variantFactory);


	buttonManager = new ButtonEditManager();
	buttonFactory  = new PushButtonEditFactory();
	setFactoryForManager(buttonManager,buttonFactory);


	QStringList configurationEnum;
	configurationEnum << "Very accurate" << "Accurate (default)" << "Fast" << "Very fast" << "Customized";
	p_configuration = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),"");
	p_configuration->setAttribute("enumNames", configurationEnum);
	QtBrowserItem* anItem=addProperty(p_configuration);
	setBackgroundColor(anItem,QTPROPERTYBROWSER_COLOR_GREY);


	QtProperty *bulletGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Bullet properties");
	bulletGroup->theBrightness=140;
	bulletGroupItem=addProperty(bulletGroup);
	setBackgroundColor(bulletGroupItem,QTPROPERTYBROWSER_COLOR_RED);
	setExpanded(bulletGroupItem,_bulletPropertiesExpanded);

	QtProperty *odeGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"ODE properties");
	odeGroup->theBrightness=140;
	odeGroupItem=addProperty(odeGroup);
	setBackgroundColor(odeGroupItem,QTPROPERTYBROWSER_COLOR_GREEN);
	setExpanded(odeGroupItem,_odePropertiesExpanded);

	QtProperty *vortexGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Vortex properties");
	vortexGroup->theBrightness=140;
	vortexGroupItem=addProperty(vortexGroup);
	setBackgroundColor(vortexGroupItem,QTPROPERTYBROWSER_COLOR_BLUE);
	setExpanded(vortexGroupItem,_vortexPropertiesExpanded);

	// Bullet:
	p_bulletTimeStep = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletTimeStep);
	p_bulletConstraintSolvIterat = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletConstraintSolvIterat);
	p_bulletInternalScaling = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletInternalScaling);
	p_bulletInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	bulletGroup->addSubProperty(p_bulletInternalFullScaling);
	p_bulletCollMarginScaling = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletCollMarginScaling);

	// ODE:
	p_odeTimeStep = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeTimeStep);
	p_odeQuickStep = variantManager->addProperty(QVariant::Bool,"");
	odeGroup->addSubProperty(p_odeQuickStep);
	p_odeIterations = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeIterations);
	p_odeInternalScaling = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeInternalScaling);
	p_odeInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	odeGroup->addSubProperty(p_odeInternalFullScaling);
	p_odeGlobalErp = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeGlobalErp);
	p_odeGlobalCfm = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeGlobalCfm);

	// Vortex:
	p_vortexTimeStep = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexTimeStep);
	p_vortexContactTolerance = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexContactTolerance);
	p_vortexInternalScaling = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexInternalScaling);
	p_vortexInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexInternalFullScaling);
	p_vortexAutoSleep = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexAutoSleep);
	p_vortexMultithreading = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexMultithreading);

	QtProperty* vortexConstraint = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Constraint properties");
	vortexGroup->addSubProperty(vortexConstraint);
	vortexConstraintItem=getSubPropertyBrowserItem(vortexGroupItem,vortexConstraint);
	setExpanded(vortexConstraintItem,_vortexConstraintPropertiesExpanded);

	p_vortexConstraintLinearCompliance = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearCompliance);
	p_vortexConstraintLinearDamping = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearDamping);
	p_vortexConstraintLinearKinLoss = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearKinLoss);
	p_vortexConstraintAngularCompliance = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularCompliance);
	p_vortexConstraintAngularDamping = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularDamping);
	p_vortexConstraintAngularKinLoss = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularKinLoss);


	refresh();

	enableNotifications(true);

//	setWindowFlags(Qt::CustomizeWindowHint|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint);
//	setWindowModality(Qt::ApplicationModal);
	setGeometry(_dlgPosX,_dlgPosY,_dlgSizeX,_dlgSizeY);

}