[PyKDE] tr()

Tony Cappellini cappy2112 at gmail.com
Thu Jan 18 08:08:27 GMT 2007


I'm using pyqt/QT4 for the first time.

In this menuing example below, there is a call to a function called tr(),
but I don't understand what it does or why it's needed.
Additionally, I must be looking in the wrong part of the help file for QT. I
don't see any documentation for tr()
What is this fnction for, when is it needed?
thanks

MainWindow::MainWindow()
{
QWidget *w = new QWidget;
setCentralWidget(w);

QWidget *topFiller = new QWidget;
topFiller->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

infoLabel = new QLabel(tr("<i>Choose a menu option, or right-click to "
"invoke a context menu</i>"));
infoLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
infoLabel->setAlignment(Qt::AlignCenter);

QWidget *bottomFiller = new QWidget;
bottomFiller->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

QVBoxLayout *vbox = new QVBoxLayout;
vbox->setMargin(5);
vbox->addWidget(topFiller);
vbox->addWidget(infoLabel);
vbox->addWidget(bottomFiller);
w->setLayout(vbox);

createActions();
createMenus();

statusBar()->showMessage(tr("A context menu is available by
right-clicking"));

setWindowTitle(tr("Menus"));
setMinimumSize(160, 160);
resize(480, 320);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070118/60374574/attachment.html


More information about the PyQt mailing list