Results 1 to 4 of 4

Thread: Hot to set the tooltip of button

  1. #1
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Hot to set the tooltip of button

    hi

    I have one application that contains one MainWindow...MainWindow contains some dialog and some button on the dialog.....When i open any dialog from menu of this MainWindow..
    it doesn't show tooltip of Button...

    But when i use
    DialogClass->show(); it shows the tooltip...But it here setModal(false) by default...
    When i use DialogClass->setModal(true);
    DialogClass->show(); Tooltip is not working while open the dialog...but when I click on this dialog ...tooltip is coming....I donot why this is happening...

    I have to use tooltip features on this dialog and setModal(true) both simultaneously....
    But on starting time means when i open the dialog tooltip is not coming...when i use setModal(true);....if m not using setModal(false) tooltip is coming...


    please help me if anybody have idea

  2. #2
    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: Hot to set the tooltip of button

    You know, you could simply use QDialog::exec() to trigger modal dialogs. I'm not 100% sure if this is the case, but you can enable tooltips for inactive windows like this:
    Qt Code:
    1. dialog.setAttribute(Qt::WA_AlwaysShowToolTips);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Hot to set the tooltip of button

    Quote Originally Posted by jpn View Post
    You know, you could simply use QDialog::exec() to trigger modal dialogs. I'm not 100% sure if this is the case, but you can enable tooltips for inactive windows like this:
    Qt Code:
    1. dialog.setAttribute(Qt::WA_AlwaysShowToolTips);
    To copy to clipboard, switch view to plain text mode 
    I m using Qt4.2.2...

    I used this ..but it is not working...tooltip only comes whenver I click on this dialog...
    when i use dialog.show(); tooltip is working......but when i use setModal(true)...
    it appear only when click on the dialog....i used dialog.exec() it is not working also...

    why this is happening help me....

  4. #4
    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: Hot to set the tooltip of button

    Does this work for you?
    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc,char* argv[])
    4. {
    5. QApplication app(argc, argv);
    6. QDialog dialog;
    7.  
    8. QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dialog);
    9. buttonBox->button(QDialogButtonBox::Ok)->setToolTip("Works!");
    10.  
    11. QVBoxLayout* layout = new QVBoxLayout(&dialog);
    12. layout->addWidget(buttonBox);
    13.  
    14. return dialog.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 
    In case it does, could you modify the example so that it no more works?
    J-P Nurmi

Similar Threads

  1. How can I put a button onto the qLabel?
    By dwlnet in forum Qt Programming
    Replies: 3
    Last Post: 24th August 2007, 09:47
  2. Disable Checkable Button Question
    By jbpvr in forum Qt Programming
    Replies: 9
    Last Post: 20th March 2007, 17:57
  3. Mouse Over event on button
    By vishal.chauhan in forum Qt Programming
    Replies: 9
    Last Post: 10th January 2007, 05:03
  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.