×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    151

    QStackedWidget, widget gets overlap after few to and fro switches

    Hi,

    I am utilizing the QStackedWidget to implement the multiview application in QT . On application init I am creating 5 widgets and adding to stack. During execution I am switching to and fro from one widget to other using the setCurrentWidget (I am not destroying the widget as I want to keep their state maintained for next visit).

    To my surprise widget starts overlapping each other after few runs. I am not able to get the cause of problem. I searched in the forum and no such issue is reported so may I am doing something wrong.

    Is there some one who can guide me to prevent this problem?

    Regards,

  2. #2
    Registered User
    Join Date
    Feb 2010
    Posts
    210

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    Can we see your code?
    I have not had any such issues after extensive use of the QStackedWidget (well extensive for my limited experience ).
    Cheers,
    Jon

  3. #3
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    What do you mean by "overlapping"? Do they slide side-to-side such that the edge of the widget below is visible, or do parts of one widget "stick" on the screen when a new widget is pushed or popped?

  4. #4
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    151

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    HI,

    Overlapping means one widget over the widget.

    For much of the time when I keep activating on widget, I can see the controls(buttton, table, image etc) of active wd only. But after many switches, when I activate widget, the controls of previous widget also remains on the screen underneath.

    I think I need to make the widget opaque or not sure what the cause of problem is.

    Regards,

  5. #5
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    142

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    You are running ur code on device or emulator?

  6. #6
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    151

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    I am running the code on Nokia N8. On emulator there is no overlapping. Is there way to make the background opaque. Though it does nto make sense as when one widget is active the other gets hidden I think.

  7. #7
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    Do a lot of your widgets have images for backgrounds? Are you running out of heap? Are you setting any WA_... attributes with QWidget::setAttributes()?

  8. #8
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    151

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    Hey,

    I have logged the heap memory stats. And realize that the problem start happenign when the heap memory reaches 30 000 000 (30 MB). I am using multiple widgest having web view. So whn i start using the stress testing on widgets having web view the memory rises incredibily and hwne I leave the widget memory does not goes down. Problem of memory keep on increasing is in wdigets having QWebView.

    I think there is memory leak with the QWebView. If i do not browse any of widget havign webview application keeps working fine. Heap stats remains constant.

    I have already set enough heap memory for application which is

    TARGET.EPOCHEAPSIZE = 0x20000 0x4000000

    which states max 67 MB but when the heap stats reaches near to 30 MB application widget starts overlapping

    This behaviour is disgusting. QWebView is eating a memory as he is hungry from year or so.

  9. #9
    Registered User
    Join Date
    Dec 2010
    Posts
    34

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    Hey newbie2201,

    I am having the same overlapping problem with stacked or tab widget and QWebView. I noticed that the overlapping start to happen when changing the device (N8) orientation with the QWebView being visible. Here is some simple code that would reproduce the problem:

    QTabWidget* tab = new QTabWidget(this);
    tab->setGeometry(0, 0, 200, 300);

    QListWidget* list = new QListWidget();
    list->addItem("Item 1");
    tab->addTab(list, "List");

    QWebView* web = new QWebView();
    web->setHtml("<html><body>Hi</body></html>");
    tab->addTab(web, "Web");
    If anybody has any ideas please us let know.

    Thanks

  10. #10
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    WebView has some unsavory characteristics, but it is should do fine in 64MB. I suspect you have some leaks.

    There is a documented leak in 4.6.x in QAbstractScrollArea, and often WebViews are embedded in QScrollAreas. The circumvention is to do this prior to destroying the scroll area:

    scrollAreaPtr ->viewport() ->ungrabGesture(Qt::PanGesture);

    This is supposed to be fixed in 4.7.x, but I don't know that it has been.

  11. #11
    Registered User
    Join Date
    Dec 2010
    Posts
    34

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    I can repro this problem consistently. Using the code I mentioned earlier, here are the steps:
    1) Run the app
    2) With the first tab visible go from portrait to landscape and then back to portrait.
    3) Click on the second tab and go from portrait to landscape and then back to portrait again.
    4) Click on the first tab and you can see the widgets overlapped. It looks really ugly.

    I tried:
    -using different layout managers
    -building my own stacked/tab widget
    -setting the resize policy to fixed
    -increase heap size

    Please throw at me any ideas you can think of.

    Thanks

  12. #12
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    151

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    Hey Thanks for the info,

    How can i get the scrollAreaPtr ?

    Also earlier I was delete QWebView objects on application. But now I have decided to delete on widget switch so that the heap memory cna be released. Is there any other way to release the heap memory. And I notice still its not freeing up the memory on switchign from widget.

    This behaviour is screwing me.


    Regards,

  13. #13
    Registered User
    Join Date
    Dec 2010
    Posts
    34

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    I just found this thread. It may or may not be related to our problem.
    Last edited by sevdotcom; 2011-01-14 at 20:49.

  14. #14
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    151

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    Hi Sev,

    It is not relevant to our problem. As the QWebView is working fine the overlapping starts happen only when the heap memory reached near to 30 MB, after navigating and rotating the device many a times. And the controls of views remain at their position but the widget do start overlapping each other.

    Regards,

  15. #15
    Registered User
    Join Date
    Dec 2010
    Posts
    34

    Re: QStackedWidget, widget gets overlap after few to and fro switches

    Yeah, it did not fix my problem either. Nokia folks, please help.

Similar Threads

  1. rodata overlap errors
    By ahti123 in forum Symbian
    Replies: 15
    Last Post: 2013-10-26, 21:28
  2. Losing dimension of QStackedWidget?
    By novemberox in forum Qt
    Replies: 9
    Last Post: 2010-07-19, 12:26
  3. The right way to handle upgrades without overlap in distribution and downtimes?
    By sean_kats in forum [Closed] Publishing to Nokia Store
    Replies: 5
    Last Post: 2009-11-10, 22:27
  4. Sound Overlap
    By zhenLeow in forum Symbian
    Replies: 1
    Last Post: 2003-10-07, 09:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×