Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 22663 → Rev 22664

/trunk/Scribus/scribus/ui/fontcombo.cpp
29,6 → 29,7
#include <QLabel>
#include <QPixmap>
#include <QStringList>
#include <QTooltip>
 
#include "fontcombo.h"
#include "iconmanager.h"
457,7 → 458,7
return QFontDatabase::Any;
}
 
const ScFace& getScFace(const QString& classname, const QString& text)
const ScFace& getScFace(const QString& className, const QString& text)
{
QFontDatabase& fontDb = ScQApp->qtFontDatabase();
PrefsManager* prefsManager = PrefsManager::instance();
464,7 → 465,7
SCFonts& availableFonts = prefsManager->appPrefs.fontPrefs.AvailFonts;
 
// Handle FontComboH class witch has only Family names in the combo class.
if (classname == "FontComboH" || classname == "SMFontComboH")
if (className == "FontComboH" || className == "SMFontComboH")
{
// SMFontComboH's "Use Parent Font" case
if (!availableFonts.fontMap.contains(text))
619,6 → 620,34
pixmapCache.insert(cacheKey+"-selected", invPixmap);
}
 
bool FontFamilyDelegate::helpEvent(QHelpEvent * event, QAbstractItemView * view,
const QStyleOptionViewItem & option, const QModelIndex & index)
{
if (!event || !view)
return false;
 
if (event->type() == QEvent::ToolTip)
{
QString text(index.data(Qt::DisplayRole).toString());
QString className = this->parent()->metaObject()->className();
const ScFace& scFace = getScFace(className, text);
if (!scFace.isNone())
{
QString tooltip = scFace.family();
if (className == QLatin1String("FontCombo"))
{
tooltip += QLatin1String(" ");
tooltip += scFace.style();
}
QHelpEvent *helpEvent = static_cast<QHelpEvent*>(event);
QToolTip::showText(helpEvent->globalPos(), tooltip, view);
return true;
}
}
return QAbstractItemDelegate::helpEvent(event, view, option, index);
}
 
QSize FontFamilyDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
/trunk/Scribus/scribus/ui/fontcombo.h
115,6 → 115,9
const QStyleOptionViewItem &option,
const QModelIndex &index) const Q_DECL_OVERRIDE;
 
bool helpEvent(QHelpEvent * event, QAbstractItemView * view,
const QStyleOptionViewItem & option, const QModelIndex & index) Q_DECL_OVERRIDE;
 
QSize sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const Q_DECL_OVERRIDE;