| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | class QSplashScreenPrivate : public QWidgetPrivate | - |
| 14 | { | - |
| 15 | inline QSplashScreen* q_func() { return static_cast<QSplashScreen *>(q_ptr); } inline const QSplashScreen* q_func() const { return static_cast<const QSplashScreen *>(q_ptr); } friend class QSplashScreen; | - |
| 16 | public: | - |
| 17 | QPixmap pixmap; | - |
| 18 | QString currStatus; | - |
| 19 | QColor currColor; | - |
| 20 | int currAlign; | - |
| 21 | | - |
| 22 | inline QSplashScreenPrivate(); | - |
| 23 | }; | - |
| 24 | QSplashScreen::QSplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) | - |
| 25 | : QWidget(*(new QSplashScreenPrivate()), 0, Qt::SplashScreen | Qt::FramelessWindowHint | f) | - |
| 26 | { | - |
| 27 | setPixmap(pixmap); | - |
| 28 | } executed: }Execution Count:1 | 1 |
| 29 | QSplashScreen::QSplashScreen(QWidget *parent, const QPixmap &pixmap, Qt::WindowFlags f) | - |
| 30 | : QWidget(*new QSplashScreenPrivate, parent, Qt::SplashScreen | f) | - |
| 31 | { | - |
| 32 | d_func()->pixmap = pixmap; | - |
| 33 | setPixmap(d_func()->pixmap); | - |
| 34 | } | 0 |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | QSplashScreen::~QSplashScreen() | - |
| 40 | { | - |
| 41 | } | - |
| 42 | | - |
| 43 | | - |
| 44 | | - |
| 45 | | - |
| 46 | void QSplashScreen::mousePressEvent(QMouseEvent *) | - |
| 47 | { | - |
| 48 | hide(); | - |
| 49 | } | 0 |
| 50 | | - |
| 51 | | - |
| 52 | | - |
| 53 | | - |
| 54 | | - |
| 55 | | - |
| 56 | | - |
| 57 | void QSplashScreen::repaint() | - |
| 58 | { | - |
| 59 | QWidget::repaint(); | - |
| 60 | QApplication::flush(); | - |
| 61 | } | 0 |
| 62 | void QSplashScreen::showMessage(const QString &message, int alignment, | - |
| 63 | const QColor &color) | - |
| 64 | { | - |
| 65 | QSplashScreenPrivate * const d = d_func(); | - |
| 66 | d->currStatus = message; | - |
| 67 | d->currAlign = alignment; | - |
| 68 | d->currColor = color; | - |
| 69 | messageChanged(d->currStatus); | - |
| 70 | repaint(); | - |
| 71 | } | 0 |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | void QSplashScreen::clearMessage() | - |
| 79 | { | - |
| 80 | d_func()->currStatus.clear(); | - |
| 81 | messageChanged(d_func()->currStatus); | - |
| 82 | repaint(); | - |
| 83 | } | 0 |
| 84 | | - |
| 85 | | - |
| 86 | inline static bool waitForWindowExposed(QWindow *window, int timeout = 1000) | - |
| 87 | { | - |
| 88 | enum { TimeOutMs = 10 }; | - |
| 89 | QElapsedTimer timer; | - |
| 90 | timer.start(); | - |
| 91 | while (!window->isExposed()) { never evaluated: !window->isExposed() | 0 |
| 92 | const int remaining = timeout - int(timer.elapsed()); | - |
| 93 | if (remaining <= 0) never evaluated: remaining <= 0 | 0 |
| 94 | break; | 0 |
| 95 | QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); | - |
| 96 | QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); | - |
| 97 | | - |
| 98 | | - |
| 99 | | - |
| 100 | struct timespec ts = { TimeOutMs / 1000, (TimeOutMs % 1000) * 1000 * 1000 }; | - |
| 101 | nanosleep(&ts, __null); | - |
| 102 | | - |
| 103 | } | 0 |
| 104 | return window->isExposed(); never executed: return window->isExposed(); | 0 |
| 105 | } | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | | - |
| 112 | void QSplashScreen::finish(QWidget *mainWin) | - |
| 113 | { | - |
| 114 | if (mainWin && mainWin->windowHandle()) never evaluated: mainWin->windowHandle() | 0 |
| 115 | waitForWindowExposed(mainWin->windowHandle()); never executed: waitForWindowExposed(mainWin->windowHandle()); | 0 |
| 116 | close(); | - |
| 117 | } | 0 |
| 118 | | - |
| 119 | | - |
| 120 | | - |
| 121 | | - |
| 122 | | - |
| 123 | void QSplashScreen::setPixmap(const QPixmap &pixmap) | - |
| 124 | { | - |
| 125 | QSplashScreenPrivate * const d = d_func(); | - |
| 126 | | - |
| 127 | d->pixmap = pixmap; | - |
| 128 | setAttribute(Qt::WA_TranslucentBackground, pixmap.hasAlpha()); | - |
| 129 | | - |
| 130 | QRect r(QPoint(), d->pixmap.size()); | - |
| 131 | resize(r.size()); | - |
| 132 | move(QApplication::desktop()->screenGeometry().center() - r.center()); | - |
| 133 | if (isVisible()) partially evaluated: isVisible()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 134 | repaint(); never executed: repaint(); | 0 |
| 135 | } executed: }Execution Count:1 | 1 |
| 136 | | - |
| 137 | | - |
| 138 | | - |
| 139 | | - |
| 140 | | - |
| 141 | const QPixmap QSplashScreen::pixmap() const | - |
| 142 | { | - |
| 143 | return d_func()->pixmap; never executed: return d_func()->pixmap; | 0 |
| 144 | } | - |
| 145 | | - |
| 146 | | - |
| 147 | | - |
| 148 | | - |
| 149 | inline QSplashScreenPrivate::QSplashScreenPrivate() : currAlign(Qt::AlignLeft) | - |
| 150 | { | - |
| 151 | } executed: }Execution Count:1 | 1 |
| 152 | | - |
| 153 | | - |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | | - |
| 159 | void QSplashScreen::drawContents(QPainter *painter) | - |
| 160 | { | - |
| 161 | QSplashScreenPrivate * const d = d_func(); | - |
| 162 | painter->setPen(d->currColor); | - |
| 163 | QRect r = rect().adjusted(5, 5, -5, -5); | - |
| 164 | if (Qt::mightBeRichText(d->currStatus)) { never evaluated: Qt::mightBeRichText(d->currStatus) | 0 |
| 165 | QTextDocument doc; | - |
| 166 | | - |
| 167 | | - |
| 168 | | - |
| 169 | doc.setHtml(d->currStatus); | - |
| 170 | | - |
| 171 | doc.setTextWidth(r.width()); | - |
| 172 | QTextCursor cursor(&doc); | - |
| 173 | cursor.select(QTextCursor::Document); | - |
| 174 | QTextBlockFormat fmt; | - |
| 175 | fmt.setAlignment(Qt::Alignment(d->currAlign)); | - |
| 176 | cursor.mergeBlockFormat(fmt); | - |
| 177 | painter->save(); | - |
| 178 | painter->translate(r.topLeft()); | - |
| 179 | doc.drawContents(painter); | - |
| 180 | painter->restore(); | - |
| 181 | } else { | 0 |
| 182 | painter->drawText(r, d->currAlign, d->currStatus); | - |
| 183 | } | 0 |
| 184 | } | - |
| 185 | | - |
| 186 | | - |
| 187 | bool QSplashScreen::event(QEvent *e) | - |
| 188 | { | - |
| 189 | if (e->type() == QEvent::Paint) { partially evaluated: e->type() == QEvent::Paint| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 190 | QSplashScreenPrivate * const d = d_func(); | - |
| 191 | QPainter painter(this); | - |
| 192 | if (!d->pixmap.isNull()) never evaluated: !d->pixmap.isNull() | 0 |
| 193 | painter.drawPixmap(QPoint(), d->pixmap); never executed: painter.drawPixmap(QPoint(), d->pixmap); | 0 |
| 194 | drawContents(&painter); | - |
| 195 | } | 0 |
| 196 | return QWidget::event(e); executed: return QWidget::event(e);Execution Count:13 | 13 |
| 197 | } | - |
| 198 | | - |
| 199 | | - |
| 200 | | - |
| | |