9 QLabel *label =
new QLabel;
11 label->setAlignment(Qt::AlignLeft | Qt::AlignTop);
12 label->setAlignment({ });
18 static QStyle *s =
nullptr;
25 #if QT_VERSION >= QT_VERSION_CHECK(4
, 1
, 0
)
26 QIcon icon = style()->standardIcon(QStyle::SP_TrashIcon);
28 QPixmap pixmap = style()->standardPixmap(QStyle::SP_TrashIcon);
35#include <QApplication>
41void logToFile(QtMsgType type,
const QMessageLogContext &context,
const QString &msg)
43 QString message = qFormatLogMessage(type, context, msg);
44 static FILE *f = fopen(
"log.txt",
"a");
45 fprintf(f,
"%s\n", qPrintable(message));
52int main(
int argc,
char **argv)
55 QApplication app(argc, argv);
75 QT_TRANSLATE_NOOP(
"FriendlyConversation",
"Hello"),
76 QT_TRANSLATE_NOOP(
"FriendlyConversation",
"Goodbye")
81 return tr(greeting_strings[type]);
86 return qApp->translate(
"FriendlyConversation",
87 greeting_strings[type]);
108 static struct {
const char *
source;
const char *
comment; } greeting_strings[] =
110 QT_TRANSLATE_NOOP3(
"FriendlyConversation",
"Hello",
111 "A really friendly hello"),
112 QT_TRANSLATE_NOOP3(
"FriendlyConversation",
"Goodbye",
113 "A really friendly goodbye")
118 return tr(greeting_strings[type].source,
119 greeting_strings[type].comment);
124 return qApp->translate(
"FriendlyConversation",
125 greeting_strings[type].source,
126 greeting_strings[type].comment);
139 QString tr(
const char *text,
const char *comment,
int n)
145 static struct {
const char *
const source;
const char *
const comment; } status_strings[] = {
146 QT_TRANSLATE_N_NOOP3(
"Message Status",
"Hello, you have %n message(s)",
147 "A login message status"),
148 QT_TRANSLATE_N_NOOP3(
"Message status",
"You have %n new message(s)",
149 "A new message query status")
154 return tr(status_strings[type].source,
155 status_strings[type].comment, count);
160 return qApp->translate(
"Message Status",
161 status_strings[type].source,
162 status_strings[type].comment,
178static const char *
const ids[] = {
180 QT_TRID_NOOP(
"qtn_1st_text"),
182 QT_TRID_NOOP(
"qtn_2nd_text"),
188 for (
int i = 0; ids[i]; ++i)
189 new QLabel(qtTrId(ids[i]),
this);
196 QWidget w = QWidget();
203#if QT_VERSION >= QT_VERSION_CHECK(5
, 0
, 0
)
QString greeting(int type)
TheClass(QWidget *parent=nullptr)
QString greeting(int type)
QString greeting(int type, int count)
QString global_greeting(int type)
QString tr(const char *text, const char *comment)
const char *const comment
QString tr(const char *text, const char *comment, int n)
QString global_greeting(int type, int count)
int main(int argc, char *argv[])
[ctor_close]