You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.3 KiB
C++

/*!
\file csplashscreen.cpp
*/
#include "csplashscreen.h"
#include <QStyleOptionProgressBar>
cSplashScreen::cSplashScreen(const QPixmap& pixmap, QFont& font) :
QSplashScreen(pixmap),
m_max(100),
m_progress(0)
{
setFont(font);
m_textDocument.setDefaultFont(font);
}
void cSplashScreen::setMax(qint32 max)
{
m_max = max;
}
void cSplashScreen::drawContents(QPainter *painter)
{
painter->translate(m_rect.topLeft());
m_textDocument.setHtml(m_message);
m_textDocument.drawContents(painter);
QStyleOptionProgressBar pbstyle;
pbstyle.initFrom(this);
pbstyle.state = QStyle::State_Enabled;
pbstyle.textVisible = false;
pbstyle.minimum = 0;
pbstyle.maximum = m_max;
pbstyle.progress = m_progress;
pbstyle.invertedAppearance = false;
pbstyle.rect = QRect(0, 330, 390, 10); // Where is it.
// Draw it...
style()->drawControl(QStyle::CE_ProgressBar, &pbstyle, painter, this);
}
void cSplashScreen::showStatusMessage(const QString& message)
{
m_message = message;
showMessage(m_message);
}
void cSplashScreen::addStatusMessage(const QString& message)
{
m_message.append(message);
showMessage(m_message);
}
void cSplashScreen::setMessageRect(QRect rect)
{
m_rect = rect;
m_textDocument.setTextWidth(rect.width());
}
void cSplashScreen::setProgress(int value)
{
m_progress = value;
update();
}