6 #include <QStyleFactory>
12 namespace swift::gui::settings
14 CGeneralGuiSettings::CGeneralGuiSettings() {}
16 void CGeneralGuiSettings::setWidgetStyle(
const QString &widgetStyle)
18 if (this->m_widgetStyle == widgetStyle) {
return; }
19 const auto availableStyles = QStyleFactory::keys();
20 if (availableStyles.contains(widgetStyle)) { m_widgetStyle = widgetStyle; }
23 bool CGeneralGuiSettings::isDifferentValidWidgetStyle(
const QString &style)
const
25 if (!QStyleFactory::keys().contains(style)) {
return false; }
26 return style != this->m_widgetStyle;
29 QAbstractItemView::SelectionMode CGeneralGuiSettings::getPreferredSelection()
const
31 return static_cast<QAbstractItemView::SelectionMode
>(m_preferredSelection);
34 void CGeneralGuiSettings::setPreferredSelection(QAbstractItemView::SelectionMode selection)
36 this->m_preferredSelection =
static_cast<int>(selection);
39 QString CGeneralGuiSettings::convertToQString(
bool i18n)
const
42 return QStringLiteral(
"Widget style: %1").arg(this->m_widgetStyle);
47 if (index.
isMyself()) {
return QVariant::fromValue(*
this); }
51 case IndexWidgetStyle:
return QVariant::fromValue(this->m_widgetStyle);
52 case IndexPreferredSelection:
return QVariant::fromValue(this->m_preferredSelection);
67 case IndexWidgetStyle: this->setWidgetStyle(variant.toString());
break;
68 case IndexPreferredSelection: this->m_preferredSelection = variant.toInt();
break;
ColumnIndex
Properties by index.
Non-owning reference to a CPropertyIndex with a subset of its features.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
Free functions in swift::misc.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.