<p>It is strongly recommended that the two argument form of <tt>tr()</tt> is used for Ctrl key accelerators. The second argument is the only clue the translator has as to the function performed by the accelerator.</p>
<!-- index TQ_OBJECT --><!-- index tr() --><!-- index TQObject!tr() --><!-- index Translation Contexts --><!-- index Contexts!for Translation --><p>When <ahref="linguist-manual-2.html#2">lupdate</a> is run it not only extracts the source texts but it also groups them into contexts. A context is the name of the class in which the source text appears. Thus, in this example, "ArrowPad" is a context: it is the context of the texts in the <tt>ArrowPad</tt> class. The <tt>TQ_OBJECT</tt> macro defines <tt>tr(x)</tt> in <tt>ArrowPad</tt> like this</p>
<!-- index TQApplication!translate() --><!-- index translate()!TQApplication --><pre>
qApp->translate( "ArrowPad", x )
tqApp->translate( "ArrowPad", x )
</pre>
<p>Knowing which class each source text appears in enables <em>TQt Linguist</em> to group texts that are logically related together, e.g. all the text in a dialog will have the context of the dialog's class name and will be shown together. This provides useful information for the translator since the context in which text appears may influence how it should be translated. For some translations keyboard accelerators may need to be changed and having all the source texts in a particular context (class) grouped together makes it easier for the translator to perform any accelerator changes without introducing conflicts.</p>
<p>In <tt>arrowpad.cpp</tt> we implement the <tt>ArrowPad</tt> class.</p>
@ -336,7 +336,7 @@ TRANSLATIONS = tt2_fr.ts \
<pre> ArrowPad *ap = new ArrowPad( this, "arrow pad" );
</pre>
<p>We also call <tt>MainWindow::tr()</tt> twice, once for the menu item and once for the accelerator.</p>
<!-- index Ctrl Key --><!-- index Alt Key --><pre> file-><ahref="ntqmenudata.html#insertItem">insertItem</a>( <ahref="ntqobject.html#tr">tr</a>("E&xit"), qApp, SLOT(<ahref="ntqapplication.html#quit">quit</a>()),
<!-- index Ctrl Key --><!-- index Alt Key --><pre> file-><ahref="ntqmenudata.html#insertItem">insertItem</a>( <ahref="ntqobject.html#tr">tr</a>("E&xit"), tqApp, SLOT(<ahref="ntqapplication.html#quit">quit</a>()),
<p>Note the use of <tt>tr()</tt> to support different keys in other languages. "Ctrl+Q" is a good choice for Quit in English, but a Dutch translator might want to use "Ctrl+A" (for Afsluiten) and a German translator "Strg+E" (for Beenden). When using <tt>tr()</tt> for Ctrl key accelerators, the two argument form should be used with the second argument describing the function that the accelerator performs.</p>
<ahref="ntqmainwindow.html#statusBar">statusBar</a>()->message( <ahref="ntqobject.html#tr">tr</a>("This is a TQMainWindow with an XmText widget.") );
<p><p>See also <ahref="#exit">exit</a>(), <ahref="#aboutToQuit">aboutToQuit</a>(), <ahref="#lastWindowClosed">lastWindowClosed</a>(), and <ahref="ntqaction.html">TQAction</a>.
tr("Could not open file for reading: %1").arg( qApp-><ahref="ntqapplication.html#translate">translate</a>("TQFile",f.<ahref="#errorString">errorString</a>()) )
tr("Could not open file for reading: %1").arg( tqApp-><ahref="ntqapplication.html#translate">translate</a>("TQFile",f.<ahref="#errorString">errorString</a>()) )
@ -1047,10 +1047,10 @@ For certain types of events (e.g. mouse and key events), the event will be propa
.PP
There are five different ways that events can be processed; reimplementing this virtual function is just one of them. All five approaches are listed below: <ol type=1>
.TP
Reimplementing this function. This is very powerful, providing complete control; but only one subclass can be qApp.
Reimplementing this function. This is very powerful, providing complete control; but only one subclass can be tqApp.
.IP
.TP
Installing an event filter on qApp. Such an event filter is able to process all events for all widgets, so it's just as powerful as reimplementing notify(); furthermore, it's possible to have more than one application-global event filter. Global event filters even see mouse events for disabled widgets, and if global mouse tracking is enabled, as well as mouse move events for all widgets.
Installing an event filter on tqApp. Such an event filter is able to process all events for all widgets, so it's just as powerful as reimplementing notify(); furthermore, it's possible to have more than one application-global event filter. Global event filters even see mouse events for disabled widgets, and if global mouse tracking is enabled, as well as mouse move events for all widgets.
.IP
.TP
Reimplementing QObject::event() (as QWidget does). If you do this you get Tab key presses, and you get to see the events before any widget-specific event filters.
@ -1131,7 +1131,7 @@ Example:
.br
QPushButton *quitButton = new QPushButton( "Quit" );
@ -311,7 +311,7 @@ An image has the parameters width, height and depth (bits per pixel, bpp), a col
.PP
32-bpp images encode an RGB value in 24 bits and ignore the color table. The most significant byte is used for the alpha buffer.
.PP
An entry in the color table is an RGB triplet encoded as a \fCuint\fR. Use the qRed(), qGreen() and qBlue() functions (ntqcolor.h) to access the components, and qRgb to make an RGB triplet (see the QColor class documentation).
An entry in the color table is an RGB triplet encoded as a \fCuint\fR. Use the tqRed(), tqGreen() and tqBlue() functions (ntqcolor.h) to access the components, and tqRgb to make an RGB triplet (see the QColor class documentation).
.PP
1-bpp (monochrome) images have a color table with a most two colors. There are two different formats: big endian (MSB first) or little endian (LSB first) bit order. To access a single bit you will must do some bit shifts:
.PP
@ -341,7 +341,7 @@ If this looks complicated, it might be a good idea to convert the 1-bpp image to
.br
// set entry 19 in the color table to yellow
.br
image.setColor( 19, qRgb(255,255,0) );
image.setColor( 19, tqRgb(255,255,0) );
.br
// set 8 bit pixel at (x,y) to value yellow (in color table)
.br
@ -359,7 +359,7 @@ If this looks complicated, it might be a good idea to convert the 1-bpp image to
.br
uint *p = (uint *)image.scanLine(y) + x;
.br
*p = qRgb(255,255,0);
*p = tqRgb(255,255,0);
.br
.fi
.PP
@ -503,7 +503,7 @@ See also numBytes() and scanLine().
.SH "QRgb QImage::color ( int i ) const"
Returns the color in the color table at index \fIi\fR. The first color is at index 0.
.PP
A color value is an RGB triplet. Use the qRed(), qGreen() and qBlue() functions (defined in ntqcolor.h) to get the color value components.
A color value is an RGB triplet. Use the tqRed(), tqGreen() and tqBlue() functions (defined in ntqcolor.h) to get the color value components.
.PP
See also setColor(), numColors(), and QColor.
.PP
@ -798,7 +798,7 @@ Returns the color of the pixel at the coordinates (\fIx\fR, \fIy\fR).
.PP
If (\fIx\fR, \fIy\fR) is not on the image, the results are undefined.
.PP
See also setPixel(), qRed(), qGreen(), qBlue(), and valid().
See also setPixel(), tqRed(), tqGreen(), tqBlue(), and valid().
.PP
Examples:
.)l canvas/canvas.cpp and qmag/qmag.cpp.
@ -875,7 +875,7 @@ Returns a pointer to the pixel data at the scanline with index \fIi\fR. The firs
.PP
The scanline data is aligned on a 32-bit boundary.
.PP
\fBWarning:\fR If you are accessing 32-bpp image data, cast the returned pointer to \fCQRgb*\fR (QRgb has a 32-bit size) and use it to read/write the pixel value. You cannot use the \fCuchar*\fR pointer directly, because the pixel format depends on the byte order on the underlying platform. Hint: use qRed(), qGreen() and qBlue(), etc. (ntqcolor.h) to access the pixels.
\fBWarning:\fR If you are accessing 32-bpp image data, cast the returned pointer to \fCQRgb*\fR (QRgb has a 32-bit size) and use it to read/write the pixel value. You cannot use the \fCuchar*\fR pointer directly, because the pixel format depends on the byte order on the underlying platform. Hint: use tqRed(), tqGreen() and tqBlue(), etc. (ntqcolor.h) to access the pixels.
.PP
\fBWarning:\fR If you are accessing 16-bpp image data, you must handle endianness yourself. (Qt/Embedded only)
.PP
@ -897,7 +897,7 @@ See also hasAlphaBuffer() and createAlphaMask().
.SH "void QImage::setColor ( int i, QRgb c )"
Sets a color in the color table at index \fIi\fR to \fIc\fR.
.PP
A color value is an RGB triplet. Use the qRgb() function (defined in ntqcolor.h) to make RGB triplets.
A color value is an RGB triplet. Use the tqRgb() function (defined in ntqcolor.h) to make RGB triplets.
.PP
See also color(), setNumColors(), and numColors().
.PP
@ -922,7 +922,7 @@ If (\fIx\fR, \fIy\fR) is not valid, the result is undefined.
.PP
If the image is a paletted image (depth() <= 8) and \fIindex_or_rgb\fR >= numColors(), the result is undefined.
.PP
See also pixelIndex(), pixel(), qRgb(), qRgba(), and valid().
See also pixelIndex(), pixel(), tqRgb(), tqRgba(), and valid().
Records string \fIs\fR for the keyword \fIkey\fR. The \fIkey\fR should be a portable keyword recognizable by other software - some suggested values can be found in the PNG specification. \fIs\fR can be any text. \fIlang\fR should specify the language code (see RFC 1766) or 0.