Results 1 to 12 of 12

Thread: toolTips?

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default toolTips?

    Hi,
    I see when mouse is on an icon action appear a toolTip (square yellow) and the same text of toolTips appear in the bottom of windows application. Is it possible write a Qstring in the bottom of window? Thanks
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    N.B. Canada
    Posts
    47
    Thanked 8 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: toolTips?

    I am not exactly sure what you mean. QActions have toolTips and statusTips. By default, if an action has a tooltip, and if no status tip is defined, the action uses the tool tip text to be displayed in the status bar. You can set a different statusTip text using setStatusTip if you want the text displayed in the statusbar to be different than the action's tooltip text.

    If you just want to display some text in the statusbar, well, there are various ways of accomplishing this; but the simlpest is to use one of the QStatusBar::message(...) methods.

    Bojan
    The march of progress:
    C:
    printf("%10.2f", x);
    C++:
    cout << setw(10) << setprecision(2) << showpoint << x;
    Java:
    java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
    formatter.setMinimumFractionDigits(2);
    formatter.setMaximumFractionDigits(2);
    String s = formatter.format(x);
    for (int i = s.length(); i < 10; i++) System.out.print(' ');
    System.out.print(s);

  3. #3
    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: toolTips?

    Just remember that the status bar is available by default only in QMainWindow.

  4. #4
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: toolTips?

    ok. But this change temporary status bar (text on the left). I'd like to take fix a text in the center of status bar when statusbar change text for move mouse on QActions.
    is it Possible? I'm looking for a carefully place for a Qstring of max 11 char without using textLabel....
    Regards

  5. #5
    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: toolTips?

    This should help you:
    void QStatusBar::message ( const QString & message ) [slot]
    Hides the normal status indicators and displays message until clear() or another message() is called.
    See also clear().
    Example: regexptester/regexptester.cpp.

  6. #6
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: toolTips?

    I don't like hide normal status. I'd like have a normal status text and a blocked text in the center of status bar (not on the left)....
    Regards

  7. #7
    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: toolTips?

    Then insert a label into the status bar and display there.

  8. #8
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: toolTips?

    I prove to insert a label in status bar from designer but it seems impossible..
    Regards

  9. #9
    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: toolTips?

    Not everything can be done from Designer. You have to do that in init() or in subclass constructor.

  10. #10
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: toolTips?

    Hi, I insert this in ini costructor:
    Qt Code:
    1. statusBar()->addWidget (statusLabel,110,FALSE);
    To copy to clipboard, switch view to plain text mode 
    It works but the problem is wheen mouse is over action my label is replaced with tooltips....When I move out action my label appears...
    Regards

  11. #11
    Join Date
    Jan 2006
    Location
    N.B. Canada
    Posts
    47
    Thanked 8 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: toolTips?

    Lets see...

    void QStatusBar::addWidget ( QWidget * widget, int stretch = 0, bool permanent = FALSE ) [virtual]
    Adds widget to this status bar. widget is reparented if it isn't already a child of the QStatusBar.
    widget is permanently visible if permanent is TRUE and may be obscured by temporary messages if permanent is FALSE. The default is FALSE.

    If permanent is TRUE, widget is located at the far right of the status bar. If permanent is FALSE (the default), widget is located just to the left of the first permanent widget.

    stretch is used to compute a suitable size for widget as the status bar grows and shrinks. The default of 0 uses a minimum of space.

    This function may cause some flicker.


    See also removeWidget().
    The march of progress:
    C:
    printf("%10.2f", x);
    C++:
    cout << setw(10) << setprecision(2) << showpoint << x;
    Java:
    java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
    formatter.setMinimumFractionDigits(2);
    formatter.setMaximumFractionDigits(2);
    String s = formatter.format(x);
    for (int i = s.length(); i < 10; i++) System.out.print(' ');
    System.out.print(s);

  12. #12
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: toolTips?

    It's works. But every change below dosn't take place (setweight,bold...).Why?
    Qt Code:
    1. statusLabel = new QLabel (this);
    2. QFont f2( "Arial");
    3. f2.setBold(TRUE);
    4. f2.setWeight(16);
    5. statusLabel->setFont(f2);
    To copy to clipboard, switch view to plain text mode 
    Regards

Similar Threads

  1. Problems customizing tooltips in QListView
    By kalos80 in forum Qt Programming
    Replies: 6
    Last Post: 14th November 2007, 22:46
  2. Turning off ToolTips
    By steg90 in forum Qt Programming
    Replies: 11
    Last Post: 16th May 2007, 17:00
  3. Tooltips for QListViewItems (QT3)?
    By gadnio in forum Newbie
    Replies: 3
    Last Post: 13th March 2006, 17:02
  4. Tooltips on QActions
    By drhex in forum Newbie
    Replies: 1
    Last Post: 8th February 2006, 18:05
  5. Tooltips & Qt4 tree views
    By yogeshm02 in forum Newbie
    Replies: 7
    Last Post: 17th January 2006, 15:12

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.