DisplayWindow *DctBandStopFilter::apply(QString windowBaseName) { Q_ASSERT(mCA->dimensionality == 3); QVector2D center(0, 0); for (unsigned int i = 0; i < mCA->shape()[0]; i++) { for (unsigned int j = 0; j < mCA->shape()[1]; j++) { for (unsigned int k = 0; k < mCA->shape()[2]; k++) { QVector2D point(j, k); int freq = (point - center).lengthSquared(); if (freq >= mRadiusNear && freq <= mRadiusFar) { (*mCA)[i][j][k] = Complex(); } } } } int layers = mCA->shape()[0]; int w = mCA->shape()[1]; int h = mCA->shape()[2]; ComplexArray *ca = new ComplexArray(boost::extents[layers][w][h]); *ca = *mCA; TransformWindow *tw = q_check_ptr(qobject_cast<TransformWindow *>(parent())); ImageTransformFilter *inv = tw->inverter(); return new TransformWindow(ca, inv, mFormat, windowBaseName + ", " + name(), q_check_ptr(qobject_cast<QWidget *>(tw->parent()))); }
void QTessellatorPrivate::Vertices::init(int maxVertices) { if (!storage || maxVertices > allocated) { int size = qMax((int)default_alloc, maxVertices); storage = q_check_ptr((Vertex *)realloc(storage, size*sizeof(Vertex))); sorted = q_check_ptr((Vertex **)realloc(sorted, size*sizeof(Vertex *))); allocated = maxVertices; } }
void QEventDispatcherSymbian::startingUp() { if( !CActiveScheduler::Current() ) { m_activeScheduler = q_check_ptr(new CQtActiveScheduler()); // CBase derived class needs to be checked on new CActiveScheduler::Install(m_activeScheduler); } m_wakeUpAO = q_check_ptr(new QWakeUpActiveObject(this)); m_completeDeferredAOs = q_check_ptr(new QCompleteDeferredAOs(this)); // We already might have posted events, wakeup once to process them wakeUp(); }
void QBluetoothServiceDiscoveryAgentPrivate::initL(const QBluetoothAddress &address) { TBTDevAddr btAddress(address.toUInt64()); stop(); //Trapped in Start m_sdpAgent = q_check_ptr(CSdpAgent::NewL(*this, btAddress)); m_filter = q_check_ptr(CSdpSearchPattern::NewL()); m_attributes = q_check_ptr(CSdpAttrIdMatchList::NewL()); m_attributes->AddL(KAttrRangeAll); }
/*! /fn void QTextTablePrivate::update() const This function is usually called when the table is "dirty". It seems to update all kind of table information. */ void QTextTablePrivate::update() const { Q_Q(const QTextTable); nCols = q->format().columns(); nRows = (cells.size() + nCols-1)/nCols; // qDebug(">>>> QTextTablePrivate::update, nRows=%d, nCols=%d", nRows, nCols); grid = q_check_ptr((int *)realloc(grid, nRows*nCols*sizeof(int))); memset(grid, 0, nRows*nCols*sizeof(int)); QTextDocumentPrivate *p = pieceTable; QTextFormatCollection *c = p->formatCollection(); cellIndices.resize(cells.size()); int cell = 0; for (int i = 0; i < cells.size(); ++i) { int fragment = cells.at(i); QTextCharFormat fmt = c->charFormat(QTextDocumentPrivate::FragmentIterator(&p->fragmentMap(), fragment)->format); int rowspan = fmt.tableCellRowSpan(); int colspan = fmt.tableCellColumnSpan(); // skip taken cells while (cell < nRows*nCols && grid[cell]) ++cell; int r = cell/nCols; int c = cell%nCols; cellIndices[i] = cell; if (r + rowspan > nRows) { grid = q_check_ptr((int *)realloc(grid, sizeof(int)*(r + rowspan)*nCols)); memset(grid + (nRows*nCols), 0, sizeof(int)*(r+rowspan-nRows)*nCols); nRows = r + rowspan; } Q_ASSERT(c + colspan <= nCols); for (int ii = 0; ii < rowspan; ++ii) { for (int jj = 0; jj < colspan; ++jj) { Q_ASSERT(grid[(r+ii)*nCols + c+jj] == 0); grid[(r+ii)*nCols + c+jj] = fragment; // qDebug(" setting cell %d span=%d/%d at %d/%d", fragment, rowspan, colspan, r+ii, c+jj); } } } // qDebug("<<<< end: nRows=%d, nCols=%d", nRows, nCols); dirty = false; }
DisplayWindow *ContrastFilter::apply(QString windowBaseName) { QImage result(mImg.size(), mFormat); if (mFormat == QImage::Format_Indexed8 || mFormat == QImage::Format_Mono) { result.setColorTable(mImg.colorTable()); } ColorParser cp(mFormat); float c = std::tan((float)mValue / 100.0f); qDebug() << "contrast:" << c; QVector<int> lut; lut.reserve(256); for (int i = 0; i < 256; i++) { lut << qBound(0, (int)(c * (i - 127) + 127), 255); } for (int x = 0; x < mImg.width(); x++) { for (int y = 0; y < mImg.height(); y++) { QVector3D colorVec = cp.pixel(x, y, mImg); colorVec.setX(lut.at((int)colorVec.x())); colorVec.setY(lut.at((int)colorVec.y())); colorVec.setZ(lut.at((int)colorVec.z())); cp.setPixel(x, y, result, colorVec); } } // parent's parent should be MainWindow return new PhotoWindow(result, windowBaseName + ", " + name(), q_check_ptr(qobject_cast<QWidget *>(parent()->parent()))); }
static CFbsBitmap* createBlitCopy(CFbsBitmap* bitmap) { CFbsBitmap *copy = q_check_ptr(new CFbsBitmap); if(!copy) return 0; if (copy->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()) != KErrNone) { delete copy; copy = 0; return 0; } CFbsBitmapDevice* bitmapDevice = 0; CFbsBitGc *bitmapGc = 0; QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(copy)); QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); bitmapGc->Activate(bitmapDevice); bitmapGc->BitBlt(TPoint(), bitmap); delete bitmapGc; delete bitmapDevice; return copy; }
/*! \internal This function utility function return S60 language list. Returned object ownership is transferred to caller. */ static CAknInputLanguageList* s60LangList() { CAknInputLanguageList *langList = NULL; TRAP_IGNORE(langList = s60LangListL()); q_check_ptr(langList); return langList; }
void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const { HGDIOBJ oldFont = 0; HDC hdc = shared_dc(); if (ttf && (flags & QTextEngine::DesignMetrics)) { for(int i = 0; i < glyphs->numGlyphs; i++) { unsigned int glyph = glyphs->glyphs[i]; if(int(glyph) >= designAdvancesSize) { int newSize = (glyph + 256) >> 8 << 8; designAdvances = q_check_ptr((QFixed *)realloc(designAdvances, newSize*sizeof(QFixed))); for(int i = designAdvancesSize; i < newSize; ++i) designAdvances[i] = -1000000; designAdvancesSize = newSize; } if (designAdvances[glyph] < -999999) { if (!oldFont) oldFont = selectDesignFont(); int width = 0; calculateTTFGlyphWidth(hdc, glyph, width); designAdvances[glyph] = QFixed(width) / designToDevice; } glyphs->advances_x[i] = designAdvances[glyph]; glyphs->advances_y[i] = 0; } if(oldFont) DeleteObject(SelectObject(hdc, oldFont)); } else {
//--------------------------------------------------------------- // MsgSendUtil::MsgSendUtil // Constructor //-------------------------------------------------------------- MsgSendUtil::MsgSendUtil(QObject* parentObject) : QObject(parentObject), mPluginLoader(0), mUniEditorGenUtils(0) { // Load Plugins for send mPluginLoader = new UniEditorPluginLoader(this); mUniEditorGenUtils = q_check_ptr(new UniEditorGenUtils()); }
void QTessellatorPrivate::Scanline::init(int maxActiveEdges) { maxActiveEdges *= 2; if (!edges || maxActiveEdges > default_alloc) { max_edges = maxActiveEdges; int s = qMax(maxActiveEdges + 1, default_alloc + 1); edges = q_check_ptr((Edge **)realloc(edges, s*sizeof(Edge *))); edge_table = q_check_ptr((Edge *)realloc(edge_table, s*sizeof(Edge))); old = q_check_ptr((Edge **)realloc(old, s*sizeof(Edge *))); } size = 0; old_size = 0; first_unused = 0; for (int i = 0; i < maxActiveEdges; ++i) edge_table[i].edge = i+1; edge_table[maxActiveEdges].edge = -1; }
void QPMCache::resizeKeyArray(int size) { if (size <= keyArraySize || size == 0) return; keyArray = q_check_ptr(reinterpret_cast<int *>(realloc(keyArray, size * sizeof(int)))); for (int i = keyArraySize; i != size; ++i) keyArray[i] = i + 1; keyArraySize = size; }
QByteArray QFontEngineS60Extensions::getSfntTable(uint tag) const { Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag)); TInt error = KErrNone; TInt tableByteLength = 0; TAny *table = q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); QByteArray result(static_cast<const char*>(table), tableByteLength); m_trueTypeExtension->ReleaseTrueTypeTable(table); return result; }
void SoundWindow::applyFilter(QAction *action) { FilterInterface *filter = mFiltersHash[action->data().value<QUuid>()]; qDebug() << "filter name:" << filter->name(); FilterData fd; fd.wav = *mWavDecoder; if (filter->setup(fd)) { DisplayWindow *dw = filter->apply(windowTitle()); q_check_ptr(dw)->show(); } }
void MsgAudioSelectionEngine::AddObjectObserverL() { if (iSessionOpen) { TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove; q_check_ptr(iSession); CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); iSession->AddObjectObserverL(*this, 0, notificationType, &defNS); iSession->AddObjectPresentObserverL(*this); } }
EventLoop :: EventLoop (QScriptEngine *engine) : QObject(engine) , d(new ::EventLoop::Private()) { Q_CHECK_PTR (engine); d->proto = q_check_ptr (new EventLoopPrototype (engine)); engine->setDefaultPrototype (qMetaTypeId<QEventLoop*>(), engine->newQObject (d->proto)); auto ctor = engine->newFunction (createEventLoop); auto metaObj = engine->newQMetaObject (&QEventLoop::staticMetaObject, ctor); engine->globalObject().setProperty ("EventLoop", metaObj); }
QT_BEGIN_NAMESPACE /* Helper function for calling into Symbian classes that expect a TDes&. This function converts a QString to a TDes by allocating memory that must be deleted by the caller. */ Q_CORE_EXPORT HBufC* qt_QString2HBufC(const QString& aString) { HBufC *buffer; #ifdef QT_NO_UNICODE TPtrC8 ptr(reinterpret_cast<const TUint8*>(aString.toLocal8Bit().constData())); #else TPtrC16 ptr(qt_QString2TPtrC(aString)); #endif buffer = q_check_ptr(HBufC::New(ptr.Length())); buffer->Des().Copy(ptr); return buffer; }
QS60WindowSurface::QS60WindowSurface(QWidget* widget) : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate) { TDisplayMode mode = S60->screenDevice()->DisplayMode(); bool isOpaque = qt_widget_private(widget)->isOpaque; if (mode == EColor16MA && isOpaque) mode = EColor16MU; // Faster since 16MU -> 16MA is typically accelerated else if (mode == EColor16MU && !isOpaque) mode = EColor16MA; // Try for transparency anyway // We create empty CFbsBitmap here -> it will be resized in setGeometry CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); data->fromSymbianBitmap(bitmap); d_ptr->device = QPixmap(data); setStaticContentsSupport(true); }
//--------------------------------------------------------------- // MsgSendUtil::isValidAddress // @see header file //-------------------------------------------------------------- bool MsgSendUtil::isValidAddress(const QString &address) { bool isValid = false; if (!address.isEmpty()) { HBufC *tempAddr = XQConversions::qStringToS60Desc(address); // 1. perform number validation isValid = CommonPhoneParser::IsValidPhoneNumber(*tempAddr, CommonPhoneParser::ESMSNumber); // 2. if number validity fails, then perform email addr validation if (!isValid) { // additional check for MMS only UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils); isValid = genUtils->IsValidEmailAddress(*tempAddr); delete genUtils; } delete tempAddr; } return isValid; }
DisplayWindow *FourierDCT::apply(QString windowBaseName) { perform(mCA); int layers = mCA->shape()[0]; int w = mSize.width(); int h = mSize.height(); ComplexArray *ca = new ComplexArray(boost::extents[layers][w][h]); *ca = *mCA; // parent's parent should be MainWindow QWidget *mainWindow = q_check_ptr(qobject_cast<QWidget *>(parent()->parent())); // this object is used for transform inversion and can be shared among // multiple instances of TransformWindow* and hance cannot use one of them // as a parent. ideally, this should be constructed for each and every // instance of TW but since we do not store any actual data, the "leak" // (this is a QObject, so it adheres to QObject's deletion rules) is quite // small. // * - see TransformFilter class FourierDCT *dct = new FourierDCT(qobject_cast<QObject *>(mainWindow)); return new TransformWindow(ca, dct, mFormat, windowBaseName + ", " + name(), mainWindow); }
DisplayWindow *LowPassFilter::apply(QString windowBaseName) { Q_ASSERT(mCA->dimensionality == 3); QVector2D center(mCA->shape()[1] / 2, mCA->shape()[2] / 2); rearrangeQuadrants(); for (unsigned int i = 0; i < mCA->shape()[0]; i++) { for (unsigned int j = 0; j < mCA->shape()[1]; j++) { for (unsigned int k = 0; k < mCA->shape()[2]; k++) { QVector2D point(j, k); if ((point - center).lengthSquared() >= mRadius) { (*mCA)[i][j][k] = Complex(); } } } } rearrangeQuadrants(); int layers = mCA->shape()[0]; int w = mCA->shape()[1]; int h = mCA->shape()[2]; ComplexArray *ca = new ComplexArray(boost::extents[layers][w][h]); *ca = *mCA; return new TransformWindow(ca, mFormat, windowBaseName + ", " + name(), q_check_ptr(qobject_cast<QWidget *>(parent()->parent()))); }
bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *length) const { if (!m_trueTypeExtension->HasTrueTypeTable(tag)) return false; bool result = true; TInt error = KErrNone; TInt tableByteLength; TAny *table = q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); if (error != KErrNone) { return false; } else if (*length > 0 && *length < tableByteLength) { result = false; // Caller did not allocate enough memory } else { *length = tableByteLength; if (buffer) memcpy(buffer, table, tableByteLength); } m_trueTypeExtension->ReleaseTrueTypeTable(table); return result; }
QHBufC::QHBufC(const QHBufC &src) : m_hBufC(q_check_ptr(src.m_hBufC->Alloc())) { }
// UniBioMessageDataPlugin::UniBioMessageDataPlugin() // @see header //--------------------------------------------------------------- UniBioMessageDataPlugin::UniBioMessageDataPlugin(QObject* parent) : QObject(parent) { d_ptr = q_check_ptr(new UniBioMessageDataPluginPrivate(this)); }
MsgSimNumDetector::MsgSimNumDetector() { QDEBUG_WRITE("MsgSimNumDetector::MsgSimNumDetector : Enter") d_ptr = q_check_ptr(new MsgSimNumDetectorPrivate()); QDEBUG_WRITE("MsgSimNumDetector::MsgSimNumDetector : Exit") }
void QTessellatorPrivate::cancelCoincidingEdges() { Vertex **vv = vertices.sorted; QCoincidingEdge *tl = 0; int tlSize = 0; for (int i = 0; i < vertices.nPoints - 1; ++i) { Vertex *v = vv[i]; int testListSize = 0; while (i < vertices.nPoints - 1) { Vertex *n = vv[i]; if (v->x != n->x || v->y != n->y) break; if (testListSize > tlSize - 2) { tlSize = qMax(tlSize*2, 16); tl = q_check_ptr((QCoincidingEdge *)realloc(tl, tlSize*sizeof(QCoincidingEdge))); } if (n->flags & (LineBeforeStarts|LineBeforeHorizontal)) { tl[testListSize].start = n; tl[testListSize].end = vertices.prev(n); tl[testListSize].used = false; tl[testListSize].before = true; ++testListSize; } if (n->flags & (LineAfterStarts|LineAfterHorizontal)) { tl[testListSize].start = n; tl[testListSize].end = vertices.next(n); tl[testListSize].used = false; tl[testListSize].before = false; ++testListSize; } ++i; } if (!testListSize) continue; qSort(tl, tl + testListSize); for (int j = 0; j < testListSize; ++j) { if (tl[j].used) continue; for (int k = j + 1; k < testListSize; ++k) { if (tl[j].end->x != tl[k].end->x || tl[j].end->y != tl[k].end->y || tl[k].used) break; if (!winding || tl[j].before != tl[k].before) { cancelEdges(tl[j], tl[k]); break; } ++k; } ++j; } } free(tl); }
void QDesktopWidgetPrivate::init() { // get the screen count int newScreenCount = ScreenCount(X11->display); #ifndef QT_NO_XINERAMA XineramaScreenInfo *xinerama_screeninfo = 0; // we ignore the Xinerama extension when using the display is // using traditional multi-screen (with multiple root windows) if (newScreenCount == 1 && X11->ptrXineramaQueryExtension && X11->ptrXineramaIsActive && X11->ptrXineramaQueryScreens) { int unused; use_xinerama = (X11->ptrXineramaQueryExtension(X11->display, &unused, &unused) && X11->ptrXineramaIsActive(X11->display)); } if (use_xinerama) { xinerama_screeninfo = X11->ptrXineramaQueryScreens(X11->display, &newScreenCount); } if (xinerama_screeninfo) { defaultScreen = 0; } else #endif // QT_NO_XINERAMA { defaultScreen = DefaultScreen(X11->display); newScreenCount = ScreenCount(X11->display); use_xinerama = false; } delete [] rects; rects = new QRect[newScreenCount]; delete [] workareas; workareas = new QRect[newScreenCount]; // get the geometry of each screen int i, j, x, y, w, h; for (i = 0, j = 0; i < newScreenCount; i++, j++) { #ifndef QT_NO_XINERAMA if (use_xinerama) { x = xinerama_screeninfo[i].x_org; y = xinerama_screeninfo[i].y_org; w = xinerama_screeninfo[i].width; h = xinerama_screeninfo[i].height; } else #endif // QT_NO_XINERAMA { x = 0; y = 0; w = WidthOfScreen(ScreenOfDisplay(X11->display, i)); h = HeightOfScreen(ScreenOfDisplay(X11->display, i)); } rects[j].setRect(x, y, w, h); if (use_xinerama && j > 0 && rects[j-1].intersects(rects[j])) { // merge a "cloned" screen with the previous, hiding all crtcs // that are currently showing a sub-rect of the previous screen if ((rects[j].width()*rects[j].height()) > (rects[j-1].width()*rects[j-1].height())) rects[j-1] = rects[j]; j--; } workareas[i] = QRect(); } if (screens) { // leaks QWidget* pointers on purpose, can't delete them as pointer escapes screens = q_check_ptr((QWidget**) realloc(screens, j * sizeof(QWidget*))); if (j > screenCount) memset(&screens[screenCount], 0, (j-screenCount) * sizeof(QWidget*)); } screenCount = j; #ifndef QT_NO_XINERAMA if (use_xinerama && screenCount == 1) use_xinerama = false; if (xinerama_screeninfo) XFree(xinerama_screeninfo); #endif // QT_NO_XINERAMA }
void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool destroyOldWindow) { Q_Q(QWidget); Qt::WindowType type = q->windowType(); Qt::WindowFlags &flags = data.window_flags; QWidget *parentWidget = q->parentWidget(); bool topLevel = (flags & Qt::Window); bool popup = (type == Qt::Popup); bool dialog = (type == Qt::Dialog || type == Qt::Sheet || (flags & Qt::MSWindowsFixedSizeDialogHint)); bool desktop = (type == Qt::Desktop); //bool tool = (type == Qt::Tool || type == Qt::Drawer); if (popup) flags |= Qt::WindowStaysOnTopHint; // a popup stays on top TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); int sw = clientRect.Width(); int sh = clientRect.Height(); if (desktop) { TSize screenSize = S60->screenDevice()->SizeInPixels(); data.crect.setRect(0, 0, screenSize.iWidth, screenSize.iHeight); q->setAttribute(Qt::WA_DontShowOnScreen); } else if (topLevel && !q->testAttribute(Qt::WA_Resized)){ int width = sw; int height = sh; if (extra) { width = qMax(qMin(width, extra->maxw), extra->minw); height = qMax(qMin(height, extra->maxh), extra->minh); } data.crect.setSize(QSize(width, height)); } CCoeControl *const destroyw = destroyOldWindow ? data.winid : 0; createExtra(); if (window) { setWinId(window); TRect tr = window->Rect(); data.crect.setRect(tr.iTl.iX, tr.iTl.iY, tr.Width(), tr.Height()); } else if (topLevel) { if (!q->testAttribute(Qt::WA_Moved) && !q->testAttribute(Qt::WA_DontShowOnScreen)) data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY)); QScopedPointer<QSymbianControl> control( q_check_ptr(new QSymbianControl(q)) ); QT_TRAP_THROWING(control->ConstructL(true, desktop)); control->SetMopParent(static_cast<CEikAppUi*>(S60->appUi())); // Symbian windows are always created in an inactive state // We perform this assignment for the case where the window is being re-created // as a result of a call to setParent_sys, on either this widget or one of its // ancestors. extra->activated = 0; if (!desktop) { TInt stackingFlags; if ((q->windowType() & Qt::Popup) == Qt::Popup) { stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; } else { stackingFlags = ECoeStackFlagStandard; } control->MakeVisible(false); QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags)); // Avoid keyboard focus to a hidden window. control->setFocusSafely(false); RDrawableWindow *const drawableWindow = control->DrawableWindow(); // Request mouse move events. drawableWindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); drawableWindow->EnableVisibilityChangeEvents(); } q->setAttribute(Qt::WA_WState_Created); int x, y, w, h; data.crect.getRect(&x, &y, &w, &h); control->SetRect(TRect(TPoint(x, y), TSize(w, h))); // We wait until the control is fully constructed before calling setWinId, because // this generates a WinIdChanged event. setWinId(control.take()); if (!desktop) s60UpdateIsOpaque(); // must be called after setWinId() } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget QScopedPointer<QSymbianControl> control( q_check_ptr(new QSymbianControl(q)) ); QT_TRAP_THROWING(control->ConstructL(!parentWidget)); // Symbian windows are always created in an inactive state // We perform this assignment for the case where the window is being re-created // as a result of a call to setParent_sys, on either this widget or one of its // ancestors. extra->activated = 0; TInt stackingFlags; if ((q->windowType() & Qt::Popup) == Qt::Popup) { stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; } else { stackingFlags = ECoeStackFlagStandard; } control->MakeVisible(false); QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags)); // Avoid keyboard focus to a hidden window. control->setFocusSafely(false); q->setAttribute(Qt::WA_WState_Created); int x, y, w, h; data.crect.getRect(&x, &y, &w, &h); control->SetRect(TRect(TPoint(x, y), TSize(w, h))); RDrawableWindow *const drawableWindow = control->DrawableWindow(); // Request mouse move events. drawableWindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); drawableWindow->EnableVisibilityChangeEvents(); if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) { activateSymbianWindow(control.data()); control->MakeVisible(true); } // We wait until the control is fully constructed before calling setWinId, because // this generates a WinIdChanged event. setWinId(control.take()); } if (destroyw) { destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw); // Delay deletion of the control in case this function is called in the // context of a CONE event handler such as // CCoeControl::ProcessPointerEventL QMetaObject::invokeMethod(q, "_q_delayedDestroy", Qt::QueuedConnection, Q_ARG(WId, destroyw)); } if (q->testAttribute(Qt::WA_AcceptTouchEvents)) registerTouchWindow(); }
CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(TInt aAttr) { q_check_ptr(iSession); return PropertyDefL(iSession, aAttr); }
void* QVGPixmapData::toNativeType(NativeType type) { if (type == QPixmapData::SgImage) { #if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL) toVGImage(); if (!isValid() || vgImage == VG_INVALID_HANDLE) return 0; TInt err = 0; RSgDriver driver; err = driver.Open(); if (err != KErrNone) return 0; TSgImageInfo sgInfo; sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE; sgInfo.iSizeInPixels.SetSize(w, h); sgInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface; RSgImage *sgImage = q_check_ptr(new RSgImage()); err = sgImage->Create(sgInfo, NULL, NULL); if (err != KErrNone) { driver.Close(); return 0; } pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); if (eglGetError() != EGL_SUCCESS || !(QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_pixmap")) || !vgCreateEGLImageTargetKHR) { driver.Close(); return 0; } const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)sgImage, (EGLint*)KEglImageAttribs); if (eglGetError() != EGL_SUCCESS) { sgImage->Close(); driver.Close(); return 0; } VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage); if (vgGetError() != VG_NO_ERROR) { QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); sgImage->Close(); driver.Close(); return 0; } vgCopyImage(dstVgImage, 0, 0, vgImage, 0, 0, w, h, VG_FALSE); if (vgGetError() != VG_NO_ERROR) { sgImage->Close(); sgImage = 0; } // release stuff vgDestroyImage(dstVgImage); QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); driver.Close(); return reinterpret_cast<void*>(sgImage); #endif } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); if (bitmap) { if (bitmap->Create(TSize(source.width(), source.height()), EColor16MAP) == KErrNone) { const uchar *sptr = source.constBits(); bitmap->BeginDataAccess(); uchar *dptr = (uchar*)bitmap->DataAddress(); Mem::Copy(dptr, sptr, source.byteCount()); bitmap->EndDataAccess(); } else { delete bitmap; bitmap = 0; } } return reinterpret_cast<void*>(bitmap); } return 0; }