本文整理汇总了C++中QStyle::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QStyle::setObjectName方法的具体用法?C++ QStyle::setObjectName怎么用?C++ QStyle::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStyle
的用法示例。
在下文中一共展示了QStyle::setObjectName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keys
/*!
Creates and returns a QStyle object that matches the given \a key, or
returns 0 if no matching style is found.
Both built-in styles and styles from style plugins are queried for a
matching style.
\note The keys used are case insensitive.
\sa keys()
*/
QStyle *QStyleFactory::create(const QString& key)
{
QStyle *ret = 0;
QString style = key.toLower();
#ifndef QT_NO_STYLE_WINDOWS
if (style == QLatin1String("windows"))
ret = new QWindowsStyle;
else
#endif
#ifndef QT_NO_STYLE_WINDOWSCE
if (style == QLatin1String("windowsce"))
ret = new QWindowsCEStyle;
else
#endif
#ifndef QT_NO_STYLE_WINDOWSMOBILE
if (style == QLatin1String("windowsmobile"))
ret = new QWindowsMobileStyle;
else
#endif
#ifndef QT_NO_STYLE_WINDOWSXP
if (style == QLatin1String("windowsxp"))
ret = new QWindowsXPStyle;
else
#endif
#ifndef QT_NO_STYLE_WINDOWSVISTA
if (style == QLatin1String("windowsvista"))
ret = new QWindowsVistaStyle;
else
#endif
#ifndef QT_NO_STYLE_FUSION
if (style == QLatin1String("fusion"))
ret = new QFusionStyle;
else
#endif
#ifndef QT_NO_STYLE_GTK
if (style == QLatin1String("gtk") || style == QLatin1String("gtk+"))
ret = new QGtkStyle;
else
#endif
#ifndef QT_NO_STYLE_MAC
if (style.startsWith(QLatin1String("macintosh"))) {
ret = new QMacStyle;
# ifdef Q_WS_MAC
if (style == QLatin1String("macintosh"))
style += QLatin1String(" (aqua)");
# endif
} else
#endif
{ } // Keep these here - they make the #ifdefery above work
#ifndef QT_NO_LIBRARY
if (!ret)
ret = qLoadPlugin<QStyle, QStylePlugin>(loader(), style);
#endif
if(ret)
ret->setObjectName(style);
return ret;
}
示例2: keys
/*!
Creates and returns a QStyle object that matches the given \a key, or
returns 0 if no matching style is found.
Both built-in styles and styles from style plugins are queried for a
matching style.
\note The keys used are case insensitive.
\sa keys()
*/
QStyle *QStyleFactory::create(const QString& key)
{
QStyle *ret = Q_NULLPTR;
QString style = key.toLower();
#ifndef QT_NO_STYLE_WINDOWS
if (style == QLatin1String("windows"))
ret = new QWindowsStyle;
else
#endif
#ifndef QT_NO_STYLE_MOTIF
if (style == QLatin1String("motif"))
ret = new QMotifStyle;
else
#endif
#ifndef QT_NO_STYLE_CDE
if (style == QLatin1String("cde"))
ret = new QCDEStyle;
else
#endif
#ifndef QT_NO_STYLE_PLASTIQUE
if (style == QLatin1String("plastique"))
ret = new QPlastiqueStyle;
else
#endif
#ifndef QT_NO_STYLE_CLEANLOOKS
if (style == QLatin1String("cleanlooks"))
ret = new QCleanlooksStyle;
else
#endif
#ifndef QT_NO_STYLE_GTK
if (style == QLatin1String("gtk") || style == QLatin1String("gtk+"))
ret = new QGtkStyle;
else
#endif
{ } // Keep these here - they make the #ifdefery above work
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
if(!ret) {
if (QStyleFactoryInterface *factory = qobject_cast<QStyleFactoryInterface*>(stylesloader()->instance(style)))
ret = factory->create(style);
}
#endif
if(ret)
ret->setObjectName(style);
return ret;
}
示例3: load_style
int load_style(QString &path, QString &name) {
int ret = 0;
QStyle *s;
QPluginLoader pl(path);
QObject *o = pl.instance();
if (o != 0) {
QStylePlugin *sp = qobject_cast<QStylePlugin *>(o);
if (sp != 0) {
s = sp->create(name);
if (s != 0) {
s->setObjectName(name);
QApplication::setStyle(s);
ret = 1;
}
}
}
return ret;
}
示例4: keys
/*!
Creates and returns a QStyle object that matches the given \a key, or
returns 0 if no matching style is found.
Both built-in styles and styles from style plugins are queried for a
matching style.
\note The keys used are case insensitive.
\sa keys()
*/
QStyle *QStyleFactory::create(const QString& key)
{
QStyle *ret = 0;
QString style = key.toLower();
#ifndef QT_NO_STYLE_WINDOWS
if (style == QLatin1String("windows"))
ret = new QWindowsStyle;
else
#endif
#ifndef QT_NO_STYLE_WINDOWSXP
if (style == QLatin1String("windowsxp"))
ret = new QWindowsXPStyle;
else
#endif
#ifndef QT_NO_STYLE_WINDOWSVISTA
if (style == QLatin1String("windowsvista"))
ret = new QWindowsVistaStyle;
else
#endif
#ifndef QT_NO_STYLE_MOTIF
if (style == QLatin1String("motif"))
ret = new QMotifStyle;
else
#endif
#ifndef QT_NO_STYLE_CDE
if (style == QLatin1String("cde"))
ret = new QCDEStyle;
else
#endif
#ifndef QT_NO_STYLE_PLASTIQUE
if (style == QLatin1String("plastique"))
ret = new QPlastiqueStyle;
else
#endif
#ifndef QT_NO_STYLE_CLEANLOOKS
if (style == QLatin1String("cleanlooks"))
ret = new QCleanlooksStyle;
else
#endif
#ifndef QT_NO_STYLE_GTK
if (style == QLatin1String("gtk") || style == QLatin1String("gtk+"))
ret = new QGtkStyle;
else
#endif
#ifndef QT_NO_STYLE_MAC
if (style.startsWith(QLatin1String("macintosh"))) {
ret = new QMacStyle;
# ifdef Q_WS_MAC
if (style == QLatin1String("macintosh"))
style += QLatin1String(" (aqua)");
# endif
} else
#endif
{ } // Keep these here - they make the #ifdefery above work
#if ! defined(QT_NO_SETTINGS)
if(!ret) {
if (QStyleFactoryInterface *factory = qobject_cast<QStyleFactoryInterface*>(loader()->instance(style)))
ret = factory->create(style);
}
#endif
if(ret)
ret->setObjectName(style);
return ret;
}