PDA

View Full Version : Draw listbox (or pushbutton or slider ...) by opengl in QT



ic_teta
26th February 2015, 14:52
Hello

I use glwidget class to draw my mainwindow ui form. (mainwindow class is parent of glwidget class).
Now i need to have a listbox in almost center of my form.
I don't want to use QListBos gui component, because whole my form is drawn by glwidget class.
Now i want to draw listbox in glwidget class, but it's hard for me to draw.
Does any body now how i can find any class about drawing listbox (or pushbutton or slider ...) in opengl and glwidget class?

wysota
26th February 2015, 18:30
Drawing or actually making it work?

ic_teta
27th February 2015, 06:09
I want drawing

wysota
27th February 2015, 08:32
QStylePainter (or QStyle itself) is capable of drawing Qt widgets on a given painter. You can either open a painter directly on OpenGL canvas in Qt4 or use QOpenGLPaintDevice in Qt5 or paint on a pixmap, then convert it to a texture and apply it wherever you want directly in GL scene.

An alternative is to use Qt Quick.

ic_teta
27th February 2015, 12:49
QStylePainter (or QStyle itself) is capable of drawing Qt widgets on a given painter. You can either open a painter directly on OpenGL canvas in Qt4 or use QOpenGLPaintDevice in Qt5 or paint on a pixmap, then convert it to a texture and apply it wherever you want directly in GL scene.

An alternative is to use Qt Quick.

Would u do me a favore and give me a simple code to understand more?

wysota
27th February 2015, 15:19
Simple code that does what? Which part you do not understand?