Results 1 to 4 of 4

Thread: How can I put a button onto the qLabel?

  1. #1
    Join Date
    Aug 2007
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Unhappy How can I put a button onto the qLabel?

    Hello everyone,
    thank you to view my Thread first!

    I'm a new learning qt4.I have an issue mentioned in the title.
    I want to put a qPushButton onto the qLabel,but at fist the button can't display because the button is at the label's position. I try many times and surprisingly the button display on the label which I don't make any modification!But there is still a problem:this button can't received the clicked signal.How can I slove the problem?
    Is there any functions in QT4 to change the control's order or slove my problem ?

    Can you help me? Thank you!

  2. #2
    Join Date
    Aug 2007
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How can I put a button onto the qLabel?

    Once I uesd the Qt::WindowStaysOnTopHint flag,
    raise()
    grabMouse ()
    activateWindow () and so on.
    but there is no effect.

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I put a button onto the qLabel?

    Create the button as child of the label:
    Qt Code:
    1. QPushButton* button = new QPushButton("Title", label);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  4. The following user says thank you to jpn for this useful post:

    dwlnet (5th September 2007)

  5. #4
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I put a button onto the qLabel?

    I think you can use style sheets also for this. The following link expalin how to put a button inside linedit. I think you can do the same for label

    http://labs.trolltech.com/blogs/2007...-clear-button/
    We can't solve problems by using the same kind of thinking we used when we created them

  6. The following user says thank you to sunil.thaha for this useful post:

    dwlnet (5th September 2007)

Similar Threads

  1. Disable Checkable Button Question
    By jbpvr in forum Qt Programming
    Replies: 9
    Last Post: 20th March 2007, 17:57
  2. Mouse Over event on button
    By vishal.chauhan in forum Qt Programming
    Replies: 9
    Last Post: 10th January 2007, 05:03
  3. QScrollArea display custom QLabel
    By spawnwj in forum Qt Programming
    Replies: 6
    Last Post: 6th December 2006, 03:38
  4. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16:40
  5. QLabel on a Button
    By cwalsh in forum Newbie
    Replies: 4
    Last Post: 12th January 2006, 16:06

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.