find . -name \*.cpp|xargs grep "Edit"
This returns 1564 hits. Ouch. So try adding another grep for "Segment" to this:
find . -name \*.cpp|xargs grep "Edit"|grep Segment
118 hits. So add "Parameter" to the list:
find . -name \*.cpp|xargs grep "Edit"|grep Segment|grep Parameter
That gets down to 9 hits, and the answer is right in here:
./src/gui/editors/parameters/SegmentParameterBox.cpp:#include "gui/widgets/LineEdit.h"
./src/gui/editors/parameters/SegmentParameterBox.cpp://#include
./src/gui/editors/parameters/SegmentParameterBox.cpp: m_labelButton = new QPushButton(tr("Edit"), this);
./src/gui/editors/parameters/SegmentParameterBox.cpp: m_labelButton->setToolTip(tr("Edit the segment label for any selected segments "));
./src/gui/editors/parameters/SegmentParameterBox.cpp: SLOT(slotEditSegmentLabel()));
./src/gui/editors/parameters/SegmentParameterBox.cpp: m_colourValue->setEditable(false);
./src/gui/editors/parameters/SegmentParameterBox.cpp: LineEdit::Normal,
./src/gui/editors/parameters/SegmentParameterBox.cpp:SegmentParameterBox::slotEditSegmentLabel()
./src/gui/editors/parameters/SegmentParameterBox.cpp: LineEdit::Normal,
It turns our our widget is ''m_labelButton'' in ''src/gui/editors/parameters/SegmentParameterBox.cpp''
That pasted code snippet above is actually on the code I just changed, but if you had been doing this from scratch, you would have found this in the right area to begin working:
// .. and edit button
m_labelButton = new QPushButton(tr("Edit"), this);
m_labelButton->setFont(font);
// m_labelButton->setFixedWidth(50);
===== Add the Tooltip =====
Now that you've found your widget, you can edit that source file and create your tooltip. Find an appropriate line somewhere around where the widget is initialized (syntax like ''m_someWidget = new QComboBox(....);'' or ''QComboBox *someWidget = new QComboBox(....);'' is most common) and add a new line under that to set up the tooltip.
You will probably always use the ''->'' operator, but there may be rare cases where you will use the ''.'' operator. Look at the surrounding code for a hint here. You will see syntax like ''m_someWidget->somethingExciting(....);'' in this area most of the time (or rarely, ''someWidget.somethingExciting(....);'')
Now you want to add your tooltip with setToolTip() and tr(), something like thus:
// .. and edit button
m_labelButton = new QPushButton(tr("Edit"), this);
m_labelButton->setFont(font);
m_labelButton->setToolTip(tr("Edit the segment label for any selected segments"));
// m_labelButton->setFixedWidth(50);
===== Fancier Tooltips =====
The above will cover most cases, but what if there is a widget that has a particularly interesting story to tell? Let's use the current state of the SPB repeat checkbox as an example.
First, we're going to need to wrap the whole thing in HTML-style tags to get its formatting to work out nicely. You can use either '' tags.
Writing some huge amount of text on one line is obnoxious and confusing for developers, so you will want to break up the lines. All the text on every line will have to be surrounded by quotes, and you should keep the quotes on the right hand side at the same place. We don't really have a fixed right margin in our code, so just try to pick something sensible. Extra spaces at the end won't show up in your text, and if you have to cut words in half, that won't matter either.
Here's the above tooltip, in code:
When checked, any selected segments will repeat until they run into another segment, "
"or the end of the composition. When viewed in the notation editor or printed via LilyPond, "
"the segments will be bracketed by repeat signs.
m_repeatValue->setToolTip(tr("
pixmaps/tooltip/repeats.png
pixmaps/tooltip/your-image-name.png
===== Test and Commit =====
After you've added a tooltip, build the source and navigate to your new widget to test it. In order to get your new image built into the resource bundle, you'll have to delete ''data/data.o'' before compiling. Something like:
rm data/data.o&&make -f qt4-makefile&&./rosegarden
If you get compile errors, the most common things are using a -> when you should have used a ., and " related problems. Also ( problems. ''setToolTip'' should have a pair of () around it, and ''tr()'' should too, so the whole structure with no text looks like ''setToolTip(tr(....));'' A developer (eg. me) will be happy to help you with any problems until you get the hang of this.
If you use an image, be sure the image is working.
Now commit your work with ''svn commit'' then write some explanatory comment to send along with it, and fire away.
Anyone not having SVN commit access and working on this project will get SVN commit access in short order. Don't worry, anything you break can be un-broken, and it's not as scary as it sounds.
Now, any takers?