本文整理汇总了C++中QStyle::metaObject方法的典型用法代码示例。如果您正苦于以下问题:C++ QStyle::metaObject方法的具体用法?C++ QStyle::metaObject怎么用?C++ QStyle::metaObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStyle
的用法示例。
在下文中一共展示了QStyle::metaObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toGetSessionType
QString toGetSessionType(void)
{
QStyle *style = qApp->style();
QString sname = style->metaObject()->className();
// This is probably really slow, but who cares.
QStringList keys = QStyleFactory::keys();
for (int i = 0; i < keys.size(); i++)
{
QString name = keys[i];
QStyle *t = QStyleFactory::create(name);
if (!t)
continue;
if (sname == t->metaObject()->className())
{
delete t;
return name;
}
delete t;
}
// Weird should never get here.
return sname;
}
示例2: getStyle
int ViewHelpMenu::getStyle() const {
QStyle * style = QApplication::style();
const QMetaObject * mo = style->metaObject();
for(uint i = 0 ; i < __ids.size() ; i++){
if((QStyleFactory::create(__ids[i]->text()))->metaObject() == mo)
return i;
}
return -1;
}
示例3: style_class
void
GetAppearance(QApplication *a, AppearanceAttributes *aa)
{
const char *mName = "GetAppearance: ";
// get system default style
QStyle *style = a->style();
QString style_class(style->metaObject()->className());
std::string styleName = "windows";
if(style_class == "QWindowsStyle")
styleName = "windows";
else if(style_class == "QWindowsVistaStyle")
styleName = "windowsvista";
else if(style_class == "QWindowsXPStyle")
styleName = "windowsxp";
else if(style_class == "QMotifStyle")
styleName = "motif";
else if(style_class == "QCleanlooksStyle")
styleName = "cleanlooks";
else if(style_class == "QPlastiqueStyle")
styleName = "plastique";
else if(style_class == "QCDEStyle")
styleName = "cde";
else if(style_class == "QMacStyle")
styleName = "macintosh";
debug1 << mName << "Default System Style is: " << styleName << endl;
aa->SetDefaultStyle(styleName);
// get system default font
QFont font = a->font();
std::string font_name = font.key().toStdString();
debug1 << mName << "Default system font is:" << font_name << endl;
aa->SetDefaultFontName(font_name);
//set aa colors from defaults
QColor bg = a->palette().window().color();
QColor fg = a->palette().windowText().color();
char tmp[20];
SNPRINTF(tmp, 20, "#%02x%02x%02x", bg.red(), bg.green(), bg.blue());
debug1 << mName << "Default background color is:" << tmp << endl;
aa->SetDefaultBackground(tmp);
SNPRINTF(tmp, 20, "#%02x%02x%02x", fg.red(), fg.green(), fg.blue());
debug1 << mName << "Default foreground color is:" << tmp << endl;
aa->SetDefaultForeground(tmp);
debug1 << mName << "Default orientation:" << 0 << endl;
aa->SetDefaultOrientation(0);
}