[Interest] Creating QML views for C++ objects (not classes)

2013-09-29 Thread Николай Шатохин
Hello.

When I create a class in C++, I can register it for QML and can create view
for it. It's very convenient. But, if I need many objects of the same type,
and need to show few views on screen, I got problems.
Is it possible to register QML type for object, not for class?
If I change some object, I need to see only its view changed.

Best regard,
Nick
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QGLWidget and OGL version 4.3 functions?

2013-09-29 Thread Sean Harmer
Hi,

On 27/09/2013 07:35, Thomas Meyer wrote:
 Hi,
 is it possible to render in a QGLWidget with the OGL 4.3 functions?

Yes but it is now recommended to use QWindow + QOpenGLContext for new 
code as QGLWidget will not see any further development.

 If so, how can I call the functions?

You need to get hold of the function entry points for the OpenGL 4.3 
functions. This can be done via the QOpenGLContext to get a pointer to a 
QOpenGLFunctions_4_3_Core or QOpenGLFunctions_4_3_Compatibility object 
depending upon which profile you are using.

If using a QOpenGLContext directly you can just do something like this:

QSurfaceFormat f;
f.setVersion(4, 3);
f.setProfile(QSurfaceFormat::CoreProfile);

m_context = new QOpenGLContext( this );
m_context-setFormat( f );
m_context-create();

QOpenGLFunctions_4_3_Core *funcs = 
m_context-versionFunctionsQOpenGLFunctions_4_3_Core();
if (!funcs) {
 qDebug()  Could not obtain OpenGL 4.3 function entry points;
 return;
}
funcs-initializeOpenGLFunctions();

// From here you can use funcs to call any OpenGL 4.3 function
funcs-glTextureView(...);

If you are using QGLWidget then instead of creating your own context as 
in the above code you can get hold of QGLWidget's context via:

QOpenGLContext *context = m_glWidget-context()-contextHandle();

then follow the above to get the QOpenGLFunctions_4_3_Core pointer. Just 
remember to ask QGLWidget to create a 4.3 context via QGLFormat 
(analogous to QSurfaceFormat above).

Hope this helps,

Sean

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Custom Quick view to visualize a List-model of points on a map

2013-09-29 Thread Ola Røer Thorsen
Ah! Thank you, exactly what I was looking for! 

Best regards,
Ola

(Sendt fra mobiltelefon)

 Den 28. sep. 2013 kl. 16:47 skrev Дмитрий Козлов gni...@mail.ru:
 
 27.09.2013 17:22, Ola Røer Thorsen   пишет:
 Hi,
 
 I have a c++ list model that inherits QAbstractListModel. It contains a list 
 of waypoints that amongst other things have x,y screen coordinates. Points 
 are added, removed and values are changed runtime. 
 
 I want to visualize these in Quick2 on top of a map image. I need to create 
 Quick Items mapped to the items in the list model, bind properties, and 
 remove the items when they are removed from the list. Similar to a ListView, 
 just more for displaying something on a map. Any hints on how to do this? 
 
 
 
 
 You can add itemX, itemY roles to C++ list model items and then use them 
 in QtQuick Repeater's delegate.
 Something like this:
 
 Image {
   id: map
 }
 
 Repeater {
   anchors.fill: map
   model: myModel
   delegate: Rectangle {
 x: itemX
 y: itemY
 
   }
 }
 
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
 
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] QPA plugin and crash in effectiveWinId()

2013-09-29 Thread Martin Koller
Hi,

I'm currently implementing a QPA plugin for Qt-4.8.4.
What I now see is a crash (ASSERT) in QWidget::effectiveWinId() as 
nativeParentWidget() returns 0.
This is happening when I send mouse move events to Qt and the cursors leaves a 
widget:

#5  0x76541555 in qt_assert (assertion=0x7789f049 realParent, 
file=
0x7789ee50 kernel/qwidget.cpp, line=2620) at global/qglobal.cpp:1996
#6  0x770f63f7 in QWidget::effectiveWinId (this=0x674f20) at 
kernel/qwidget.cpp:2620
#7  0x77138767 in qt_qpa_set_cursor (w=0x674f20, force=false) at 
kernel/qwidget_qpa.cpp:865
#8  0x7713623b in QWidgetPrivate::unsetCursor_sys (this=0x6753c0) at 
kernel/qwidget_qpa.cpp:258
#9  0x770fb337 in QWidget::unsetCursor (this=0x674f20) at 
kernel/qwidget.cpp:5115
#10 0x775fb56e in QToolBar::event (this=0x674f20, event=0x7fffcb10) 
at widgets/qtoolbar.cpp:1183


It's not clear to me if I'm doing something wrong or if it's a bug in Qt.

What do I need to do in my QPA plugin so that a widgets has a 
nativeParentWidget() ?

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QGLWidget and OGL version 4.3 functions?

2013-09-29 Thread Thomas Meyer

Hi,
thank you very much!

(I have read your 5 parts article:
http://www.kdab.com/opengl-in-qt-5-1-part-1/
and tried the terrain_tessellation project
http://www.kdab.com/~sean/terrain_tessellation.zip [awesome])

I want to use the QGLWidget, because I get 'artefacts' if
I use QPainter's drawText in QWindow and it is possible to
add QGLWidget as central widget in QMainWindow.
With the QWindow I can only render something (I think) and
found no solution to add it to something or to use buttons, sliders etc.


Before I got your answer, I found a solution:
http://qt-project.org/wiki/How_to_use_OpenGL_Core_Profile_with_Qt
https://svn.theharmers.co.uk/svn/codes/public/opengl/trunk/07-core-profile/
and
http://qt-project.org/forums/viewthread/16041/#90717

So, if I want to use the 'glTextureView' (Core since version 4.3,
http://www.opengl.org/wiki/GLAPI/glTextureView) in GLWidget:
...
voidGLWidget::initializeGL(void)

{

...
typedefvoid(APIENTRY*_glTextureView)(GLuint,GLenum,GLuint,GLenum,GLuint,GLuint,GLuint,GLuint); 



_glTextureViewglTextureView;

glTextureView=(_glTextureView)context()-getProcAddress(glTextureView);

if(glTextureView!=NULL)
{
qDebug()Q_FUNC_INFOglTextureView!=NULL;
}
...
I have not used the function, but this code works for me.


If I use your solution in the 'voidGLWidget::initializeGL(void)' 
function from the

https://svn.theharmers.co.uk/svn/codes/public/opengl/trunk/07-core-profile/
example and add it as central widget in a QMainWindow, it will not work
at 'm_context-create();'.

So, the idea is, to have a render surface in the center of a main window and
have dock widgets around to manipulate the render surface. I don't want to
render buttons, check boxes and sliders (etc.). I want to use what the 
Qt library has.

(Ok, later perhaps in a game development, it looks like better ... :-) )

It would be nice (a wish) to have more documentation and examples about 
OGL with Qt.
More clarity about additional libraries, which are not necessary anymore 
(i.e. glew).
Btw. there is no description for 'QGLContext::getProcAddress' in the 
documentation.


I don't understand:
...
QGLFormatglFormat;
glFormat.setVersion(1, 0);
...
The documentation is not enough for me. I can set the version 1.0, but 
the functions

above 1.0 works.


Thanks,
Thomas


Am 29.09.2013 11:21, schrieb Sean Harmer:

Hi,

On 27/09/2013 07:35, Thomas Meyer wrote:

Hi,
is it possible to render in a QGLWidget with the OGL 4.3 functions?

Yes but it is now recommended to use QWindow + QOpenGLContext for new
code as QGLWidget will not see any further development.


If so, how can I call the functions?

You need to get hold of the function entry points for the OpenGL 4.3
functions. This can be done via the QOpenGLContext to get a pointer to a
QOpenGLFunctions_4_3_Core or QOpenGLFunctions_4_3_Compatibility object
depending upon which profile you are using.

If using a QOpenGLContext directly you can just do something like this:

QSurfaceFormat f;
f.setVersion(4, 3);
f.setProfile(QSurfaceFormat::CoreProfile);

m_context = new QOpenGLContext( this );
m_context-setFormat( f );
m_context-create();

QOpenGLFunctions_4_3_Core *funcs =
m_context-versionFunctionsQOpenGLFunctions_4_3_Core();
if (!funcs) {
  qDebug()  Could not obtain OpenGL 4.3 function entry points;
  return;
}
funcs-initializeOpenGLFunctions();

// From here you can use funcs to call any OpenGL 4.3 function
funcs-glTextureView(...);

If you are using QGLWidget then instead of creating your own context as
in the above code you can get hold of QGLWidget's context via:

QOpenGLContext *context = m_glWidget-context()-contextHandle();

then follow the above to get the QOpenGLFunctions_4_3_Core pointer. Just
remember to ask QGLWidget to create a 4.3 context via QGLFormat
(analogous to QSurfaceFormat above).

Hope this helps,

Sean

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QPA plugin and crash in effectiveWinId()

2013-09-29 Thread Martin Koller
On Sunday 29 September 2013 15:20:09 Martin Koller wrote:
 Hi,
 
 I'm currently implementing a QPA plugin for Qt-4.8.4.
 What I now see is a crash (ASSERT) in QWidget::effectiveWinId() as 
 nativeParentWidget() returns 0.
 This is happening when I send mouse move events to Qt and the cursors leaves 
 a widget:
 
 #5  0x76541555 in qt_assert (assertion=0x7789f049 realParent, 
 file=
 0x7789ee50 kernel/qwidget.cpp, line=2620) at global/qglobal.cpp:1996
 #6  0x770f63f7 in QWidget::effectiveWinId (this=0x674f20) at 
 kernel/qwidget.cpp:2620
 #7  0x77138767 in qt_qpa_set_cursor (w=0x674f20, force=false) at 
 kernel/qwidget_qpa.cpp:865
 #8  0x7713623b in QWidgetPrivate::unsetCursor_sys (this=0x6753c0) at 
 kernel/qwidget_qpa.cpp:258
 #9  0x770fb337 in QWidget::unsetCursor (this=0x674f20) at 
 kernel/qwidget.cpp:5115
 #10 0x775fb56e in QToolBar::event (this=0x674f20, 
 event=0x7fffcb10) at widgets/qtoolbar.cpp:1183
 
 
 It's not clear to me if I'm doing something wrong or if it's a bug in Qt.
 
 What do I need to do in my QPA plugin so that a widgets has a 
 nativeParentWidget() ?

It seems I solved it now. Looking into the vnc plugin, I see that it just 
generates non-zero winIds
in a derived class of QPlatformWindow:
  static QAtomicInt winIdGenerator(1);
  windowId = winIdGenerator.fetchAndAddRelaxed(1);

and returns this in
virtual WId winId() const { return windowId; }

So I also implemented my own QPlatformWindow derived class.

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] How can i animate Layout.preferredWidth and friends?

2013-09-29 Thread Mark
Hi,

I thought something as simple as:

Behavior on Layout.preferredWidth {
NumberAnimation { duration: 1000 }
}

would do.. Apparently not since it crashes qmlscene..
Do i need to do it differently or did i just hit a bug?

Version details:
Qt 5.1.0 x64 (i know, 5.1.1 is out)
Mac Mountain Lion fully updated

Cheers,
Mark
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest