Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Retired
Posts: 172
Registered: ‎06-07-2010
My Device: BlackBerry 8520
My Carrier: Rogers

Re: Simple QT app failing on simulator

Hey Guys,

 

How are you doing? I hope all is well.

 

From our investigation, there seems to an error for which we are pushing out to Github.

 

The core fix to the patch the issue is as follows:

 

From:
        val = SCREEN_USAGE_NATIVE;
To:
        val = SCREEN_USAGE_NATIVE | SCREEN_USAGE_READ | SCREEN_USAGE_WRITE;

 

It is related to how our Qt plugin uses libscreen. We weren't completely specifying the read/write usage for our window which is suitable for the device but was resulting in errors on the simulator. 

 

The full change is as below:

 

in /src/plugins/platforms/blackberry/qbbbuffer.cpp
@@ -59,11 +59,14 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)

     // get access to buffer's data
     errno = 0;

     uchar* dataPtr = NULL;
     result = screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr);
     if (result != 0) {
         qFatal("QBB: failed to query buffer pointer, errno=%d", errno);
     }
     if (dataPtr == NULL) {
         qFatal("QBB: buffer pointer is NULL, errno=%d", errno);
     }

     // get format of buffer
     errno = 0;



in /src/plugins/platforms/blackberry/qbbscreen.cpp
@@ -14,7 +14,7 @@
 **
 ****************************************************************************/

 //#define QBBSCREEN_DEBUG

 #include "qbbscreen.h"
 #include "qbbvirtualkeyboard.h"
@@ -380,7 +380,7 @@ 
void QBBScreen::lowerWindow(QBBWindow* window)  void QBBScreen::updateHierarchy()  {  #if defined(QBBSCREEN_DEBUG)

     qDebug() << "QBBScreen::updateHierarchy";
 #endif

     QList<QBBWindow*>::iterator it;


in /src/plugins/platforms/blackberry/qbbwindow.cpp
@@ -56,7 +56,7 @@ QBBWindow::QBBWindow(QWidget *window, screen_context_t context)
     QPlatformWindowFormat format = widget()->platformWindowFormat();
     switch (format.windowApi()) {
     case QPlatformWindowFormat::Raster:
         val = SCREEN_USAGE_NATIVE | SCREEN_USAGE_READ | SCREEN_USAGE_WRITE;
         break;
     case QPlatformWindowFormat::OpenGL:
         val = SCREEN_USAGE_OPENGL_ES2;

 

Let me know if there are any questions and I will be more than happy to answer them for you.

 

Sincerely,

 

Raihan Masroor
BlackBerry Development Advisor
Contributor
Posts: 16
Registered: ‎10-21-2011
My Device: 8520
My Carrier: Orange

Re: Simple QT app failing on simulator

Thanks for this information !

 

I've downloaded the latest source code on GitHub which seems contains this fix. The result I've got it's a little bit different than before. I've got a blank screen.

 

The log:

QBBRasterWindowSurface::QBBRasterWindowSurface - w= QWidget(0x791d830) 
QBBRasterWindowSurface::resize - w= QWidget(0x791d830) , s= QSize(1024, 600) 
QBBRasterWindowSurface::beginPaint - w= QWidget(0x791d830) 
QBBRasterWindowSurface::endPaint - w= QWidget(0x791d830) 
QBBRasterWindowSurface::flush - w= QWidget(0x791d830) 

 

My test is not relevent (I think) because I've built QT with the NDK 2 beta 1 on Windows (with my custom configure.exe). So I will testing this on Linux with the NDK 1 just to be sure.