Modifications from cfd4f8d1c5 merged.

preferencesAboutTextFull
Yimgo 12 years ago
parent fa5fa92b57
commit 786ae0354f
  1. 39
      src/domain/UBGraphicsWidgetItem.cpp

@ -110,7 +110,7 @@ void UBGraphicsWidgetItem::initialize()
connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared())); connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared()));
connect(page(), SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested(const QRect&))); connect(page(), SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested(const QRect&)));
connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(mainFrameLoadFinished (bool))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(mainFrameLoadFinished (bool)));
} }
QUrl UBGraphicsWidgetItem::mainHtml() QUrl UBGraphicsWidgetItem::mainHtml()
@ -566,33 +566,30 @@ void UBGraphicsWidgetItem::paint( QPainter *painter, const QStyleOptionGraphicsI
{ {
if (mIsFrozen) if (mIsFrozen)
painter->drawPixmap(0, 0, mSnapshot); painter->drawPixmap(0, 0, mSnapshot);
else if(mIsTakingSnapshot || (mInitialLoadDone && !mLoadIsErronous)) else
QGraphicsWebView::paint(painter, option, widget); QGraphicsWebView::paint(painter, option, widget);
else { if (!mInitialLoadDone || mLoadIsErronous) {
QString message = tr("Loading ..."); QString message;
/* this is the right way of doing but we receive two callback and the one return always that the if (mInitialLoadDone && mLoadIsErronous)
* load as failed... to check message = tr("Cannot load content");
if (mLoadIsErronous) else
message = tr("Cannot load content"); message = tr("Loading ...");
else
message = tr("Loading ...");
*/
painter->setFont(QFont("Arial", 12)); painter->setFont(QFont("Arial", 12));
QFontMetrics fm = painter->fontMetrics(); QFontMetrics fm = painter->fontMetrics();
QRect txtBoundingRect = fm.boundingRect(message); QRect txtBoundingRect = fm.boundingRect(message);
txtBoundingRect.moveCenter(rect().center().toPoint()); txtBoundingRect.moveCenter(rect().center().toPoint());
txtBoundingRect.adjust(-10, -5, 10, 5); txtBoundingRect.adjust(-10, -5, 10, 5);
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
painter->setBrush(UBSettings::paletteColor); painter->setBrush(UBSettings::paletteColor);
painter->drawRoundedRect(txtBoundingRect, 3, 3); painter->drawRoundedRect(txtBoundingRect, 3, 3);
painter->setPen(Qt::white); painter->setPen(Qt::white);
painter->drawText(rect(), Qt::AlignCenter, message); painter->drawText(rect(), Qt::AlignCenter, message);
} }
} }

Loading…
Cancel
Save