Qt 4.8
qtcore_eval.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include <qcoreevent.h>
43 #include <qdatetime.h>
44 #include <qlibraryinfo.h>
45 #include <qobject.h>
46 #include <qcoreapplication.h>
47 
48 #include "stdio.h"
49 #include "stdlib.h"
50 
52 
53 #include "qconfig_eval.cpp"
54 
55 static const char boilerplate_unsuported[] =
56  "\nQt %1 Evaluation License\n"
57  "Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).\n"
58  "All rights reserved.\n\n"
59  "This trial version may only be used for evaluation purposes\n"
60  "and will shut down after 120 minutes.\n"
61  "Registered to:\n"
62  " Licensee: %2\n\n"
63  "The evaluation expires in %4 days\n\n"
64  "Contact http://qt.nokia.com/about/contact-us for pricing and purchasing information.\n";
65 
66 static const char boilerplate_supported[] =
67  "\nQt %1 Evaluation License\n"
68  "Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).\n"
69  "All rights reserved.\n\n"
70  "This trial version may only be used for evaluation purposes\n"
71  "Registered to:\n"
72  " Licensee: %2\n\n"
73  "The evaluation expires in %4 days\n\n"
74  "Contact http://qt.nokia.com/about/contact-us for pricing and purchasing information.\n";
75 
76 static const char boilerplate_expired[] =
77  "This software is using the trial version of the Qt GUI toolkit.\n"
78  "The trial period has expired. If you need more time to\n"
79  "evaluate Qt, or if you have any questions about Qt, contact us\n"
80  "at: http://qt.nokia.com/about/contact-us.\n\n";
81 
82 static const char will_shutdown_1min[] =
83  "\nThe evaluation of Qt will SHUT DOWN in 1 minute.\n"
84  "Contact http://qt.nokia.com/about/contact-us for pricing and purchasing information.\n";
85 
86 static const char will_shutdown_now[] =
87  "\nThe evaluation of Qt has now reached its automatic\n"
88  "timeout and will shut down.\n"
89  "Contact http://qt.nokia.com/about/contact-us for pricing and purchasing information.\n";
90 
92 {
93  const volatile char *const license_key = qt_eval_key_data + 12;
94 
95  // fast fail
96  if (!qt_eval_key_data[0] || !*license_key)
97  return -1;
98 
99  // is this an unsupported evaluation?
100  const volatile char *typecode = license_key;
101  int field = 2;
102  for ( ; field && *typecode; ++typecode)
103  if (*typecode == '-')
104  --field;
105 
106  if (!field && typecode[1] == '4' && typecode[2] == 'M') {
107  if (typecode[0] == 'Q')
108  return 0;
109  else if (typecode[0] == 'R' || typecode[0] == 'Z')
110  return 1;
111  }
112  return -1;
113 }
114 
115 static int qt_eval_days_left()
116 {
117  if (qt_eval_is_supported() < 0)
118  return -2;
119 
120  QDate today = QDate::currentDate();
121  QDate build = QLibraryInfo::buildDate();
122  return qMax(-1, today.daysTo(build) + 30);
123 }
124 
126 {
127  const char *msg;
128  switch (qt_eval_is_supported()) {
129  case 0:
131  break;
132  case 1:
133  msg = boilerplate_supported;
134  break;
135  default:
136  return QString();
137  msg = 0;
138  }
139 
140  return QString::fromLatin1(msg)
144 }
145 
146 #define WARN_TIMEOUT 60 * 1000 * 119
147 #define KILL_DELAY 60 * 1000 * 1
148 
149 class QCoreFuriCuri : public QObject
150 {
151 public:
152 
153  int warn;
154  int kill;
155 
156  QCoreFuriCuri() : QObject(), warn(-1), kill(-1)
157  {
158  if (!qt_eval_is_supported()) {
159  warn = startTimer(WARN_TIMEOUT);
160  kill = 0;
161  }
162  }
163 
165  if (e->timerId() == warn) {
166  killTimer(warn);
167  fprintf(stderr, "%s\n", will_shutdown_1min);
168  kill = startTimer(KILL_DELAY);
169  } else if (e->timerId() == kill) {
170  fprintf(stderr, "%s\n", will_shutdown_now);
172  }
173  }
174 };
175 
176 #if defined(QT_BUILD_CORE_LIB) || defined (QT_BOOTSTRAPPED)
177 
178 void qt_core_eval_init(uint type)
179 {
180  if (!type)
181  return; // GUI app
182 
183  switch (qt_eval_days_left()) {
184  case -2:
185  return;
186 
187  case -1:
188  fprintf(stderr, "%s\n", boilerplate_expired);
189  if (type == 0) {
190  // if we're a console app only.
191  exit(0);
192  }
193 
194  default:
195  fprintf(stderr, "%s\n", qPrintable(qt_eval_string()));
196  if (type == 0) {
197  Q_UNUSED(new QCoreFuriCuri());
198  }
199  }
200 }
201 #endif
202 
203 #ifdef QT_BUILD_GUI_LIB
204 
206 #include <qdialog.h>
207 #include <qlabel.h>
208 #include <qlayout.h>
209 #include <qmessagebox.h>
210 #include <qpushbutton.h>
211 #include <qtimer.h>
212 #include <qapplication.h>
214 
215 
216 static const char * const qtlogo_eval_xpm[] = {
217 /* columns rows colors chars-per-pixel */
218 "46 55 174 2",
219 " c #002E02",
220 ". c #00370D",
221 "X c #003A0E",
222 "o c #003710",
223 "O c #013C13",
224 "+ c #043E1A",
225 "@ c #084F0A",
226 "# c #0B520C",
227 "$ c #054413",
228 "% c #0C4C17",
229 "& c #07421D",
230 "* c #09451D",
231 "= c #0D491E",
232 "- c #125515",
233 "; c #13541A",
234 ": c #17591B",
235 "> c #1B5C1D",
236 ", c #1F611F",
237 "< c #20621E",
238 "1 c #337B1E",
239 "2 c #0B4521",
240 "3 c #0F4923",
241 "4 c #114B24",
242 "5 c #154D2A",
243 "6 c #175323",
244 "7 c #1C5924",
245 "8 c #1C532F",
246 "9 c #1E5432",
247 "0 c #245936",
248 "q c #265938",
249 "w c #295C3B",
250 "e c #246324",
251 "r c #266823",
252 "t c #2A6C24",
253 "y c #276628",
254 "u c #2D7026",
255 "i c #327427",
256 "p c #367927",
257 "a c #37782A",
258 "s c #397C2A",
259 "d c #2E613E",
260 "f c #336C37",
261 "g c #2F6040",
262 "h c #356545",
263 "j c #3C6B4E",
264 "k c #3F6C51",
265 "l c #406E4F",
266 "z c #406D52",
267 "x c #477457",
268 "c c #497557",
269 "v c #4B7857",
270 "b c #517B5E",
271 "n c #3C8423",
272 "m c #3E812C",
273 "M c #53A61D",
274 "N c #41862C",
275 "B c #458A2D",
276 "V c #498F2D",
277 "C c #479324",
278 "Z c #489226",
279 "A c #4D952C",
280 "S c #478B30",
281 "D c #488C30",
282 "F c #4D9232",
283 "G c #509632",
284 "H c #549A33",
285 "J c #589F35",
286 "K c #56A526",
287 "L c #57A821",
288 "P c #5BAA27",
289 "I c #57A32A",
290 "U c #5CA72E",
291 "Y c #5DAB2A",
292 "T c #5CA336",
293 "R c #60AD2E",
294 "E c #63B12D",
295 "W c #65AF35",
296 "Q c #62A53F",
297 "! c #65AE39",
298 "~ c #66B036",
299 "^ c #6AB437",
300 "/ c #67B138",
301 "( c #6AB339",
302 ") c #6DB838",
303 "_ c #70BA3C",
304 "` c #4D8545",
305 "' c #4E8942",
306 "] c #548851",
307 "[ c #6FAF4A",
308 "{ c #6DB243",
309 "} c #71B546",
310 "| c #70B840",
311 " . c #73B648",
312 ".. c #79BA4E",
313 "X. c #7CBB53",
314 "o. c #598266",
315 "O. c #62886D",
316 "+. c #6A8F75",
317 "@. c #6B9173",
318 "#. c #70937A",
319 "$. c #799F79",
320 "%. c #7BAF66",
321 "&. c #81BD5B",
322 "*. c #85BF60",
323 "=. c #85AC7F",
324 "-. c #8DBA7B",
325 ";. c #87C061",
326 ":. c #8AC364",
327 ">. c #8DC46A",
328 ",. c #90C56E",
329 "<. c #93C771",
330 "1. c #96CA73",
331 "2. c #9ACB7C",
332 "3. c #9FD07D",
333 "4. c #779981",
334 "5. c #7F9F89",
335 "6. c #809F88",
336 "7. c #82A18B",
337 "8. c #86A192",
338 "9. c #8DA994",
339 "0. c #8FA998",
340 "q. c #94AF9B",
341 "w. c #97B991",
342 "e. c #97B19E",
343 "r. c #9DB6A3",
344 "t. c #A3BCA7",
345 "y. c #A6BCAB",
346 "u. c #A9BEB1",
347 "i. c #9ECD81",
348 "p. c #A2CF85",
349 "a. c #A5D284",
350 "s. c #A6D189",
351 "d. c #A9D28E",
352 "f. c #ABD491",
353 "g. c #B1D797",
354 "h. c #B1D699",
355 "j. c #B5D89E",
356 "k. c #ADC5AC",
357 "l. c #B1CAAE",
358 "z. c #B9DAA3",
359 "x. c #BDDDA8",
360 "c. c #ADC1B4",
361 "v. c #B2C6B6",
362 "b. c #B5C6BC",
363 "n. c #B6C9BA",
364 "m. c #BCD1BA",
365 "M. c #C6E1B4",
366 "N. c #CDE5BD",
367 "B. c #C2D2C6",
368 "V. c #CADEC2",
369 "C. c #C6D3CC",
370 "Z. c #C8D7CB",
371 "A. c #CEDAD2",
372 "S. c #D2DDD4",
373 "D. c #D3E9C6",
374 "F. c #D7EBC9",
375 "G. c #D9EBCD",
376 "H. c #DEEED4",
377 "J. c #D6E0D9",
378 "K. c #DAE4DC",
379 "L. c #E0EFD7",
380 "P. c #E5F2DD",
381 "I. c #DFE8E0",
382 "U. c #E4EBE5",
383 "Y. c #E9EFEA",
384 "T. c #EDF4EB",
385 "R. c #F0FAE6",
386 "E. c #F1F8EC",
387 "W. c #EDF0F0",
388 "Q. c #F4F7F3",
389 "!. c #F6F9F4",
390 "~. c #F8FAF7",
391 "^. c #FEFEFE",
392 "/. c None",
393 /* pixels */
394 "/././././.c h ' Q / W _ &.p././././././././././././././././././././././././././././././././.",
395 "/././.4 O % Z ~ ~ W ~ W R U R R ( X.>.p././././././././././././././././././././././././././.",
396 "/./.. * = J _ ~ ~ ~ ~ ~ / / / / W W U P P U W .;.2././././././././././././././././././././.",
397 "/.= = & a ) W ~ ~ ~ ~ ~ / W / ~ ~ ~ ^ ( ( ^ ~ R R U P Y ~ .;.2././././././././././././././.",
398 "O.O = = T ^ W ~ ~ ~ ~ ~ ~ W W / W ~ ~ ~ ~ ~ ~ ~ ( ( ( ( ~ W Y Y Y Y W { &.1././././././././.",
399 "0 = * 7 ~ ~ ~ ~ ~ ~ ~ ~ ~ / / W ~ ~ ~ ~ ~ ~ ~ ~ W W W ~ ~ ~ ~ ( ( ( W W R U P U W { X.1.f./.",
400 "= = & e ^ W ~ ~ ~ ~ ~ ~ ~ ~ / / ~ ~ ~ ~ ~ ~ ~ ~ W ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ^ ( ( / ~ W R U U Y ",
401 "= = & e ^ W ~ ~ ~ ~ ~ ~ ~ ~ W W ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W ( W ~ ~ ~ ^ ^ ( ",
402 "= = * e ^ W ~ ~ ~ ~ ~ ~ / W / W ! ( / ~ W ^ ( ( ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W ~ W W ~ ~ ~ ~ ~ ~ ",
403 "= = & e ^ ! ~ ~ ~ ~ ~ ~ W W ^ _ ~ K Y W W R P Y W ( ~ ~ ~ ~ ~ ~ ~ W / ~ ~ ~ ^ W ~ ~ ~ ~ ~ ~ ",
404 "= = & e ^ W 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~ ~ ~ ~ ~ ~ ",
436 "= = & e ^ ~ ~ ~ W W / W ~ ~ ~ ~ ) ; h ^.^.^.^.^.d.M U ~ / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W ",
437 "= = & e ^ W ~ ~ ^ W W / ~ ~ ~ W ) p + S.^.^.^.^.~.M.f. .W ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ .",
438 "= = & e ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W ( T O +.^.~.^.^.^.^.^.&.Y ( ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W ( Y 2.",
439 "= = & e ( W ~ ~ ~ ~ ~ ~ ~ ~ ~ / W ) N + b.^.^.^.^.^.^.&.R ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W /.",
440 "= = & e ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W ^ N 7 r.W.^.^.^.!.X.W ~ ~ W ~ W ~ ~ ~ ~ ~ ~ / ( ( K p./.",
441 "= = & e ( W ~ ~ W ~ ~ ~ ~ ~ ~ ~ ~ ~ W ( W C Q &.:.X.| ~ ~ ~ ~ W ~ / ~ ( / ( ~ W E U P 1././.",
442 "= = + e ^ / / / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W / ) ^ R Y W W ~ ~ ( / ( / W R Y Y U R ( X.,././././.",
443 "= = * e ( / ~ / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W W W ! ( ( ( W W E U P Y W ( X.,.d./././././././././.",
444 "= = * e ( W ~ ~ ~ ~ W ! ~ W ~ W ~ ( ( / ^ W W U Y P W ( X.,.d./././././././././././././././.",
445 "8 $ * e ( W ~ ~ ~ ! ( ( ( / ( W R Y Y Y R ( X.>.d./././././././././././././././././././././.",
446 "/.d . y ^ / / / ( W Y Y P P W ( X.>.d./././././././././././././././././././././././././././.",
447 "/./.h : ^ R R R W ( X.<.f./././././././././././././././././././././././././././././././././.",
448 "/././.] _ *.3./././././././././././././././././././././././././././././././././././././././."
449 };
450 
451 class EvalMessageBox : public QDialog
452 {
453 public:
454  EvalMessageBox(bool expired)
455  {
456  setWindowTitle(QLatin1String(" "));
457 
458  QString str = qt_eval_string();
459  if (expired) {
461  } else {
462  str = qt_eval_string();
463  }
464  str = str.trimmed();
465 
466  QFrame *border = new QFrame(this);
467 
468  QLabel *pixmap_label = new QLabel(border);
469  pixmap_label->setPixmap(qtlogo_eval_xpm);
470  pixmap_label->setAlignment(Qt::AlignTop);
471 
472  QLabel *text_label = new QLabel(str, border);
473 
474  QHBoxLayout *pm_and_text_layout = new QHBoxLayout();
475  pm_and_text_layout->addWidget(pixmap_label);
476  pm_and_text_layout->addWidget(text_label);
477 
478  QVBoxLayout *master_layout = new QVBoxLayout(border);
479  master_layout->addLayout(pm_and_text_layout);
480 
481  QVBoxLayout *border_layout = new QVBoxLayout(this);
482  border_layout->setMargin(0);
483  border_layout->addWidget(border);
484 
485  if (expired) {
486  QPushButton *cmd = new QPushButton(QLatin1String("OK"), border);
488  cmd->setDefault(true);
489 
490  QHBoxLayout *button_layout = new QHBoxLayout();
491  master_layout->addLayout(button_layout);
492  button_layout->addWidget(cmd);
493 
494  connect(cmd, SIGNAL(clicked()), this, SLOT(close()));
495  } else {
499  QTimer::singleShot(7000, this, SLOT(close()));
500  setAttribute(Qt::WA_DeleteOnClose);
501  }
502 
503  setFixedSize(sizeHint());
504  }
505 };
506 
507 class QGuiFuriCuri : public QCoreFuriCuri
508 {
509 public:
510  void timerEvent(QTimerEvent *e) {
511  if (e->timerId() == warn) {
512  killTimer(warn);
515  } else if (e->timerId() == kill) {
516  killTimer(kill);
518  qApp->quit();
519  }
520  }
521 };
522 
523 
524 void qt_gui_eval_init(uint)
525 {
526  switch (qt_eval_days_left()) {
527  case -2:
528  return;
529 
530  case -1: {
531  EvalMessageBox box(true);
532  box.exec();
533  ::exit(0);
534  }
535 
536  default: {
537  EvalMessageBox *box = new EvalMessageBox(false);
538  box->show();
539  Q_UNUSED(new QGuiFuriCuri());
540  }
541  }
542 }
543 
544 static QString qt_eval_title_prefix()
545 {
546  return QLatin1String("[Qt Evaluation] ");
547 }
548 
549 QString qt_eval_adapt_window_title(const QString &title)
550 {
551  if (qt_eval_days_left() == -2)
552  return title;
553  return qt_eval_title_prefix() + title;
554 }
555 
556 void qt_eval_init_widget(QWidget *w)
557 {
558  if (qt_eval_days_left() == -2)
559  return;
560  if (w->isTopLevel() && w->windowTitle().isEmpty() && w->windowType() != Qt::Desktop ) {
561  w->setWindowTitle(QLatin1String(" "));
562  }
563 }
564 #endif
565 
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
Definition: qobject.cpp:1623
int type
Definition: qmetatype.cpp:239
int daysTo(const QDate &) const
Returns the number of days from this date to d (which is negative if d is earlier than this date)...
Definition: qdatetime.cpp:1111
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QDialog class is the base class of dialog windows.
Definition: qdialog.h:56
static QString licensee()
Returns the person to whom this build of Qt is licensed.
static QString qt_eval_string()
void addLayout(QLayout *layout, int stretch=0)
Adds layout to the end of the box, with serial stretch factor stretch.
#define SLOT(a)
Definition: qobjectdefs.h:226
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setDefault(bool)
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
Definition: qglobal.h:92
static int qt_eval_days_left()
The QDate class provides date functions.
Definition: qdatetime.h:55
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void setPixmap(const QPixmap &)
Definition: qlabel.cpp:439
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
void timerEvent(QTimerEvent *e)
This event handler can be reimplemented in a subclass to receive timer events for the object...
static void quit()
Tells the application to exit with return code 0 (success).
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static int qt_eval_is_supported()
Definition: qtcore_eval.cpp:91
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
Definition: qstring.cpp:4506
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
static QDate currentDate()
Returns the current date, as reported by the system clock.
Definition: qdatetime.cpp:3115
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define qApp
#define KILL_DELAY
static const char boilerplate_expired[]
Definition: qtcore_eval.cpp:76
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition: qcoreevent.h:346
unsigned int uint
Definition: qglobal.h:996
#define QT_VERSION_STR
This macro expands to a string that specifies Qt&#39;s version number (for example, "4.
Definition: qglobal.h:47
QString windowTitle
the window title (caption)
Definition: qwidget.h:198
void setFrameShape(Shape)
Definition: qframe.cpp:284
static QDate buildDate()
Returns the installation date for this build of Qt.
static QWidget * parentWidget(const QWidget *w)
void setFrameShadow(Shadow)
Definition: qframe.cpp:306
#define WARN_TIMEOUT
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
static const char will_shutdown_1min[]
Definition: qtcore_eval.cpp:82
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
static QCoreApplication * instance()
Returns a pointer to the application&#39;s QCoreApplication (or QApplication) instance.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59
bool isTopLevel() const
Use isWindow() instead.
Definition: qwidget.h:942
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
Opens an information message box with the given title and text in front of the specified parent widge...
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
The QHBoxLayout class lines up widgets horizontally.
Definition: qboxlayout.h:129
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
Definition: qglobal.h:91
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
The QVBoxLayout class lines up widgets vertically.
Definition: qboxlayout.h:149
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
void setMargin(int)
Definition: qlayout.cpp:464
static const char boilerplate_unsuported[]
Definition: qtcore_eval.cpp:55
static const char will_shutdown_now[]
Definition: qtcore_eval.cpp:86
#define qPrintable(string)
Definition: qglobal.h:1750
The QFrame class is the base class of widgets that can have a frame.
Definition: qframe.h:55
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
static const char boilerplate_supported[]
Definition: qtcore_eval.cpp:66
void setAlignment(Qt::Alignment)
Without this function, a call to e.
Definition: qlabel.cpp:532
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650