Results 1 to 5 of 5

Thread: widget swap/widget on top

  1. #1
    Join Date
    Jan 2011
    Posts
    23
    Qt products
    Platforms
    Windows

    Exclamation widget swap/widget on top

    Hi guys,

    if i press a button on mainwindow i want another widget i.e. widget1 to popup, but that widget1 should be on top and the mainwindow should be disabled.. same should happen if i try to open a new widget i.e. widget2 by pressing a button on widget1 (widget 2 should be on top and other 2 widgets should be disabled)

    in this process i dont want to hide the disabled widgets/windows..

    Can someone plz guide me to achieve the same..

    Thanx in advance

    Regards,
    ad3d

  2. #2
    Join Date
    Jul 2011
    Location
    Brasil
    Posts
    39
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: widget swap/widget on top

    Hello,

    Try using a QDialog instead of a QWidget, then use QDialog::exec();

    HTH.

  3. #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: widget swap/widget on top

    exec() in QDialog serves a purpose of showing dialog as modal widget.
    To achieve the same effect but using QWidget set modality parameter. Something along this line should help You:

    Qt Code:
    1. QWidget *w = new QWidget( this, Qt::Window );
    2. w->setWindowModality( Qt::ApplicationModal );
    3. w->show();
    To copy to clipboard, switch view to plain text mode 
    This will create modal widget, all mouse.keyboard input are redirected to this widget.
    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.

  4. #4
    Join Date
    Jan 2011
    Posts
    23
    Qt products
    Platforms
    Windows

    Default Re: widget swap/widget on top

    But while using modality one must HIDE and SHOW the widgets...

    I need to Disable the Widget Background and keep the Top level widget enabled..

  5. #5
    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: widget swap/widget on top

    You don't hide anything, just create new widget, with is by default hidden/invisible/unpainted into screen, and then show it.

    I need to Disable the Widget Background and keep the Top level widget enabled..
    Please help Us help You. Describe Your problem best You can, and If that's necessary add pix into post for better understanding. Currently I don't know where is your problem, and I think the solution that was posted is what You're looking for.
    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: 8
    Last Post: 28th June 2011, 14:57
  2. Replies: 1
    Last Post: 23rd June 2011, 23:09
  3. Replies: 1
    Last Post: 11th March 2011, 19:34
  4. Replies: 7
    Last Post: 14th January 2010, 08:47
  5. Replies: 1
    Last Post: 5th November 2006, 23:50

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.