1 // Example for use of GNU gettext.
2 // Copyright (C) 2003 Free Software Foundation, Inc.
3 // This file is published under the GNU General Public License.
10 #include "hellowindow.h"
14 /* Declare KMainWindow. */
15 #include <kmainwindow.h>
18 /* Declare QPushButton. */
19 #include <qpushbutton.h>
20 /* Declare QString. */
27 /* Get getpid() declaration. */
32 // The main window widget.
34 HelloMainWindow::HelloMainWindow (QWidget
* parent
, const char * name
)
35 : KMainWindow (parent
, name
)
37 setCaption ("Hello example");
39 QVBox
*panel
= new QVBox (this);
40 panel
->setSpacing (2);
42 QLabel
*label1
= new QLabel (i18n ("Hello, world!"), panel
);
45 // NOT using QString::sprintf because it doesn't support reordering of
47 //label2text.sprintf (i18n ("This program is running as process number %d"),
49 label2text
= i18n ("This program is running as process number %1.").arg(getpid ());
50 QLabel
*label2
= new QLabel (label2text
, panel
);
52 QHBox
*buttonbar
= new QHBox (panel
);
53 QWidget
*filler
= new QWidget (buttonbar
); // makes the button right-aligned
54 button
= new QPushButton ("OK", buttonbar
);
55 button
->setMaximumWidth (button
->sizeHint().width() + 20);
57 panel
->resize (panel
->sizeHint ());
58 resize (panel
->frameSize ());
61 HelloMainWindow::~HelloMainWindow ()