Results 1 to 3 of 3

Thread: QTCreator / Designer and scrollarea content widget

  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QTCreator / Designer and scrollarea content widget

    Hello,
    I have problem with QScrollArea in Designer.

    The problem is that when I place QScrollArea on form it comes with QWidget (this is a container/viewport widget for widgets) and the problem with this is that I subclass this QScrollArea (I use "promote to" functionality - I have complex layout and it's easier for me to do it that way) and inside myQScrollArea constructor I setWidget( container ); but the problem with this is that in ui_classname.h I have after constructor setWidget(QWdiget) that erase widgets placed in my subclassed QScrollArea.

    A "code" snippet describing situation

    Qt Code:
    1. myqscrolarea:
    2. QWidget *container = new QWidget();
    3. this->setWidget( container ); <-- my Container with what I want in it
    4.  
    5. ui_classname:
    6. myqscrolarea*scrollArea = new myqscrolarea(page);
    7. QWidget *widget = new QWidget();
    8. scrollArea->setWidget(widget); <- "UI container" that override my Container
    To copy to clipboard, switch view to plain text mode 

    So I want to ask is there a way (and how to) to get ride of that QWidget added to QScrllArea by QDesigner? Because right now I need to //QWidget container on every UI recompile, or rewrite a lot of UI code, that I don't really want do (<- probably best solution).

    Thanx in advance
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTCreator / Designer and scrollarea content widget

    Have you tried promoting also the widget inside QScollArea? If that fails, promote you widget not from QScrollArea but from one of its superclasses, this is bound to work.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    Talei (10th February 2011)

  4. #3
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QTCreator / Designer and scrollarea content widget

    It will works, but I wanted to keep it simple as possible, without any container class but in this case QWidget do the job.
    Regards
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

Similar Threads

  1. Replies: 10
    Last Post: 26th January 2011, 09:17
  2. Delete content widget in layout
    By Hogwarts in forum Qt Programming
    Replies: 1
    Last Post: 17th December 2010, 16:59
  3. Replies: 2
    Last Post: 25th August 2010, 09:25
  4. Replies: 0
    Last Post: 17th August 2010, 14:37
  5. Add widget as a content of QPixmap?
    By talk2amulya in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2009, 06:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.