void HueLight::updateStates(const QVariantMap &statesMap) { // color mode if (statesMap.value("colormode").toString() == "hs") { setColorMode(ColorModeHS); } else if (statesMap.value("colormode").toString() == "ct") { setColorMode(ColorModeCT); } else if (statesMap.value("colormode").toString() == "xy") { setColorMode(ColorModeXY); } // effect (none, colorloop) if (statesMap.value("effect").toString() == "none") { setEffect("none"); } else if (statesMap.value("effect").toString() == "colorloop") { setEffect("color loop"); } setReachable(statesMap.value("reachable").toBool()); // alert (none, select, lselect) setAlert(statesMap.value("alert").toString()); setBrigtness(statesMap.value("bri").toInt()); setCt(statesMap.value("ct").toInt()); setPower(statesMap.value("on").toBool()); setSat(statesMap.value("sat").toInt()); setHue(statesMap.value("hue").toInt()); if (!statesMap.value("xy").toList().isEmpty()) setXy(QPointF(statesMap.value("xy").toList().first().toFloat(), statesMap.value("xy").toList().last().toFloat())); emit stateChanged(); }
void PictureShape::loadStyle(const KoXmlElement& element, KoShapeLoadingContext& context) { // Load the common parts of the style. KoTosContainer::loadStyle(element, context); KoStyleStack &styleStack = context.odfLoadingContext().styleStack(); styleStack.setTypeProperties("graphic"); // Mirroring if (styleStack.hasProperty(KoXmlNS::style, "mirror")) { QString mirrorMode = styleStack.property(KoXmlNS::style, "mirror"); QFlags<PictureShape::MirrorMode> mode = 0; // Only one of the horizontal modes if (mirrorMode.contains("horizontal-on-even")) { mode |= MirrorHorizontalOnEven; } else if (mirrorMode.contains("horizontal-on-odd")) { mode |= MirrorHorizontalOnOdd; } else if (mirrorMode.contains("horizontal")) { mode |= MirrorHorizontal; } if (mirrorMode.contains("vertical")) { mode |= MirrorVertical; } m_mirrorMode = mode; } // Color-mode (effects) if (styleStack.hasProperty(KoXmlNS::draw, "color-mode")) { QString colorMode = styleStack.property(KoXmlNS::draw, "color-mode"); if (colorMode == "greyscale") { setColorMode(Greyscale); } else if (colorMode == "mono") { setColorMode(Mono); } else if (colorMode == "watermark") { setColorMode(Watermark); } } // image opacity QString opacity(styleStack.property(KoXmlNS::draw, "image-opacity")); if (! opacity.isEmpty() && opacity.right(1) == "%") { setTransparency(1.0 - (opacity.left(opacity.length() - 1).toFloat() / 100.0)); } // clip rect m_clippingRect = parseClippingRectString(styleStack.property(KoXmlNS::fo, "clip")); }
caTable::caTable(QWidget *parent) : QTableWidget(parent) { setPrecisionMode(Channel); setLimitsMode(Channel); setPrecision(0); setMinValue(0.0); setMaxValue(1.0); for(int i=0; i< MaxRows; i++) { setFormat(i, 1); for(int j=0; j< MaxCols; j++) tableItem[i][j] = (QTableWidgetItem*) 0; } thisItemFont = this->font(); setColorMode(Static); setAlternatingRowColors(true); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); setEditTriggers(QTableWidget::NoEditTriggers); verticalHeader()->setDefaultSectionSize(20); horizontalHeader()->setResizeMode(QHeaderView::Stretch); defaultForeColor = palette().foreground().color(); createActions(); addAction(copyAct); connect(this, SIGNAL( cellDoubleClicked (int, int) ), this, SLOT(celldoubleclicked( int, int ) ) ); //connect(this, SIGNAL( cellClicked (int, int) ), this, SLOT(cellclicked( int, int ) ) ); }
caChoice::caChoice(QWidget *parent) : QWidget(parent) { numCells = 2; labels << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9" << "10" << "11" << "12" << "13" << "14" << "15" << "16"; texts << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9" << "10" << "11" << "12" << "13" << "14" << "15" << "16"; signalMapper = new QSignalMapper(this); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); grid = new QGridLayout(this); grid->setMargin(0); grid->setSpacing(2); thisStacking = Row; thisStartBit = 0; thisEndBit = 15; thisColorMode = Default; thisForeColor = QColor(0,0,0); thisBackColor = QColor(155,255,255); thisBorderColor = QColor(0,0,176); thisAlignment = center; thisScaleMode = EPushButton::WidthAndHeight; setAccessW(true); installEventFilter(this); populateCells(labels, -1); setColorMode(thisColorMode); setElevation(on_top); }
int GLArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGLWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: updateMainWindowMenus(); break; case 1: transmitViewDir((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< vcg::Point3f(*)>(_a[2]))); break; case 2: transmitViewPos((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< vcg::Point3f(*)>(_a[2]))); break; case 3: transmitSurfacePos((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< vcg::Point3f(*)>(_a[2]))); break; case 4: transmitCameraPos((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< vcg::Point3f(*)>(_a[2]))); break; case 5: updateTexture(); break; case 6: setDrawMode((*reinterpret_cast< vcg::GLW::DrawMode(*)>(_a[1]))); break; case 7: setColorMode((*reinterpret_cast< vcg::GLW::ColorMode(*)>(_a[1]))); break; case 8: setTextureMode((*reinterpret_cast< vcg::GLW::TextureMode(*)>(_a[1]))); break; case 9: endEdit(); break; case 10: setSelectionRendering((*reinterpret_cast< bool(*)>(_a[1]))); break; case 11: suspendEditToggle(); break; case 12: setCurrentlyActiveLayer((*reinterpret_cast< int(*)>(_a[1]))); break; case 13: sendViewPos((*reinterpret_cast< QString(*)>(_a[1]))); break; case 14: sendSurfacePos((*reinterpret_cast< QString(*)>(_a[1]))); break; case 15: sendViewDir((*reinterpret_cast< QString(*)>(_a[1]))); break; case 16: sendCameraPos((*reinterpret_cast< QString(*)>(_a[1]))); break; default: ; } _id -= 17; } return _id; }
caLabel::caLabel(QWidget *parent) : ESimpleLabel(parent) { setFontScaleMode(WidthAndHeight); thisBackColor = Qt::gray; thisForeColor = Qt::black; thisBackColorOld = Qt::black; thisForeColorOld = Qt::black; thisColorMode=Static; oldColorMode =Static; setColorMode(Static); thisVisibility = StaticV; }
int caTable::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTableWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 1) qt_static_metacall(this, _c, _id, _a); _id -= 1; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = getPVS(); break; case 1: *reinterpret_cast< QString*>(_v) = getColumnSizes(); break; case 2: *reinterpret_cast< colMode*>(_v) = getColorMode(); break; case 3: *reinterpret_cast< int*>(_v) = getPrecision(); break; case 4: *reinterpret_cast< SourceMode*>(_v) = getPrecisionMode(); break; case 5: *reinterpret_cast< SourceMode*>(_v) = getLimitsMode(); break; case 6: *reinterpret_cast< double*>(_v) = getMaxValue(); break; case 7: *reinterpret_cast< double*>(_v) = getMinValue(); break; } _id -= 8; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setPVS(*reinterpret_cast< QString*>(_v)); break; case 1: setColumnSizes(*reinterpret_cast< QString*>(_v)); break; case 2: setColorMode(*reinterpret_cast< colMode*>(_v)); break; case 3: setPrecision(*reinterpret_cast< int*>(_v)); break; case 4: setPrecisionMode(*reinterpret_cast< SourceMode*>(_v)); break; case 5: setLimitsMode(*reinterpret_cast< SourceMode*>(_v)); break; case 6: setMaxValue(*reinterpret_cast< double*>(_v)); break; case 7: setMinValue(*reinterpret_cast< double*>(_v)); break; } _id -= 8; } else if (_c == QMetaObject::ResetProperty) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 8; } #endif // QT_NO_PROPERTIES return _id; }
void medVtkViewItkVectorFieldInteractor::setupParameters() { medDoubleParameter *scaleFactor = new medDoubleParameter("Scale", this); scaleFactor->setRange(0.001,10); scaleFactor->setValue(1.0); medIntParameter *sampleRateControl = new medIntParameter("Sample Rate", this); sampleRateControl->setRange(1,10); sampleRateControl->setValue(1); medStringListParameter *colorMode = new medStringListParameter("Color mode", this); colorMode->addItem("Vector Magnitude"); colorMode->addItem("Vector Direction"); colorMode->setValue("Vector Magnitude"); medBoolParameter *projection = new medBoolParameter("Projection", this); d->parameters.append(scaleFactor); d->parameters.append(sampleRateControl); d->parameters.append(colorMode); d->parameters.append(projection); connect(scaleFactor, SIGNAL(valueChanged(double)), this, SLOT(setScale(double))); connect(sampleRateControl,SIGNAL(valueChanged(int)),this,SLOT(setSampleRate(int))); connect(colorMode, SIGNAL(valueChanged(QString)), this, SLOT(setColorMode(QString))); connect(projection, SIGNAL(valueChanged(bool)), this, SLOT(setProjection(bool))); //TODO - should be done automaticly from vtkImageView - RDE // if(d->view->layer(d->data) == 0) // { // switch(d->view2d->GetSliceOrientation()) // { // case 0: // d->view->setOrientation(medImageView::VIEW_ORIENTATION_AXIAL); // break; // case 1: // d->view->setOrientation(medImageView::VIEW_ORIENTATION_CORONAL); // break; // case 2: // d->view->setOrientation(medImageView::VIEW_ORIENTATION_SAGITTAL); // break; // } // } connect(d->slicingParameter, SIGNAL(valueChanged(int)), this, SLOT(moveToSlice(int))); connect(d->view->positionBeingViewedParameter(), SIGNAL(valueChanged(QVector3D)), this, SLOT(updateSlicingParam())); connect(d->view, SIGNAL(orientationChanged()), this, SLOT(updatePlaneVisibility())); this->updateWidgets(); }
OSGMaterialStruct::OSGMaterialStruct(const mars::interfaces::MaterialData &mat) { setColorMode(osg::Material::OFF); setAmbient(osg::Material::FRONT, toOSGVec4(mat.ambientFront)); setAmbient(osg::Material::BACK, toOSGVec4(mat.ambientBack)); setSpecular(osg::Material::FRONT, toOSGVec4(mat.specularFront)); setSpecular(osg::Material::BACK, toOSGVec4(mat.specularBack)); setDiffuse(osg::Material::FRONT, toOSGVec4(mat.diffuseFront)); setDiffuse(osg::Material::BACK, toOSGVec4(mat.diffuseBack)); setEmission(osg::Material::FRONT, toOSGVec4(mat.emissionFront)); setEmission(osg::Material::BACK, toOSGVec4(mat.emissionBack)); setShininess(osg::Material::FRONT_AND_BACK, mat.shininess); setTransparency(osg::Material::FRONT_AND_BACK, mat.transparency); }
int caClock::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QwtAnalogClock::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = getPV(); break; case 1: *reinterpret_cast< timeType*>(_v) = getTimeType(); break; case 2: *reinterpret_cast< QColor*>(_v) = getBaseColor(); break; case 3: *reinterpret_cast< bool*>(_v) = getScaleDefaultColor(); break; case 4: *reinterpret_cast< QColor*>(_v) = getScaleColor(); break; case 5: *reinterpret_cast< colMode*>(_v) = getColorMode(); break; } _id -= 6; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setPV(*reinterpret_cast< QString*>(_v)); break; case 1: setTimeType(*reinterpret_cast< timeType*>(_v)); break; case 2: setBaseColor(*reinterpret_cast< QColor*>(_v)); break; case 3: setScaleDefaultColor(*reinterpret_cast< bool*>(_v)); break; case 4: setScaleColor(*reinterpret_cast< QColor*>(_v)); break; case 5: setColorMode(*reinterpret_cast< colMode*>(_v)); break; } _id -= 6; } else if (_c == QMetaObject::ResetProperty) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 6; } #endif // QT_NO_PROPERTIES return _id; }
//============================================================================== ArrowShape::ArrowShape(const Eigen::Vector3d& _tail, const Eigen::Vector3d& _head, const Properties& _properties, const Eigen::Vector4d& _color, std::size_t _resolution) : MeshShape(Eigen::Vector3d::Ones(), nullptr), mTail(_tail), mHead(_head), mProperties(_properties) { instantiate(_resolution); configureArrow(mTail, mHead, mProperties); setColorMode(MeshShape::COLOR_INDEX); notifyColorUpdated(_color); }
INT UEyeCamDriver::loadCamConfig(string filename) { if (!isConnected()) return IS_INVALID_CAMERA_HANDLE; INT is_err = IS_SUCCESS; // Convert filename to unicode, as requested by UEye API const wstring filenameU(filename.begin(), filename.end()); if ((is_err = is_ParameterSet(cam_handle_, IS_PARAMETERSET_CMD_LOAD_FILE, (void*) filenameU.c_str(), 0)) != IS_SUCCESS) { std::cerr << "Could not load UEye camera '" << cam_name_ << "' sensor parameters file " << filename << " (" << err2str(is_err) << ")" << std::endl; return is_err; } else { // Update the AOI and bits per pixel if ((is_err = is_AOI(cam_handle_, IS_AOI_IMAGE_GET_AOI, (void*) &cam_aoi_, sizeof(cam_aoi_))) != IS_SUCCESS) { std::cerr << "Could not retrieve Area Of Interest from UEye camera '" << cam_name_ << "' (" << err2str(is_err) << ")" << std::endl; return is_err; } INT colorMode = is_SetColorMode(cam_handle_, IS_GET_COLOR_MODE); if (colorMode == IS_CM_BGR8_PACKED || colorMode == IS_CM_RGB8_PACKED) { bits_per_pixel_ = 24; } else if (colorMode == IS_CM_MONO8 || colorMode == IS_CM_SENSOR_RAW8) { bits_per_pixel_ = 8; } else { std::cerr << "Current camera color mode is not supported by this wrapper;" << "supported modes: {MONO8 | RGB8 | BAYER_RGGB8}; switching to RGB8 (24-bit)" << std::endl; if ((is_err = setColorMode("rgb8", false)) != IS_SUCCESS) return is_err; } reallocateCamBuffer(); std::cout << "Successfully loaded UEye camera '" << cam_name_ << "'s sensor parameter file: " << filename << std::endl; } return is_err; }
void QPrinter::interpret(PMPrintSettings *s) { //get values UInt32 from, to; if (PMGetFirstPage(*s, &from) == noErr && PMGetLastPage(*s, &to) == noErr) { if (to == INT_MAX) //this means all pages! from = to = 0; setFromTo(from, to); } UInt32 copies; if (PMGetCopies(*s, &copies) == noErr) setNumCopies(copies); UInt32 max, min; if (PMGetPageRange(*s, &min, &max) == noErr) { // The problem here is that Apple's print dialog will always show a one even when you pass // it a zero. So take care of that. The other problem is that we can also call this because // we need to interpret the default settings, in that case, the min and max will both be // zero. In that case, leave them "as is" as some other functions will reset the max and // make everything OK when the dialog is actually called. int newMin = min; int newMax = max; if (newMin < 1 && newMax != 0) newMin = 1; setMinMax(newMin, newMax); } PMColorMode cm; if (PMGetColorMode(*s, &cm) == noErr) setColorMode(cm == kPMGray ? GrayScale : Color); // Get the current Printer Name CFIndex currPrinterIndex; PMPrinter currPrinter; CFArrayRef printerArray; OSStatus err = PMSessionCreatePrinterList(psession, &printerArray, &currPrinterIndex, &currPrinter); if (err != noErr) qWarning("Qt: QPrinter::interpret problem creating printer list %ld", err); if (printerArray) { setPrinterName(cfstring2qstring((CFStringRef)CFArrayGetValueAtIndex(printerArray, currPrinterIndex))); CFRelease(printerArray); } }
bool Filter::loadParameters(QSettings &s) { QString colorModeStr, affectedChannelStr; int colorMode; QStringList affectedChannelList; bool affectedChannel[5] = { false }; int threshold[5] = { 128 }; bool ok; colorModeStr = s.value("colormode", "luma").toString(); if (colorModeStr == "luma") colorMode = 0; else if (colorModeStr == "rgb") colorMode = 1; else return false; affectedChannelStr = s.value("affectedchannels", "").toString(); affectedChannelList = affectedChannelStr.split(" ", QString::SkipEmptyParts); for (int i = 0; i < affectedChannelList.size(); i++) { affectedChannelStr = affectedChannelList.at(i); if (affectedChannelList.at(i) == "luma") affectedChannel[0] = true; else if (affectedChannelList.at(i) == "red") affectedChannel[1] = true; else if (affectedChannelList.at(i) == "green") affectedChannel[2] = true; else if (affectedChannelList.at(i) == "blue") affectedChannel[3] = true; else if (affectedChannelList.at(i) == "alpha") affectedChannel[4] = true; else return false; } threshold[0] = s.value("lumathreshold", 128).toInt(&ok); if (!ok || threshold[0] < 0 || threshold[0] > 255) return false; threshold[1] = s.value("redthreshold", 128).toInt(&ok); if (!ok || threshold[1] < 0 || threshold[1] > 255) return false; threshold[2] = s.value("greenthreshold", 128).toInt(&ok); if (!ok || threshold[2] < 0 || threshold[2] > 255) return false; threshold[3] = s.value("bluethreshold", 128).toInt(&ok); if (!ok || threshold[3] < 0 || threshold[3] > 255) return false; threshold[4] = s.value("alphathreshold", 128).toInt(&ok); if (!ok || threshold[4] < 0 || threshold[4] > 255) return false; setColorMode(colorMode); for (int i = 0; i < 5; i++) { setAffectedChannel(i, affectedChannel[i]); setThreshold(i, threshold[i]); } return true; }
ParticleSystem::ParticleSystem(int cMode) { curIndex = 0; colorMode = cMode; setColorMode(cMode); }
caLineEdit::caLineEdit(QWidget *parent) : QLineEdit(parent), FontScalingWidget(this) { // we want this font, while nice and monospace QFont font("Lucida Sans Typewriter"); // if this font does not exist then try a next one QFontInfo info(font); //font.setStyleStrategy(QFont::NoAntialias); QString family = info.family(); //printf("got font %s\n", qasc(family)); if(!family.contains("Lucida Sans Typewriter")) { QFont newfont("Monospace"); // not very nice, while a a dot inside the zero to distinguish from o newfont.setStyleHint(QFont::TypeWriter); setFont(newfont); } else { setFont(font); } isShown = false; oldStyle = ""; thisStyle = ""; setColorMode(Default); setAlarmHandling(onForeground); thisFormatC[0] = '\0'; setUnitsEnabled(false); thisBackColor = Qt::gray; thisForeColor = Qt::black; oldBackColor = Qt::black; oldForeColor = Qt::gray; thisFrameColor = Qt::black; oldFrameColor = Qt::gray; thisFramePresent = false; thisFrameLineWidth = 0; oldFrameLineWidth = 0; Alarm = 0; // default colors will be defined in my event handler by taking them from the palette defined by stylesheet definitions //defBackColor = QColor(255, 248, 220, 255); //defForeColor = Qt::black; defSelectColor = Qt::red; // this does not appear in the palette setPrecisionMode(Channel); setLimitsMode(Channel); setPrecision(0); setFormatType(decimal); setFormat(0); setMinValue(0.0); setMaxValue(1.0); setFrame(false); keepText = ""; unitsLast = ""; setTextLine(keepText); setValueType(false); setFontScaleModeL(WidthAndHeight); newFocusPolicy(Qt::NoFocus); d_rescaleFontOnTextChanged = true; installEventFilter(this); }