本文整理汇总了C++中QFontDatabase::isScalable方法的典型用法代码示例。如果您正苦于以下问题:C++ QFontDatabase::isScalable方法的具体用法?C++ QFontDatabase::isScalable怎么用?C++ QFontDatabase::isScalable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFontDatabase
的用法示例。
在下文中一共展示了QFontDatabase::isScalable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createEditor
QWidget* NMGPropertyEditorDelegate::createEditor(QWidget* parent,
const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
Q_UNUSED(option);
QWidget* editor = 0;
if(index.column() == 1)
{
const QTreeWidgetItem* property = static_cast<QTreeWidgetItem*>(index.internalPointer());
int valueType = property->data(1, Qt::EditRole).type();
QString propertyName = property->text(0);
switch(valueType)
{
case QVariant::Bool:
{
QComboBox* combo = new QComboBox(parent);
combo->setFrame(FALSE);
combo->addItems(QStringList() << QString::fromUtf8("false") << QString::fromUtf8("true"));
QObject::connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(sync()));
editor = combo;
break;
}
case QVariant::String:
{
if(propertyName == "fontFamily")
{
QFontDatabase fdb;
QStringList list = fdb.families(QFontDatabase::Latin);
QStringList result;
for(int i = 0; i < list.size(); i++)
{
if(fdb.isScalable(list.at(i))) result += list.at(i);
}
QComboBox* combo = new QComboBox(parent);
combo->setFrame(FALSE);
combo->addItems(result);
QObject::connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(sync()));
editor = combo;
}
else if(propertyName == "representation")
{
QComboBox* combo = new QComboBox(parent);
combo->setFrame(FALSE);
QStringList list;
list << LINE_TYPE << AREA_TYPE << POINTS_TYPE << BARS_TYPE;
combo->addItems(list);
QObject::connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(sync()));
editor = combo;
}
else if(propertyName == "position")
示例2: if
//.........这里部分代码省略.........
Display *pDisplay = XOpenDisplay(pszDisplay);
if (!pDisplay)
{
RTPrintf(pszDisplay ? "Failed to open the X11 display \"%s\"!\n"
: "Failed to open the X11 display!\n",
pszDisplay);
break;
}
Visual *pVisual = useDefaultVisual
? DefaultVisual(pDisplay, DefaultScreen(pDisplay))
: NULL;
/* Now create the application object: */
QApplication a(pDisplay, argc, argv, (Qt::HANDLE)pVisual);
#else /* Q_WS_X11 */
QApplication a(argc, argv);
#endif /* Q_WS_X11 */
#ifdef Q_OS_SOLARIS
/* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */
QApplication::setStyle(new QPlastiqueStyle);
#endif /* Q_OS_SOLARIS */
#ifdef Q_WS_X11
/* This patch is not used for now on Solaris & OpenSolaris because
* there is no anti-aliasing enabled by default, Qt4 to be rebuilt. */
# ifndef Q_OS_SOLARIS
/* Cause Qt4 has the conflict with fontconfig application as a result
* sometimes substituting some fonts with non scaleable-anti-aliased
* bitmap font we are reseting substitutes for the current application
* font family if it is non scaleable-anti-aliased. */
QFontDatabase fontDataBase;
QString currentFamily(QApplication::font().family());
bool isCurrentScaleable = fontDataBase.isScalable(currentFamily);
QString subFamily(QFont::substitute(currentFamily));
bool isSubScaleable = fontDataBase.isScalable(subFamily);
if (isCurrentScaleable && !isSubScaleable)
QFont::removeSubstitution(currentFamily);
# endif /* Q_OS_SOLARIS */
#endif /* Q_WS_X11 */
#ifdef Q_WS_WIN
/* Drag in the sound drivers and DLLs early to get rid of the delay taking
* place when the main menu bar (or any action from that menu bar) is
* activated for the first time. This delay is especially annoying if it
* happens when the VM is executing in real mode (which gives 100% CPU
* load and slows down the load process that happens on the main GUI
* thread to several seconds). */
PlaySound(NULL, NULL, 0);
#endif /* Q_WS_WIN */
#ifdef Q_WS_MAC
/* Disable menu icons on MacOS X host: */
::darwinDisableIconsInMenus();
#endif /* Q_WS_MAC */
#ifdef Q_WS_X11
/* Qt version check (major.minor are sensitive, fix number is ignored): */
if (VBoxGlobal::qtRTVersion() < (VBoxGlobal::qtCTVersion() & 0xFFFF00))
{
QString strMsg = QApplication::tr("Executable <b>%1</b> requires Qt %2.x, found Qt %3.")
.arg(qAppName())
.arg(VBoxGlobal::qtCTVersionString().section('.', 0, 1))
.arg(VBoxGlobal::qtRTVersionString());
示例3: a
//.........这里部分代码省略.........
/* To avoid various Qt crashes
* when testing widget attributes or acquiring winIds
* we decided to make our widgets native under x11 hosts.
* Yes, we aware of note that alien widgets faster to draw
* but the only widget we need to be fast - viewport of VM
* was always native since we are using his id for 3d service needs. */
a.setAttribute(Qt::AA_NativeWindows);
#endif /* Q_WS_X11 */
#ifdef Q_WS_MAC
# ifdef VBOX_GUI_WITH_HIDPI
/* Enable HiDPI icons. For this we require a patched version of Qt 4.x with
* the changes from https://codereview.qt-project.org/#change,54636 applied. */
qApp->setAttribute(Qt::AA_UseHighDpiPixmaps);
# endif /* VBOX_GUI_WITH_HIDPI */
#endif /* Q_WS_MAC */
#ifdef Q_OS_SOLARIS
/* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */
QApplication::setStyle(new QPlastiqueStyle);
#endif /* Q_OS_SOLARIS */
#ifdef Q_WS_X11
/* This patch is not used for now on Solaris & OpenSolaris because
* there is no anti-aliasing enabled by default, Qt4 to be rebuilt. */
# ifndef Q_OS_SOLARIS
/* Cause Qt4 has the conflict with fontconfig application as a result
* sometimes substituting some fonts with non scaleable-anti-aliased
* bitmap font we are reseting substitutes for the current application
* font family if it is non scaleable-anti-aliased. */
QFontDatabase fontDataBase;
QString currentFamily(QApplication::font().family());
bool isCurrentScaleable = fontDataBase.isScalable(currentFamily);
QString subFamily(QFont::substitute(currentFamily));
bool isSubScaleable = fontDataBase.isScalable(subFamily);
if (isCurrentScaleable && !isSubScaleable)
QFont::removeSubstitution(currentFamily);
# endif /* Q_OS_SOLARIS */
#endif /* Q_WS_X11 */
#ifdef Q_WS_WIN
/* Drag in the sound drivers and DLLs early to get rid of the delay taking
* place when the main menu bar (or any action from that menu bar) is
* activated for the first time. This delay is especially annoying if it
* happens when the VM is executing in real mode (which gives 100% CPU
* load and slows down the load process that happens on the main GUI
* thread to several seconds). */
PlaySound(NULL, NULL, 0);
#endif /* Q_WS_WIN */
#ifdef Q_WS_MAC
/* Disable menu icons on MacOS X host: */
::darwinDisableIconsInMenus();
#endif /* Q_WS_MAC */
#ifdef Q_WS_X11
/* Qt version check (major.minor are sensitive, fix number is ignored): */
if (VBoxGlobal::qtRTVersion() < (VBoxGlobal::qtCTVersion() & 0xFFFF00))
{
QString strMsg = QApplication::tr("Executable <b>%1</b> requires Qt %2.x, found Qt %3.")
.arg(qAppName())
.arg(VBoxGlobal::qtCTVersionString().section('.', 0, 1))
.arg(VBoxGlobal::qtRTVersionString());
示例4: a
//.........这里部分代码省略.........
#ifdef VBOX_WS_MAC
# ifdef VBOX_GUI_WITH_HIDPI
/* Enable HiDPI icons.
* For this we require a patched version of Qt 4.x with
* the changes from https://codereview.qt-project.org/#change,54636 applied. */
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
# endif /* VBOX_GUI_WITH_HIDPI */
/* Disable menu icons on MacOS X host: */
::darwinDisableIconsInMenus();
#endif /* VBOX_WS_MAC */
#ifdef VBOX_WS_X11
/* Make all widget native.
* We did it to avoid various Qt crashes while testing widget attributes or acquiring winIds.
* Yes, we aware of note that alien widgets faster to draw but the only widget we need to be fast
* is viewport of VM which was always native since we are using his id for 3D service needs. */
a.setAttribute(Qt::AA_NativeWindows);
# ifdef Q_OS_SOLARIS
# if QT_VERSION < 0x050000
/* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */
QApplication::setStyle(new QPlastiqueStyle);
# else /* QT_VERSION >= 0x050000 */
a.setStyle("fusion");
# endif /* QT_VERSION >= 0x050000 */
# endif /* Q_OS_SOLARIS */
# ifndef Q_OS_SOLARIS
/* Apply font fixes (after QApplication get created and instantiated font-family): */
QFontDatabase fontDataBase;
QString currentFamily(QApplication::font().family());
bool isCurrentScaleable = fontDataBase.isScalable(currentFamily);
QString subFamily(QFont::substitute(currentFamily));
bool isSubScaleable = fontDataBase.isScalable(subFamily);
if (isCurrentScaleable && !isSubScaleable)
# if QT_VERSION >= 0x050000
QFont::removeSubstitutions(currentFamily);
# else /* QT_VERSION < 0x050000 */
QFont::removeSubstitution(currentFamily);
# endif /* QT_VERSION < 0x050000 */
# endif /* !Q_OS_SOLARIS */
/* Qt version check (major.minor are sensitive, fix number is ignored): */
if (VBoxGlobal::qtRTVersion() < (VBoxGlobal::qtCTVersion() & 0xFFFF00))
{
QString strMsg = QApplication::tr("Executable <b>%1</b> requires Qt %2.x, found Qt %3.")
.arg(qAppName())
.arg(VBoxGlobal::qtCTVersionString().section('.', 0, 1))
.arg(VBoxGlobal::qtRTVersionString());
QMessageBox::critical(0, QApplication::tr("Incompatible Qt Library Error"),
strMsg, QMessageBox::Abort, 0);
qFatal("%s", strMsg.toUtf8().constData());
break;
}
#endif /* VBOX_WS_X11 */
/* Create modal-window manager: */
UIModalWindowManager::create();
/* Create global UI instance: */
VBoxGlobal::create();
/* Simulate try-catch block: */
do