[Interest] QuickFrameBufferObject does not redraw

2015-09-16 Thread Wehmer, Matthias
Hi everybody,

 

I am currently experimenting with the QFrameBufferObject and try to draw via
raw OpenGL calls.

 

The relevant part of the render function in the
QuickFrameBuffrObject::Renderer looks like this:

 

void Drawer::render()

{

int width = 1.0f;

int height = 1.0f;

glEnable(GL_BLEND);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glColor4f(0.0, 0.0, 1.0, 0.8);

 

// Drawing background

glBegin(GL_QUADS);

glVertex2f(-1.0f, -1.0f);

glVertex2f(width, -1.0f);

glVertex2f(width, height);

glVertex2f(-1.0f, height);

glEnd();

 

if( m_window != nullptr )

m_window->resetOpenGLState();

 

//update();

}

 

The problem is, that after resizing the window or conducting any other
changes to the scene, the scene does not update. In case of resizing the
screen it got cleared and does not draw anything new. When debugging I can
observe, that the render function as well as the createFrameBuffer methods
are called and work correctly.

When searching the web, there are the following potential error sources:

-  Shader program is overwritten

-  Wrong OpenGl context is used

-  OpenGL state is not reset

 

Do you have any experiences with this and can you see, where the error in my
example might be?

 

Thanks a lot!

 

Best regards

Matthias



smime.p7s
Description: S/MIME cryptographic signature
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QuickFrameBufferObject does not redraw

2015-09-16 Thread Agocs Laszlo
Hi,


You most likely have some state set that affects your custom rendering. For 
example you will probably have a program active which is not ideal in your 
case. Try adding a glUseProgram(0).


See the slightly enhanced 5.5 docs at 
http://doc.qt.io/qt-5/qquickframebufferobject-renderer.html#render


Best regards,

Laszlo



From: interest-bounces+laszlo.agocs=theqtcompany@qt-project.org 
 on behalf of 
Wehmer, Matthias 
Sent: Wednesday, September 16, 2015 8:34 AM
To: interest@qt-project.org
Subject: [Interest] QuickFrameBufferObject does not redraw


Hi everybody,



I am currently experimenting with the QFrameBufferObject and try to draw via 
raw OpenGL calls.



The relevant part of the render function in the QuickFrameBuffrObject::Renderer 
looks like this:



void Drawer::render()

{

int width = 1.0f;

int height = 1.0f;

glEnable(GL_BLEND);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glColor4f(0.0, 0.0, 1.0, 0.8);



// Drawing background

glBegin(GL_QUADS);

glVertex2f(-1.0f, -1.0f);

glVertex2f(width, -1.0f);

glVertex2f(width, height);

glVertex2f(-1.0f, height);

glEnd();



if( m_window != nullptr )

m_window->resetOpenGLState();



//update();

}



The problem is, that after resizing the window or conducting any other changes 
to the scene, the scene does not update. In case of resizing the screen it got 
cleared and does not draw anything new. When debugging I can observe, that the 
render function as well as the createFrameBuffer methods are called and work 
correctly.

When searching the web, there are the following potential error sources:

-  Shader program is overwritten

-  Wrong OpenGl context is used

-  OpenGL state is not reset



Do you have any experiences with this and can you see, where the error in my 
example might be?



Thanks a lot!



Best regards

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


Re: [Interest] link error (and probably a dumb question)

2015-09-16 Thread Rainer Wiesenfarth

Am 16.09.2015 um 11:19 schrieb René J.V. Bertin:

[...]  1st command fails and the 2nd succeeds:

1%> [...] g++ [...] -L/opt/local/build/qtbase/lib -lQt5Sql -lQt5Core.so [...]
.obj/qsql_sqlite.o: In function `qMakeError':
[...] undefined reference to `QSqlError::QSqlError [...]

2%> [...] g++ [...] /opt/local/build/qtbase/lib/libQt5Sql.so 
/opt/local/build/qtbase/lib/libQt5Core.so [...]

[...]

When I give only QtCore via a full path I'm left with errors about an undefined 
reference to
QSqlError::QSqlError [...]


I _think_ that the first command resolves references strictly ordered 
(Q55Sql first, then Qt5Core) while the second resolves them in common.


In this case, using

  ... -lQt5Sql -lQt5Core -lQt5Sql ...

should solve the issue.


Another guess: Does replacing "-lQt5Core.so" with "-lQt5Core" in the 
first command change the behavior?


Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

--
Software Engineer | Trimble Imaging Division
Rotebühlstraße 81 | 70178 Stuttgart | Germany
Office +49 711 22881 0 | Fax +49 711 22881 11
http://www.trimble.com/imaging/ | http://www.inpho.de/

Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim
Eingetragen beim Amtsgericht Darmstadt unter HRB 83893,
Geschäftsführer: Dr. Frank Heimberg, Hans-Jürgen Gebauer



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] link error (and probably a dumb question)

2015-09-16 Thread René J . V . Bertin
Hi,

I hate to ask, but I can't seem to understand while building Qt 5.5.0 on linux 
why the 1st command fails and the 2nd succeeds:

1%> (cd /opt/local/build/qtbase/src/plugins/sqldrivers/sqlite ; g++ -v 
-L/opt/local/lib -O3 -march=native -fpermissive -g -Wl,--no-undefined 
-Wl,--enable-new-dtags -Wl,-rpath,/opt/local/lib 
-Wl,-rpath,/opt/local/libexec/qt5/lib -Wl,-rpath,/opt/local/lib 
-Wl,-rpath,/opt/local/libexec/qt5/lib -shared -o libqsqlite.so .obj/smain.o 
.obj/qsql_sqlite.o .obj/moc_qsql_sqlite_p.o -L/usr/lib/x86_64-linux-gnu 
-lsqlite3 -L/opt/local/build/qtbase/lib -lQt5Sql -lQt5Core.so -lpthread)
.obj/qsql_sqlite.o: In function `qMakeError':
/opt/local/src/qt-everywhere-opensource-src-5.5.0/qtbase/src/sql/drivers/sqlite/qsql_sqlite.cpp:101:
 undefined reference to `QSqlError::QSqlError(QString const&, QString const&, 
QSqlError::ErrorType, QString const&)'
.obj/qsql_sqlite.o: In function `QString::toLower() const &':
/opt/local/src/qt-everywhere-opensource-src-5.5.0/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:389:
 undefined reference to `QString::toLower_helper(QString const&)'


2%> (cd /opt/local/build/qtbase/src/plugins/sqldrivers/sqlite ; g++ -v 
-L/opt/local/lib -O3 -march=native -fpermissive -g -Wl,--no-undefined 
-Wl,--enable-new-dtags -Wl,-rpath,/opt/local/lib 
-Wl,-rpath,/opt/local/libexec/qt5/lib -Wl,-rpath,/opt/local/lib 
-Wl,-rpath,/opt/local/libexec/qt5/lib -shared -o libqsqlite.so .obj/smain.o 
.obj/qsql_sqlite.o .obj/moc_qsql_sqlite_p.o -L/usr/lib/x86_64-linux-gnu 
-lsqlite3 /opt/local/build/qtbase/lib/libQt5Sql.so 
/opt/local/build/qtbase/lib/libQt5Core.so -lpthread)

That 2nd command was of course created manually by converting the -L 
/opt/local/build path into absolute references to the QtSql and QtCore shared 
libraries. At least the QtCore library seems suitable for the intended kind of 
linking because the bearer plugins built just fine. The linker also does pull 
in symbols from both libraries; the 1st command spews a total of 30 lines when 
both libraries are passed in via -l; over 200 when -lQt5Sql is missing and 
almost 500 when -lQt5Core is missing instead. Both libraries must be given with 
their full path. 

When I give only QtCore via a full path I'm left with errors about an undefined 
reference to
QSqlError::QSqlError(QString const&, QString const&, QSqlError::ErrorType, 
QString const&)

Does that help understand what's going on here?

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


Re: [Interest] QByteArray to quint64

2015-09-16 Thread Giuseppe D'Angelo

Il 16/09/2015 12:28, Tom Isaacson ha scritto:

If I want to convert a QByteArray to quint32 I can use:
 quint32 result = QByteArray("1234").toUInt();

But what if I want to convert a longer array to quint64? Writing cross-platform 
code requires a mix of _strtoi64() and strtoull(). Is there a simple way of 
doing this in Qt?


Are you talking about converting the decimal representation using the C 
locale? toULongLong().


HTH,

--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - The Qt Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] link error (and probably a dumb question)

2015-09-16 Thread René J . V . Bertin
Rainer Wiesenfarth wrote:

> I _think_ that the first command resolves references strictly ordered
> (Q55Sql first, then Qt5Core) while the second resolves them in common.
> 
> In this case, using
> 
>... -lQt5Sql -lQt5Core -lQt5Sql ...
> 
> should solve the issue.

I started trying that, but didn't check all combinations yet. In any case,
-lQt5Sql -lQt5Core -lQt5Sql -lQt5Core
doesn't even reduce the number of errors.

I also think that modern linkers no longer have the limitation you refer to.

> Another guess: Does replacing "-lQt5Core.so" with "-lQt5Core" in the
> first command change the behavior?

OOps, that was an editing error (my actual paths are more convoluted). So that 
actual command was -lQt5Core without the extension (which would fail with a 
"lib 
not found" kind of error).


> 
> Best Regards / Mit freundlichen Grüßen
> Rainer Wiesenfarth
> 


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


[Interest] QtCanvas3D + three.js + OBJMTL

2015-09-16 Thread privet56 hotmail . com
Hi,

QtCanvas3D is cool, the demos are fine in Qt 5.5!
However, looking at the code, I miss some features regarding three.js-support:

1) is QtCanvas3D supporting only ThreeJSLoader, or could I  also use 
OBJLoader+MTLLoader (=OBJMTLLoader)?
Are demos available for this use case?

2) the current ThreeJSLoader-implementation drawing in paintGL(...) 'manually' 
seems to be work-intensive
(with low-level GL code)
in comparison with the "normal" Three.js use cases!
Is it planned to create a wrapper which would hide the current manual 
QtCanvas3D-related implementation?

2) can I use the threejs-OrbitControls (instead of manually implementing the 
mouseClick/Move events)?

3) can I use THREE.WebGLRenderer instead of Canvas3DRenderer (which is used in 
all demos)?
Actually, I would like to use a THREE.EffectComposer instead of a plain 
WebGLRenderer, if it would be supported...!?

Thx,

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


Re: [Interest] link error (and probably a dumb question)

2015-09-16 Thread Andreas Pakulat
Hi,

On Wed, Sep 16, 2015 at 12:46 PM, René J. V.  wrote:

> Rainer Wiesenfarth wrote:
>
> > I _think_ that the first command resolves references strictly ordered
> > (Q55Sql first, then Qt5Core) while the second resolves them in common.
> >
> > In this case, using
> >
> >... -lQt5Sql -lQt5Core -lQt5Sql ...
> >
> > should solve the issue.
>
> I started trying that, but didn't check all combinations yet. In any case,
> -lQt5Sql -lQt5Core -lQt5Sql -lQt5Core
> doesn't even reduce the number of errors.
>
> I also think that modern linkers no longer have the limitation you refer
> to.


I've only been around for 12 years in the gcc/linux area and the linker
never needed special ordering when linking shared libraries. This has and
is only a requirement when linking against static libraries.

The most common reason for problems when using -l along with
-L is that it leaves the linker to decide which
library to actually pick up, while passing the absolute path enforces some
library. Your link command has several -L flags setting up 'search paths'
for the linker and additionally the linker has some built-in paths and a
system may have globally configured ones (/etc/ld.so.config). The linker
will search in these paths in 'some' order for a library named .so
and pick the first it finds. I don't remember the order from the top of my
head, but as soon as you have more than one version of a particular
.so on your system it may end up picking one that you didn't
intend to. (thats one of the reasons why cmake advertizes passing it
absolute paths to shared libraries and if possible passes these on as-is to
the linker)\

So if you do have another Qt5Core on your system, maybe a slightly
different version, then that would explain the linking errors when you use
just -lQt5Core -lQt5Sql. It also explains possible issues when you use
-lQt5Core /path/to/libQt5Sql.so, since the Qt5Sql is from a different
version of qt it may require other symbols than are in Qt5Core (in
particular if a newer Qt5Sql is used with an older Qt5Core).

The manpage for ld gives some more hints what the search path order is.

Andreas

> > Another guess: Does replacing "-lQt5Core.so" with "-lQt5Core" in the
> > first command change the behavior?
>
> OOps, that was an editing error (my actual paths are more convoluted). So
> that
> actual command was -lQt5Core without the extension (which would fail with
> a "lib
> not found" kind of error).
>
>
> >
> > Best Regards / Mit freundlichen Grüßen
> > Rainer Wiesenfarth
> >
>
>
> ___
> 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] Using Qt as backend for plugin to be loaded on a host software

2015-09-16 Thread Nuno Santos
Hi.

I’m developing a plugin to be loaded by a music software host (VST). There are 
some lighter alternatives to provide graphics, network and other kinds of 
useful resources but I want to use Qt. I simply Love Qt!

When the plugin is open by the host, it provides a window ref to the plugin. On 
Window it is a HWND handle, on Mac it is supposedly a WindowRef.

I have a working prototype for Windows. I don’t think it is all correct but its 
working. When the plugin is first started I check for the existence of a 
QApplication and start one if not.

Then I create the main controller for my plugin and the QQuickView to draw on 
the window. To create the QQuickView i’m first creating a QWindow with the ptr 
to HWND handle as parent:

window = QWindow::fromWinId((WId)ptr);

view = new QQuickView(window);
view->setSource(QUrl("qrc:/qml/vstmain.qml"));
view->rootContext()->setContextProperty("controller", _controller);
view->show();

This is actually working quite well on Windows. The same strategy however, 
doesn’t work on a Mac. When I try to create a QWindow::fromWinId the result is 
a crash with the following stack trace:

2015-09-16 14:26:18.526 Live[91339:1091079] -[NSHIObject 
setPostsFrameChangedNotifications:]: unrecognized selector sent to instance 
0x19806da0

- The first question is: what is QWindow::fromWinId is expecting to be able to 
create a window? An NSView?

- The second question is: the stack trace says that NSHIObject didn’t 
recognized the selector setPostsFrameChangedNotifications. What is a 
NSHIObject? I can only find references to HIObject from the HIToolbox and that 
belongs to the Carbon frame work. So far I haven’t been able to call Carbon 
methods inside my Qt environment even referencing -framework Carbon

- Third question: On window I have an issue with the QApplication args and 
argv. On debug, there is an ASSERT that says that origArgc is different from 
the actual argc/argv. On release mode it crashes. Why does QApplication needs 
to receive the exact same arguments as the initial app? 

- Fourth question: how should I keep my run loop running without depending on 
the host? On Windows I have created a windows thread to call qApp->exec(). 
Although a warning that exec should be called on main thread it WORKS! How safe 
is this? Is there any other recommended option? What about Mac OS X?

I have been google a lot specially about the NSHIObject and I can’t find an 
answer, not even a simple lead. The closest I have is vstgui, a GUI framework 
for VST plugins that has open source code and support for Carbon and Cocoa 
backends but the NSHIObject is intriguing me because I can’t find any explicit 
reference on how to deal with it.

Any thoughts would be high appreciated.

Thanks in advance,

With my best regards,

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


Re: [Interest] Using Qt as backend for plugin to be loaded on a host software

2015-09-16 Thread Sze Howe Koh
Hi,

On 16 September 2015 at 21:36, Nuno Santos  wrote:
> Hi.
>
> I’m developing a plugin to be loaded by a music software host (VST). There
> are some lighter alternatives to provide graphics, network and other kinds
> of useful resources but I want to use Qt. I simply Love Qt!
>
> When the plugin is open by the host, it provides a window ref to the plugin.
> On Window it is a HWND handle, on Mac it is supposedly a WindowRef.
>
> I have a working prototype for Windows. I don’t think it is all correct but
> its working. When the plugin is first started I check for the existence of a
> QApplication and start one if not.
>
> Then I create the main controller for my plugin and the QQuickView to draw
> on the window. To create the QQuickView i’m first creating a QWindow with
> the ptr to HWND handle as parent:
>
> window = QWindow::fromWinId((WId)ptr);
>
> view = new QQuickView(window);
> view->setSource(QUrl("qrc:/qml/vstmain.qml"));
> view->rootContext()->setContextProperty("controller", _controller);
> view->show();
>
> This is actually working quite well on Windows. The same strategy however,
> doesn’t work on a Mac. When I try to create a QWindow::fromWinId the result
> is a crash with the following stack trace:
>
> 2015-09-16 14:26:18.526 Live[91339:1091079] -[NSHIObject
> setPostsFrameChangedNotifications:]: unrecognized selector sent to instance
> 0x19806da0
>
> - The first question is: what is QWindow::fromWinId is expecting to be able
> to create a window? An NSView?
>
> - The second question is: the stack trace says that NSHIObject didn’t
> recognized the selector setPostsFrameChangedNotifications. What is a
> NSHIObject? I can only find references to HIObject from the HIToolbox and
> that belongs to the Carbon frame work. So far I haven’t been able to call
> Carbon methods inside my Qt environment even referencing -framework Carbon
>
> - Third question: On window I have an issue with the QApplication args and
> argv. On debug, there is an ASSERT that says that origArgc is different from
> the actual argc/argv. On release mode it crashes. Why does QApplication
> needs to receive the exact same arguments as the initial app?
>
> - Fourth question: how should I keep my run loop running without depending
> on the host? On Windows I have created a windows thread to call
> qApp->exec(). Although a warning that exec should be called on main thread
> it WORKS! How safe is this? Is there any other recommended option? What
> about Mac OS X?

I don't have experience with your other questions, but I know this one.

This approach works fine on Windows; I'm doing something similar in my
current project. Q(Gui)Application can be safely created in a non-main
thread. Just make sure that you all create all your GUI classes and
run their methods in that same thread.

However, this approach won't work on OS X. Cocoa requires all GUI
operations to be performed in the main thread:
http://stackoverflow.com/questions/9761953/running-a-cocoa-gui-in-a-non-main-thread.

For OS X, see the comments under the answer at
http://stackoverflow.com/questions/22289423/how-to-avoid-qt-app-exec-blocking-main-thread/22290909#22290909
-- Kuba Ober suggests a way to inject your Qt code into your main
thread. Note: I don't have a Mac, so I have never tested this myself.

Please let me know if it works, because I'd like to support OS X with
my project in the future.

(Note: One difference between my project and yours is that I only
create new windows in my plugin; I don't use Qt to manipulate an
existing window. I don't know if this will make a difference to you or
not.)


> I have been google a lot specially about the NSHIObject and I can’t find an
> answer, not even a simple lead. The closest I have is vstgui, a GUI
> framework for VST plugins that has open source code and support for Carbon
> and Cocoa backends but the NSHIObject is intriguing me because I can’t find
> any explicit reference on how to deal with it.
>
> Any thoughts would be high appreciated.
>
> Thanks in advance,
>
> With my best regards,
>
> Nuno


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


[Interest] Qml javascript super keyword

2015-09-16 Thread Jérôme Godbout
Hi,
anybody know if there's a way to have the *super* keyword (ES6
specification) equivalent into a qml script? I have seen the signal
workaround (see link below), but sadly this does not get reevaluated like
functions parameters, it only get called once which is not correct with
what I want to do.

I don't expect anything until super is introduced into Qml javascript but
if anybody have a way I would be grateful.

When can we expect to have the super keyword support into Qml?

Super keyword info:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super

Signal workaround, but is imperative and cannot really be used inside a
binding like function can right now
https://forum.qt.io/topic/10265/solved-how-to-call-parent-qml-screen-s-javascript-function/4

https://bugreports.qt.io/browse/QTBUG-25942
This is the related bug

basic example:
A.qml
Item
{
  function toto()
  {
return "base toto";
  }
}

B.qml
A
{
   function toto()
   {
 return "a non " + super.toto(); // or any equivalent to the
super.toto()
   }
}

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


[Interest] Why das rcc -list my.qrc appen CRCRLF ?

2015-09-16 Thread Gunnar Roth
Hi,

Why das rcc -list my.qrc append CRCRLF to line end?

 

I have cmake code ( from QtCompanies quickcompiler ) which does a \n to ; replace to convert a string to a cmake list  

and iterates over the elements. That did not work because the guy who wrote that is not aware of windows.

I tried to do a \r\n to ; replace but that also didnt work, then i found that rcc is adding \r\r\n to the lines.

Why?

 

Best regards,

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


Re: [Interest] link error (and probably a dumb question)

2015-09-16 Thread Thiago Macieira
On Wednesday 16 September 2015 11:19:23 René J.V. Bertin wrote:
> .obj/qsql_sqlite.o: In function `QString::toLower() const &':
> /opt/local/src/qt-everywhere-opensource-src-5.5.0/qtbase/include/QtCore/../.
> ./src/corelib/tools/qstring.h:389: undefined reference to
> `QString::toLower_helper(QString const&)'

As Andreas pointed out and you've found out, the problem is mixing different Qt 
versions. Your headers are from Qt 5.5, as evidenced by the fact that the 
rvalue-ref QString::toLower() inline function was found (added in Qt 5.4, 
actually, in 19dd9a0ebd570ac134e115f2339912a1015ecde5), but the corresponding 
out-of-line implementation in toLower_helper() is missing during linking.

This means your -lQt5Core found an older (< 5.4) version of QtCore.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

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


Re: [Interest] Using Qt as backend for plugin to be loaded on a host software

2015-09-16 Thread Nuno Santos
Hi Konstantin,

Yes! I have been told before. I think the solution for that particular case is 
to namespace the build. Haven’t tried yet. I want to sort this problems first.

Thanks for warning me.

Regards,

Nuno

> On 16 Sep 2015, at 19:01, Konstantin Tokarev  wrote:
> 
> I cannot help you with your questions, but I'd like to warn you that if 
> somebody else loves Qt as much as you do (i.e., creates another VST plugin 
> with Qt), host may crash if someone loads two such plugins with different Qt 
> versions.

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


Re: [Interest] Using Qt as backend for plugin to be loaded on a host software

2015-09-16 Thread Nuno Santos
Hi,

After spending the whole day around Carbon and HIToolbox I’m now sure that the 
WindowRef provided is a for a Carbon window. However I’m not been able to add a 
single colored NSView to the windows provided by the host. This what I have 
been trying to do. Is there anyone with experience in Carbon here? Can you see 
something terribly wrong? The window appears completely white, always!

WindowRef w= (WindowRef) ptr;

NSView *view = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
[view setWantsLayer:YES];
view.layer.backgroundColor = [[NSColor yellowColor] CGColor];
NSLog(@"view frame - %f %f %f %f", view.frame.origin.x, view.frame.origin.y, 
view.frame.size.width, view.frame.size.height);

HIViewRef content;
HIViewFindByID(HIViewGetRoot(w), kHIViewWindowContentID, );

HIRect frame;
HIViewGetFrame(content, );
NSLog(@"content frame - %f %f %f %f", frame.origin.x, frame.origin.y, 
frame.size.width, frame.size.height);

HIViewRef hiCocoaView;
HICocoaViewCreate(view, 0, );
frame.origin.x=0;
frame.origin.y=0;
frame.size.width=640;
frame.size.height=480;
HIViewSetFrame(hiCocoaView, );
HIViewGetFrame(hiCocoaView, );
NSLog(@"cocoa view frame - %f %f %f %f", frame.origin.x, frame.origin.y, 
frame.size.width, frame.size.height);

HICocoaViewSetView(hiCocoaView, view);

HIViewSetVisible(hiCocoaView, true);
HIViewSetNeedsDisplay(hiCocoaView, true);

HIViewAddSubview(content, hiCocoaView);
HIViewSetNeedsDisplay(content, true);
HIViewSetVisible(content, true);

2015-09-16 18:19:30.387 Live[93099:1193953] view frame - 0.00 0.00 
100.00 100.00
2015-09-16 18:19:30.387 Live[93099:1193953] content frame - 0.00 16.00 
1024.00 768.00
2015-09-16 18:19:30.387 Live[93099:1193953] cocoa view frame - 0.00 
0.00 640.00 480.00

Nuno Santos
Founder / CEO / CTO
www.imaginando.pt
+351 91 621 69 62

> On 16 Sep 2015, at 14:36, Nuno Santos  wrote:
> 
> Hi.
> 
> I’m developing a plugin to be loaded by a music software host (VST). There 
> are some lighter alternatives to provide graphics, network and other kinds of 
> useful resources but I want to use Qt. I simply Love Qt!
> 
> When the plugin is open by the host, it provides a window ref to the plugin. 
> On Window it is a HWND handle, on Mac it is supposedly a WindowRef.
> 
> I have a working prototype for Windows. I don’t think it is all correct but 
> its working. When the plugin is first started I check for the existence of a 
> QApplication and start one if not.
> 
> Then I create the main controller for my plugin and the QQuickView to draw on 
> the window. To create the QQuickView i’m first creating a QWindow with the 
> ptr to HWND handle as parent:
> 
> window = QWindow::fromWinId((WId)ptr);
> 
> view = new QQuickView(window);
> view->setSource(QUrl("qrc:/qml/vstmain.qml"));
> view->rootContext()->setContextProperty("controller", _controller);
> view->show();
> 
> This is actually working quite well on Windows. The same strategy however, 
> doesn’t work on a Mac. When I try to create a QWindow::fromWinId the result 
> is a crash with the following stack trace:
> 
> 2015-09-16 14:26:18.526 Live[91339:1091079] -[NSHIObject 
> setPostsFrameChangedNotifications:]: unrecognized selector sent to instance 
> 0x19806da0
> 
> - The first question is: what is QWindow::fromWinId is expecting to be able 
> to create a window? An NSView?
> 
> - The second question is: the stack trace says that NSHIObject didn’t 
> recognized the selector setPostsFrameChangedNotifications. What is a 
> NSHIObject? I can only find references to HIObject from the HIToolbox and 
> that belongs to the Carbon frame work. So far I haven’t been able to call 
> Carbon methods inside my Qt environment even referencing -framework Carbon
> 
> - Third question: On window I have an issue with the QApplication args and 
> argv. On debug, there is an ASSERT that says that origArgc is different from 
> the actual argc/argv. On release mode it crashes. Why does QApplication needs 
> to receive the exact same arguments as the initial app? 
> 
> - Fourth question: how should I keep my run loop running without depending on 
> the host? On Windows I have created a windows thread to call qApp->exec(). 
> Although a warning that exec should be called on main thread it WORKS! How 
> safe is this? Is there any other recommended option? What about Mac OS X?
> 
> I have been google a lot specially about the NSHIObject and I can’t find an 
> answer, not even a simple lead. The closest I have is vstgui, a GUI framework 
> for VST plugins that has open source code and support for Carbon and Cocoa 
> backends but the NSHIObject is intriguing me because I can’t find any 
> explicit reference on how to deal with it.
> 
> Any thoughts would be high appreciated.
> 
> Thanks in advance,
> 
> With my best regards,
> 
> Nuno
> ___
> Interest mailing list
> Interest@qt-project.org
> 

Re: [Interest] Using Qt as backend for plugin to be loaded on a host software

2015-09-16 Thread Konstantin Tokarev


16.09.2015, 16:37, "Nuno Santos" :
> Hi.
>
> I’m developing a plugin to be loaded by a music software host (VST). There 
> are some lighter alternatives to provide graphics, network and other kinds of 
> useful resources but I want to use Qt. I simply Love Qt!

I cannot help you with your questions, but I'd like to warn you that if 
somebody else loves Qt as much as you do (i.e., creates another VST plugin with 
Qt), host may crash if someone loads two such plugins with different Qt 
versions.

>
> When the plugin is open by the host, it provides a window ref to the plugin. 
> On Window it is a HWND handle, on Mac it is supposedly a WindowRef.
>
> I have a working prototype for Windows. I don’t think it is all correct but 
> its working. When the plugin is first started I check for the existence of a 
> QApplication and start one if not.
>
> Then I create the main controller for my plugin and the QQuickView to draw on 
> the window. To create the QQuickView i’m first creating a QWindow with the 
> ptr to HWND handle as parent:
>
> window = QWindow::fromWinId((WId)ptr);
>
> view = new QQuickView(window);
> view->setSource(QUrl("qrc:/qml/vstmain.qml"));
> view->rootContext()->setContextProperty("controller", _controller);
> view->show();
>
> This is actually working quite well on Windows. The same strategy however, 
> doesn’t work on a Mac. When I try to create a QWindow::fromWinId the result 
> is a crash with the following stack trace:
>
> 2015-09-16 14:26:18.526 Live[91339:1091079] -[NSHIObject 
> setPostsFrameChangedNotifications:]: unrecognized selector sent to instance 
> 0x19806da0
>
> - The first question is: what is QWindow::fromWinId is expecting to be able 
> to create a window? An NSView?
>
> - The second question is: the stack trace says that NSHIObject didn’t 
> recognized the selector setPostsFrameChangedNotifications. What is a 
> NSHIObject? I can only find references to HIObject from the HIToolbox and 
> that belongs to the Carbon frame work. So far I haven’t been able to call 
> Carbon methods inside my Qt environment even referencing -framework Carbon
>
> - Third question: On window I have an issue with the QApplication args and 
> argv. On debug, there is an ASSERT that says that origArgc is different from 
> the actual argc/argv. On release mode it crashes. Why does QApplication needs 
> to receive the exact same arguments as the initial app?
>
> - Fourth question: how should I keep my run loop running without depending on 
> the host? On Windows I have created a windows thread to call qApp->exec(). 
> Although a warning that exec should be called on main thread it WORKS! How 
> safe is this? Is there any other recommended option? What about Mac OS X?
>
> I have been google a lot specially about the NSHIObject and I can’t find an 
> answer, not even a simple lead. The closest I have is vstgui, a GUI framework 
> for VST plugins that has open source code and support for Carbon and Cocoa 
> backends but the NSHIObject is intriguing me because I can’t find any 
> explicit reference on how to deal with it.
>
> Any thoughts would be high appreciated.
>
> Thanks in advance,
>
> With my best regards,
>
> Nuno
> ,
>
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


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


Re: [Interest] link error (and probably a dumb question)

2015-09-16 Thread René J . V . Bertin
Thiago Macieira wrote:

> This means your -lQt5Core found an older (< 5.4) version of QtCore.

Yes, and the question is where the -L/usr/lib/x86_64-linux-gnu argument is 
added 
to the LDFLAGS, or rather, how I can prevent that from happening ... Probably 
not a trivial step as it clearly doesn't appear in all link commands.
(It occurs in the link command for the sqlite3 plugin, for an xcb library, and 
then only for the pulseaudio plugin from qtmultimedia.)

Or maybe there is a way to force the build process to use absolute paths rather 
than the -lQtFoo form?

R.

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


Re: [Interest] Using Qt as backend for plugin to be loaded on a host software

2015-09-16 Thread Nuno Santos
Sze,

That’s awesome news! :)

I’m still struggling making the QQuickView being displayed on the window given 
by the host.

In my case I really need to draw the Qt content on the window provided by the 
host, otherwise the behaviour is awkward.

I will let you know when I have this working.

Nuno Santos
Founder / CEO / CTO
www.imaginando.pt
+351 91 621 69 62

> On 16 Sep 2015, at 16:05, Sze Howe Koh  wrote:
> 
> I don't have experience with your other questions, but I know this one.
> 
> This approach works fine on Windows; I'm doing something similar in my
> current project. Q(Gui)Application can be safely created in a non-main
> thread. Just make sure that you all create all your GUI classes and
> run their methods in that same thread.
> 
> However, this approach won't work on OS X. Cocoa requires all GUI
> operations to be performed in the main thread:
> http://stackoverflow.com/questions/9761953/running-a-cocoa-gui-in-a-non-main-thread
>  
> .
> 
> For OS X, see the comments under the answer at
> http://stackoverflow.com/questions/22289423/how-to-avoid-qt-app-exec-blocking-main-thread/22290909#22290909
>  
> 
> -- Kuba Ober suggests a way to inject your Qt code into your main
> thread. Note: I don't have a Mac, so I have never tested this myself.
> 
> Please let me know if it works, because I'd like to support OS X with
> my project in the future.
> 
> (Note: One difference between my project and yours is that I only
> create new windows in my plugin; I don't use Qt to manipulate an
> existing window. I don't know if this will make a difference to you or
> not.)

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


Re: [Interest] link error (and probably a dumb question)

2015-09-16 Thread Thiago Macieira
On Wednesday 16 September 2015 21:51:20 René J. V. Bertin wrote:
> Thiago Macieira wrote:
> > This means your -lQt5Core found an older (< 5.4) version of QtCore.
> 
> Yes, and the question is where the -L/usr/lib/x86_64-linux-gnu argument is
> added to the LDFLAGS, or rather, how I can prevent that from happening ...
> Probably not a trivial step as it clearly doesn't appear in all link
> commands. (It occurs in the link command for the sqlite3 plugin, for an xcb
> library, and then only for the pulseaudio plugin from qtmultimedia.)

Find out which variable(s) contains that in mkspecs/*.pri.

My guess is you're going to find it on variable QT_LIBS_GLIB and the other 
glib-based libraries. If that is it, please check whether the following 
command also produces -L/usr/lib/x86_64-linux-gnu:

pkg-config --libs glib-2.0

If it does, please file a bug against your distribution's pkg-config. It's 
broken. It should never list the -L for default library search paths.

Meanwhile, my suggestion is the same as it has always been: don't try to build 
stuff whose development files are present in the library and include default 
search paths. That is, remove the package that installed /usr/lib/x86_64-
linux-gnu/libQt5Core.so.

Note I said libQt5Core.so, not libQt5Core.so.5; I said "whose development files 
are present". I am not talking about an installation for use. I am talking 
only about development files. Get rid of them.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

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


[Interest] Bug in QPlainTextEdit::find

2015-09-16 Thread Scott Aron Bloom
Currently, if you set the flags to QTextDocument::FindWholeWords

The system ONLY checks for a boundary of isNumberOrLetter, which is NOT the 
same as a whole word.

For instance, if you are searching for the whole word "state" and the text is 
"current_state" is should NOT match, however it does, since _ is not a Number 
or a Letter.

The offending code is in a static findInBlock, so there is no way to override 
it..
  if ((start != 0 && text.at(start - 1).isLetterOrNumber())
|| (end != text.length() && text.at(end).isLetterOrNumber())) {

My solution was to convert the text into a QRegEx bounded by "\b" on either side

One problem I see, is QChar does not have a "isWordSeparator", that would line 
allow for an easy replacement of isLetterOrNumber with !isWordSeparator.

My recommendation, would be to add isWordSeparator to QChar, as well as 
changing the code...


Ideas/thoughts?

Scott





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