bool VCSlider::copyFrom(const VCWidget *widget) { const VCSlider *slider = qobject_cast<const VCSlider*> (widget); if (slider == nullptr) return false; /* Copy widget style */ setWidgetStyle(slider->widgetStyle()); /* Copy level stuff */ setRangeLowLimit(slider->rangeLowLimit()); setRangeHighLimit(slider->rangeHighLimit()); for (SceneValue scv : slider->levelChannels()) addLevelChannel(scv.fxi, scv.channel); /* Copy playback stuff */ setControlledFunction(slider->controlledFunction()); /* Copy slider appearance */ setValueDisplayStyle(slider->valueDisplayStyle()); setInvertedAppearance(slider->invertedAppearance()); /* Copy Click & Go feature */ setClickAndGoType(slider->clickAndGoType()); /* Copy mode & current value */ setSliderMode(slider->sliderMode()); setValue(slider->value(), false, false); /* Copy monitor mode */ setMonitorEnabled(slider->monitorEnabled()); /* Copy common stuff */ return VCWidget::copyFrom(widget); }
bool VCSlider::copyFrom(const VCWidget* widget) { const VCSlider* slider = qobject_cast<const VCSlider*> (widget); if (slider == NULL) return false; /* Copy widget style */ setWidgetStyle(slider->widgetStyle()); /* Copy level stuff */ setLevelLowLimit(slider->levelLowLimit()); setLevelHighLimit(slider->levelHighLimit()); m_levelChannels = slider->m_levelChannels; /* Copy playback stuff */ m_playbackFunction = slider->m_playbackFunction; /* Copy slider appearance */ setValueDisplayStyle(slider->valueDisplayStyle()); setInvertedAppearance(slider->invertedAppearance()); /* Copy Click & Go feature */ setClickAndGoType(slider->clickAndGoType()); /* Copy mode & current value */ setSliderMode(slider->sliderMode()); setSliderValue(slider->sliderValue()); /* Copy monitor mode */ setChannelsMonitorEnabled(slider->channelsMonitorEnabled()); /* Copy common stuff */ return VCWidget::copyFrom(widget); }
CommandTipReq::CommandTipReq(Container *parent, const DisplayableType *dt, bool ok, const string &msg) : CommandTipItem(parent, dt, msg) , m_reqMet(ok) { WidgetConfig &cfg = g_widgetConfig; setWidgetStyle(ok ? WidgetType::TOOLTIP_REQ_OK : WidgetType::TOOLTIP_REQ_NOK); TextWidget::setTextColour(Vec4ubToVec4f(cfg.getColour(m_textStyle.m_colourIndex))); if (m_textStyle.m_shadow) { StaticText::setShadow(Vec4ubToVec4f(cfg.getColour(m_textStyle.m_shadowColourIndex)), 1); } }
/** * 处理内容:UI初始化 * @param void * @return void */ void StatusBar::initUi() { // 创建窗体控件 createWidget(); // 创建布局 createLayout(); // 设置窗体风格(qss样式) setWidgetStyle(); }
void ColourPicker::init() { Anchors a = Anchors ::getFillAnchors(); setWidgetStyle(WidgetType::COLOUR_PICKER); m_showingItem = new ColourButton(this); m_showingItem->setCell(0); m_showingItem->setAnchors(a); m_button = new Button(this); m_button->setCell(1); m_button->setAnchors(a); m_button->Clicked.connect(this, &ColourPicker::onExpand); m_showingItem->Clicked.connect(this, &ColourPicker::onExpand); }
TickerTape::TickerTape(Container *parent, SizeHint anchor, Alignment alignment) : StaticText(parent) , m_anchor(anchor) , m_align(alignment) , m_startOffset(0.f) , m_endOffset(0.f) , m_transFunc(TransitionFunc::LINEAR) , m_alternateOrigin(false) , m_overlapTransitions(false) , m_displayInterval(240) , m_transitionInterval(120) , m_actionCounter(0) /*, m_currentIndex(-1)*/ { setWidgetStyle(WidgetType::TICKER_TAPE); }
PlayerSlotWidget::PlayerSlotWidget(Container* parent) : CellStrip(parent, Orientation::HORIZONTAL, Origin::CENTRE, 5) , m_freeSlot(false) { setWidgetStyle(WidgetType::STATIC_WIDGET); Anchors anchors(Anchor(AnchorType::RIGID, 3), Anchor(AnchorType::RIGID, 0)); //Anchors anchors(Anchor(AnchorType::RIGID, 0)); int hints[] = { 18, 33, 33, 8, 8 }; setPercentageHints(hints); m_label = new StaticText(this); m_label->setCell(0); m_label->setText("Player #"); m_label->setAnchors(anchors); m_controlList = new DropList(this); m_controlList->setCell(1); m_controlList->setAnchors(anchors); foreach_enum (ControlType, ct) { m_controlList->addItem(g_lang.get(ControlTypeNames[ct])); }
PlayerSlotLabels::PlayerSlotLabels(Container* parent) : CellStrip(parent, Orientation::HORIZONTAL, Origin::CENTRE, 5) { setWidgetStyle(WidgetType::STATIC_WIDGET); CoreData &coreData = CoreData::getInstance(); Anchors anchors(Anchor(AnchorType::RIGID, 0)); int hints[] = { 18, 33, 33, 8, 8 }; setPercentageHints(hints); StaticText *label = new StaticText(this); label->setCell(0); label->setText(g_lang.get("Player")); label->setShadow(Vec4f(0.f, 0.f, 0.f, 1.f)); label->setAnchors(anchors); label = new StaticText(this); label->setCell(1); label->setText(g_lang.get("Control")); label->setShadow(Vec4f(0.f, 0.f, 0.f, 1.f)); label->setAnchors(anchors); label = new StaticText(this); label->setCell(2); label->setText(g_lang.get("Faction")); label->setShadow(Vec4f(0.f, 0.f, 0.f, 1.f)); label->setAnchors(anchors); label = new StaticText(this); label->setCell(3); label->setText(g_lang.get("Team")); label->setShadow(Vec4f(0.f, 0.f, 0.f, 1.f)); label->setAnchors(anchors); label = new StaticText(this); label->setCell(4); label->setText(g_lang.get("Colour")); label->setShadow(Vec4f(0.f, 0.f, 0.f, 1.f)); label->setAnchors(anchors); }
/** * 处理内容:UI初始化 * @param void * @return void */ void MainWnd::initUi() { // 去除系统标题栏 #if defined(Q_OS_UNIX) || defined(Q_OS_LINUX) setWindowFlags(Qt::FramelessWindowHint/* | Qt::Dialog | Qt::WindowStaysOnBottomHint | Qt::X11BypassWindowManagerHint*/); #else setWindowFlags(Qt::FramelessWindowHint); #endif // 创建窗体控件 createWidget(); // 创建布局 createLayout(); // 设置窗体风格(qss样式) setWidgetStyle(); //设置窗体尺寸大小 setWidgetGeometry(); // 创建快捷方式 createDesktopLnk(); }
void CommandTipReq::setStyle() { setWidgetStyle(m_reqMet ? WidgetType::TOOLTIP_REQ_OK : WidgetType::TOOLTIP_REQ_NOK); }
CommandTip::CommandTip(Container *parent) : Container(parent) { setWidgetStyle(WidgetType::TOOLTIP); m_header = new CommandTipHeader(this); m_tip = new CommandTipMain(this); }
void KCMLookandFeel::save() { Plasma::Package package = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); package.setPath(m_selectedPlugin); if (!package.isValid()) { return; } m_configGroup.writeEntry("LookAndFeelPackage", m_selectedPlugin); if (!package.filePath("defaults").isEmpty()) { KSharedConfigPtr conf = KSharedConfig::openConfig(package.filePath("defaults")); KConfigGroup cg(conf, "kdeglobals"); cg = KConfigGroup(&cg, "KDE"); if (m_applyWidgetStyle) { setWidgetStyle(cg.readEntry("widgetStyle", QString())); } if (m_applyColors) { QString colorsFile = package.filePath("colors"); KConfigGroup cg(conf, "kdeglobals"); cg = KConfigGroup(&cg, "General"); QString colorScheme = cg.readEntry("ColorScheme", QString()); if (!colorsFile.isEmpty()) { if (!colorScheme.isEmpty()) { setColors(colorScheme, colorsFile); } else { setColors(package.metadata().name(), colorsFile); } } else if (!colorScheme.isEmpty()) { colorScheme.remove('\''); // So Foo's does not become FooS QRegExp fixer(QStringLiteral("[\\W,.-]+(.?)")); int offset; while ((offset = fixer.indexIn(colorScheme)) >= 0) { colorScheme.replace(offset, fixer.matchedLength(), fixer.cap(1).toUpper()); } colorScheme.replace(0, 1, colorScheme.at(0).toUpper()); QString src = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "color-schemes/" + colorScheme + ".colors"); setColors(colorScheme, src); } } if (m_applyIcons) { cg = KConfigGroup(conf, "kdeglobals"); cg = KConfigGroup(&cg, "Icons"); setIcons(cg.readEntry("Theme", QString())); } if (m_applyPlasmaTheme) { cg = KConfigGroup(conf, "plasmarc"); cg = KConfigGroup(&cg, "Theme"); setPlasmaTheme(cg.readEntry("name", QString())); } if (m_applyCursors) { cg = KConfigGroup(conf, "kcminputrc"); cg = KConfigGroup(&cg, "Mouse"); setCursorTheme(cg.readEntry("cursorTheme", QString())); } if (m_applyWindowSwitcher) { cg = KConfigGroup(conf, "kwinrc"); cg = KConfigGroup(&cg, "WindowSwitcher"); setWindowSwitcher(cg.readEntry("LayoutName", QString())); } if (m_applyDesktopSwitcher) { cg = KConfigGroup(conf, "kwinrc"); cg = KConfigGroup(&cg, "DesktopSwitcher"); setDesktopSwitcher(cg.readEntry("LayoutName", QString())); } } //TODO: option to enable/disable apply? they don't seem required by UI design setSplashScreen(m_selectedPlugin); setLockScreen(m_selectedPlugin); m_configGroup.sync(); runRdb(KRdbExportQtColors | KRdbExportGtkTheme | KRdbExportColors | KRdbExportQtSettings | KRdbExportXftSettings); }
void ColourButton::setStyle() { setWidgetStyle(WidgetType::COLOUR_BUTTON); m_backgroundStyle.setColour(g_widgetConfig.getColourIndex(m_colourBase)); m_borderStyle.setSolid(g_widgetConfig.getColourIndex(m_colourOutline)); }