# How to add a QComboBox in QVTKOpenGLNativeWidget?

**URL:** https://discourse.vtk.org/t/how-to-add-a-qcombobox-in-qvtkopenglnativewidget/8081
**Category:** Support
**Created:** [March 18, 2022, 6:04am UTC](https://discourse.vtk.org/t/how-to-add-a-qcombobox-in-qvtkopenglnativewidget/8081 "2022-03-18T06:04:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [March 18, 2022, 6:04am UTC](https://discourse.vtk.org/t/how-to-add-a-qcombobox-in-qvtkopenglnativewidget/8081/1 "2022-03-18T06:04:21Z")

</div>

Now, I need to add a QComboBox in QVTKOpenGLNativeWidget. However, I fand the signal-slot do not work.

The code is:

```auto
#include <qapplication.h>
#include <qsurfaceformat.h>
#include <QVTKOpenGLNativeWidget.h>
#include <qcombobox.h>
#include "qboxlayout.h"
class VTKTestWidget :public QVTKOpenGLNativeWidget
{
public:
	VTKTestWidget()
	{
		m_combobox_ = new QComboBox;
		m_combobox_->addItem("item1");
		m_combobox_->addItem("item2");
		QHBoxLayout* layout = new QHBoxLayout;
		layout->addWidget(m_combobox_);
		this->setLayout(layout);
		connect(m_combobox_, SIGNAL(currentIndexChanged), this, SLOT(widgetComboboxIndexChangeSlot));
	}

public slots:
	void widgetComboboxIndexChangeSlot(int index)
	{
		std::cout << index << std::endl;
	}
protected:
	QComboBox* m_combobox_;
};

int main(int argc, char* argv[])
{
	QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
	QApplication a(argc, argv);

	VTKTestWidget* widget = new VTKTestWidget;
	widget->show();

	return a.exec();
}

```

When I change the index of QComboBox, the `widgetComboboxIndexChangeSlot` would not be called.

How can I fix this problem? Or the QVTKOpenGLNativeWidget can not be treated as a normal QWidget?

Any suggestion is appreciated ~~~~
