Results 1 to 5 of 5

Thread: adding minimize pushbutton to Hboxlayout

  1. #1
    Join Date
    Oct 2009
    Posts
    105
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11
    Thanked 4 Times in 2 Posts

    Default adding minimize pushbutton to Hboxlayout

    Hi All,
    I've a hboxlayout. i need to add a pushbutton in the right side border centre of layout. so that if i press that button i can minimize the treewidget. How to added the button. Herewith i've attached the diagram.

    Thank you all.
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 47 Times in 43 Posts

    Default Re: adding minimize pushbutton to Hboxlayout

    Just add a pushbutton and dont add pushbutton in layout.
    set the parent property and geometry.
    ex
    Qt Code:
    1. QPushButton *btnOk=new QPushButton(this);
    2. btnOk->setGeometry(0,0,100,50);
    To copy to clipboard, switch view to plain text mode 
    0,0 is the x,y pos
    100,50 is the width and height

    syntax : btn->setGeometry(x,y,w,h);

    hope it helps

    Bala

  3. #3
    Join Date
    Oct 2009
    Posts
    105
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11
    Thanked 4 Times in 2 Posts

    Default Re: adding minimize pushbutton to Hboxlayout

    Quote Originally Posted by BalaQT View Post
    Just add a pushbutton and dont add pushbutton in layout.
    set the parent property and geometry.
    ex
    Qt Code:
    1. QPushButton *btnOk=new QPushButton(this);
    2. btnOk->setGeometry(0,0,100,50);
    To copy to clipboard, switch view to plain text mode 
    0,0 is the x,y pos
    100,50 is the width and height

    syntax : btn->setGeometry(x,y,w,h);

    hope it helps

    Bala
    No it didn't help. ANy other way to do it??

  4. #4
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 47 Times in 43 Posts

    Thumbs up Re: adding minimize pushbutton to Hboxlayout

    if u dont mind, can u pls tell why its not working ?

    i hav done a small example for ur need.
    i attached it here.
    pls refer the attachment,

    pls workaround with ur window positions.

    hope it helps
    Bala
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by BalaQT; 26th February 2010 at 09:22.

  5. #5
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 47 Times in 43 Posts

    Default Re: adding minimize pushbutton to Hboxlayout

    Other ways

    way 1)
    To do it by adding spacer.

    way 2)
    using layouts also we can achieve the same
    let the tabwidget is in a Vertical layout.
    then add a child Horizontal layout.
    add the tabwidget
    then add the pushbutton
    then add the Horizontal layout into Vertical layout.

    i hav attached the example using layout
    pls check

    Bala
    Attached Files Attached Files

Similar Threads

  1. Minimize to system tray
    By aLiNuSh in forum Newbie
    Replies: 17
    Last Post: 4th March 2010, 13:51
  2. Minimize splitter child
    By mstegehu in forum Qt Programming
    Replies: 0
    Last Post: 26th June 2009, 16:24
  3. Hide on Minimize
    By defunct in forum Qt Programming
    Replies: 9
    Last Post: 26th March 2009, 10:46
  4. Minimize other Window
    By johncharlesb in forum Qt Programming
    Replies: 1
    Last Post: 14th October 2007, 17:22
  5. Why will my QMainWindow not minimize properly?
    By ZB in forum Qt Programming
    Replies: 2
    Last Post: 20th September 2006, 19:38

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
  •  
Qt is a trademark of The Qt Company.