void PreviewWidget::setScale(qreal scale) { m_scale = scale; QFont font; //take the user's configured point size, and convert it to a pixel size for preview font.setPixelSize(pointSizeToPixelSize(font.pointSize())); m_internalPreview->setFont(font); //as we are a hidden widget, we need to force a repaint to update the size hint properly updatePixmapCache(); m_internalPreview->resize(sizeHint()); m_internalPreview->adjustSize(); QPixmap preview = updatePixmapCache(); setPixmap(preview); }
void KStandardItemListWidget::triggerCacheRefreshing() { if ((!m_dirtyContent && !m_dirtyLayout) || index() < 0) { return; } refreshCache(); const QHash<QByteArray, QVariant> values = data(); m_isExpandable = m_supportsItemExpanding && values["isExpandable"].toBool(); m_isHidden = isHidden(); m_customizedFont = customizedFont(styleOption().font); m_customizedFontMetrics = QFontMetrics(m_customizedFont); updateExpansionArea(); updateTextsCache(); updatePixmapCache(); m_dirtyLayout = false; m_dirtyContent = false; m_dirtyContentRoles.clear(); }
CardDatabase::CardDatabase(QObject *parent) : QObject(parent), noCard(0), loadStatus(NotLoaded) { connect(settingsCache, SIGNAL(picsPathChanged()), this, SLOT(picsPathChanged())); connect(settingsCache, SIGNAL(cardDatabasePathChanged()), this, SLOT(loadCardDatabase())); connect(settingsCache, SIGNAL(tokenDatabasePathChanged()), this, SLOT(loadTokenDatabase())); connect(settingsCache, SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged())); connect(settingsCache, SIGNAL(picDownloadHqChanged()), this, SLOT(picDownloadHqChanged())); loadCardDatabase(); loadTokenDatabase(); pictureLoaderThread = new QThread; pictureLoader = new PictureLoader(settingsCache->getPicsPath(), settingsCache->getPicDownload(), settingsCache->getPicDownloadHq()); pictureLoader->moveToThread(pictureLoaderThread); connect(pictureLoader, SIGNAL(imageLoaded(CardInfo *, const QImage &)), this, SLOT(imageLoaded(CardInfo *, const QImage &))); pictureLoaderThread->start(QThread::LowPriority); noCard = new CardInfo(this); noCard->loadPixmap(); // cache pixmap for card back connect(settingsCache, SIGNAL(cardBackPicturePathChanged()), noCard, SLOT(updatePixmapCache())); }