Qt Labs Forum » General discussions

Help:Screen rotation based on Qtopia4.3.1

(1 post)
  • Started 2 months ago by zhaoyuan

Tags:


  1. zhaoyuan
    zhaoyuan
    Member

    I work on qtopia4.3.1 recently,and encounter some difficulties in dealing with
    screen rotation.To fit my own phone platform,I rewrite some functions as the following:

    void QTransformedScreen::setTransformation(Transformation transformation)
    {
    int w_s,h_s;
    d_ptr->transformation = transformation;
    QSize s = mapFromDevice(QSize(dw, dh));
    w = s.width();
    h = s.height();
    qt_screen->w_set(w);
    qt_screen->h_set(h);
    const QScreen *screen = d_ptr->subscreen;
    s = mapFromDevice(QSize(screen->physicalWidth(), screen->physicalHeight()));
    physWidth = s.width();
    physHeight = s.height();
    }

    void QWSDisplay::setTransformation(int t)
    {
    qwsServer->enablePainting(false);
    QPixmapCache::clear();
    QFontCache::instance->clear();
    qws_setScreenTransformation(t);
    // qwsServer->beginDisplayReconfigure();
    // qwsServer->endDisplayReconfigure();
    qwsServer->d_func()->swidth = qt_screen->deviceWidth();
    qwsServer->d_func()->sheight = qt_screen->deviceHeight();
    qwsServer->d_func()->update_regions();
    QApplicationPrivate *ap = QApplicationPrivate::instance();
    ap->setMaxWindowRect(qt_screen, 0,
    QRect(0, 0, qt_screen->width(), qt_screen->height()));
    QSize olds = qApp->desktop()->size();
    qApp->desktop()->resize(qt_screen->width(), qt_screen->height());
    qApp->postEvent(qApp->desktop(), new QResizeEvent(qApp->desktop()->size(), olds));
    qwsServer->enablePainting(true);
    QRegion r = qt_screen->region();
    qwsServer->refresh(r);
    }
    But it does not work well.It seems that a certern region of background isn't refreshed,and keeps the same as the previous view.
    So what I should do,if I want to refresh the whole background.And how & when qtopia refresh the background,if it's the same way as the
    top widget.The code of qwsServer->refresh(qt_screen->region()) doesn't make effects to the refresh of background,and which other
    member function of class or object I can resort to refresh the whole background.Or maybe some other reasons lead to the bug.
    In addition,the first view on rebooting the machine,doesn't work well too.The view display well,but when I rotate the view to landscape
    (rotate 270 degree),the view is located in a wrong place.I don't know the difference the view and other views in refresh and update.
    Can you give me some advice?Thank you so much!

    Posted: 2 months #

RSS feed for this topic

Reply

You must log in to post.



© 2008 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners.