void caGraphics::setAlarmColors(short status) { switch (status) { case NO_ALARM: setForeground(AL_GREEN); setLineColor(AL_GREEN); break; case MINOR_ALARM: setForeground(AL_YELLOW); setLineColor(AL_YELLOW); break; case MAJOR_ALARM: setForeground(AL_RED); setLineColor(AL_RED); break; case INVALID_ALARM: case NOTCONNECTED: setForeground(AL_WHITE); setLineColor(AL_WHITE); break; default: setForeground(AL_DEFAULT); setLineColor(AL_DEFAULT); break; } }
void Checker::updateModelAxesChecker (const DocumentModelAxesChecker &modelAxesChecker) { QColor color = ColorPaletteToQColor (modelAxesChecker.lineColor()); QPen pen (QBrush (color), CHECKER_POINTS_WIDTH); setLineColor (m_sideLeft, pen); setLineColor (m_sideTop, pen); setLineColor (m_sideRight, pen); setLineColor (m_sideBottom, pen); }
DialogColor::DialogColor(QWidget *parent) : QDialog(parent), ui_color(new Ui::DialogColor) { ui_color->setupUi(this); connect(ui_color->backgroundColor, SIGNAL(clicked()),this, SLOT(setBackgroundColor())); connect(ui_color->lineColor, SIGNAL(clicked()),this, SLOT(setLineColor())); connect(ui_color->set, SIGNAL(clicked()),this, SLOT(dialogColorSet())); connect(ui_color->cancel, SIGNAL(clicked()),this,SLOT(dialogColorCancel())); conf = new QSettings(QSettings::NativeFormat, QSettings::UserScope, "AE_analysis", "CMiR"); _backgroundColor = conf->value("color/backgroundColor").value<QColor>(); _lineColor = conf->value("color/lineColor").value<QColor>(); ui_color->widget->setBackground(_backgroundColor); ui_color->widget->xAxis->setVisible(false); ui_color->widget->yAxis->setVisible(false); ui_color->widget->axisRect()->setAutoMargins(QCP::msNone); ui_color->widget->axisRect()->setMargins(QMargins(0,0,0,0)); QVector <double> x(100), y(100); for (int i=0; i<100; i++) { x[i]=rand()%100; y[i]=rand()%100; } ui_color->widget->addGraph(); ui_color->widget->graph(0)->setLineStyle(QCPGraph::lsNone); ui_color->widget->graph(0)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 2)); ui_color->widget->graph(0)->setData(x,y); ui_color->widget->graph(0)->setPen(_lineColor); ui_color->widget->xAxis->setRange(0, 100); ui_color->widget->yAxis->setRange(0, 100); ui_color->widget->replot(); }
//-------------------------------------------------------------- void testApp::draw(){ centroid = center; cam.setPosition(ofVec3f(0, 0, -centroid.z)); cam.lookAt(centroid, ofVec3f(0,1,0)); cam.setFarClip(50000); cam.begin(); ofPushMatrix(); ofTranslate(camPosX, camPosY, camZoom); if(bTop){ pivot(centroid, 100, 0, 0); } else{ pivot(centroid, camRotX, camRotY, 0); } ofScale(-1.0, 1.0, 1.0); drawAxes(centroid, refPoint); ofPushStyle(); //------------------------- for(int i = 0; i < K; i++) kinects[i].draw(); if(bCalibrated && bTracking){ for(int i = 0; i < N; i++) trackers[i].draw(); for(int i = 0; i < N - 1; i++) for(int j = 1; j < N; j++){ setLineColor(i + j); ofLine(trackers[i].lerpedPos, trackers[j].lerpedPos); } //------------------------- ofEnableAlphaBlending(); ofSetColor(255, 0, 0, 50); ofFill(); ofBeginShape(); for(int i = 0; i < N; i++) ofVertex(trackers[i].lerpedPos); ofEndShape(); ofDisableAlphaBlending(); //------------------------- } ofPopStyle(); ofPopMatrix(); cam.end(); gui.draw(); }
/** * Sets the line color used by the line. * * @param viewID The id of the object behind the widget. */ void LinePath::slotLineColorChanged( Uml::IDType viewID ) { if(m_pAssociation->umlScene()->getID() != viewID) { return; } setLineColor( m_pAssociation->umlScene()->getLineColor() ); }
void shaderSetup1( void ) { // Load shaders and use the resulting shader program program = InitShader( "vshader1.glsl", "fshader1.glsl" ); glUseProgram( program ); // Initialize the vertex position attribute from the vertex shader GLuint vPosition = glGetAttribLocation( program, "vPosition" ); glEnableVertexAttribArray( vPosition ); glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) ); glClearColor( 1.0, 1.0, 1.0, 1.0 ); // sets white as color used to clear screen // Setting world window shit ProjLoc = glGetUniformLocation(program, "Proj"); // Default model matrix GLuint modelMatrix = glGetUniformLocationARB(program, "model_matrix"); glUniformMatrix4fv( modelMatrix, 1, GL_FALSE, mat4(1) ); // Default color setLineColor(RED_VEC); }
void DisplayModulo::drawSplashScreen() { setFillColor(.27,0,.24); setLineColor(0,0,0); drawRect(0, 0, width(), height()); setCursor(0, 40); setTextSize(1); setTextColor(1,1,1); print(" MODULO"); setLineColor(0,0,0,0); setFillColor(1,1,1); drawLogo(width()/2-18, 10, 35, 26); }
void KivioStencilFormatDlg::slotDefault() { setLineWidth(1.0, m_unit); setLineColor(QColor(0, 0, 0)); setLinePattern(1); setFillColor(QColor(255, 255, 255)); setFillPattern(1); }
EArrow::EArrow( QWidget *parent ) : QWidget( parent ) { setLineSize( 2 ); setArrowSize(10); setLineColor(Qt::black); setBrushColor(Qt::gray); setArrowMode(RIGTH); setArrowDirection(HORIZONTAL); }
/** * Constructs a BoxWidget. * * @param scene The parent to this widget. * @param id The ID to assign (-1 will prompt a new ID.) * @param type The WidgetType (wt_Box.) */ BoxWidget::BoxWidget(UMLScene * scene, Uml::ID::Type id, WidgetType type) : UMLWidget(scene, type, id) { setSize(100, 80); m_usesDiagramLineColor = false; // boxes be black setLineColor(QColor("black")); setZValue(-10); }
Zone::Zone(QGraphicsItem *parent) : MapItem(parent) { // Set parameters width = 501; height = 512; setLineColor(QColor(Qt::white)); setFillColor(QColor(Qt::white)); }
/** * Show a properties dialog for a BoxWidget. */ void BoxWidget::showPropertiesDialog() { QColor newColor = QColorDialog::getColor(lineColor()); // krazy:exclude=qclasses if (newColor != lineColor()) { setLineColor(newColor); setUsesDiagramLineColor(false); umlDoc()->setModified(true); } }
void CPetText::setup() { for (int idx = 0; idx < (int)_array.size(); ++idx) { _array[idx]._line.clear(); setLineColor(idx, _textR, _textG, _textB); _array[idx]._string3.clear(); } _lineCount = 0; _stringsMerged = false; }
rectangle::rectangle( QWidget *parent ) : QWidget( parent ) { m_value = 0; QSizePolicy policy( QSizePolicy::Expanding, QSizePolicy::Expanding); policy.setHeightForWidth( true ); setSizePolicy( policy ); setLineSize(1); setLineColor(Qt::black); writeFG(Qt::red); writeBG(Qt::gray); }
Shape::Shape() : QGraphicsRectItem() { setShapeName( "Shape" ); setText( "Some Text" ); setTextColor( QColor::fromHsv(rand()%256,255,190) ); setText( "Some Text" ); setTextColor( QColor::fromHsv(rand()%256,255,190) ); setLineColor( QColor::fromHsv(rand()%256,255,190) ); setFillColor( QColor::fromHsv(rand()%256,255,190) ); setScenePosition( QPointF(100,100) ); setGeometry( QRectF(-100,-50,200,100) ); }
RectangleAnnotation::RectangleAnnotation(Component *pParent) : ShapeAnnotation(pParent) { // set the default values GraphicItem::setDefaults(); FilledShape::setDefaults(); ShapeAnnotation::setDefaults(); // create a grey rectangle setLineColor(QColor(0, 0, 0)); setFillColor(QColor(240, 240, 240)); setFillPattern(StringHandler::FillSolid); QList<QPointF> extents; extents << QPointF(-100, -100) << QPointF(100, 100); setExtents(extents); setPos(mOrigin); setRotation(mRotation); }
DrawingPad::DrawingPad(QWidget *parent) : QWidget(parent) , m_shapeType(Shape::TYPE_FREEHAND) { setAutoFillBackground(true); setPalette(Qt::white); FreeHandMaker *freeHandMaker = new FreeHandMaker(); RectangleMaker *rectangleMaker = new RectangleMaker(); m_shapeMakerMap[Shape::TYPE_FREEHAND] = freeHandMaker; m_shapeMakerMap[Shape::TYPE_RECTANGLE] = rectangleMaker; connect(freeHandMaker,SIGNAL(newShapeAvailable()),this,SLOT(newShapeAvailable())); connect(rectangleMaker,SIGNAL(newShapeAvailable()),this,SLOT(newShapeAvailable())); setLineColor(Qt::black); setLineWidth(0); }
ProgramState::ProgramState() { setGrabInput(true); setDrawLinesFG(true); setDataPrefix("./data/"); setDevFmt(AUDIO_S16); show_have_state=true; force_load=false; autoname.assign("autosave"); autosave=true; autotime=180; autotick=0; //must be zero setWSxmax(2000); setWSymax(2000); setWSxmin(0); setWSymin(0); scroll_speed=18; grid_color.r = 140; grid_color.g = 140; grid_color.b = 140; draw_grid=true; grid_spc=1280/(double)2; bg_color.r=128; bg_color.g=128; bg_color.b=128; setDevNSmp(1024); wavdump=NULL; dumplen=0; setDumpName("unnamed"); //setPrefix("./"); setPostfix(".kwf"); run=true; showfps=false; setSamplePath(string("./")); setSampleGenLen(1024); setSampleGenBuffer(4); statetickall=0; ison=false; //buffsamp=3; samplefreq=44100; fancy_lines=true; draw_line_tension=10.0; draw_line_settle=true; setLineColor(0,255,0); line_w=2; fps=50; //showdumpsec=true; def_graph_color.r=47; def_graph_color.g=243; def_graph_color.b=255; setCurrentLoadVersion(FILEFORMAT_VERSION); show_stats=false; setPlayOnDevice(true); }
ShapePropertiesDialog::ShapePropertiesDialog(ShapeAnnotation *pShapeAnnotation, MainWindow *pMainWindow) : QDialog(pMainWindow, Qt::WindowTitleHint) { mpShapeAnnotation = pShapeAnnotation; mOldAnnotation = ""; mpLineAnnotation = dynamic_cast<LineAnnotation*>(mpShapeAnnotation); mpPolygonAnnotation = dynamic_cast<PolygonAnnotation*>(mpShapeAnnotation); mpRectangleAnnotation = dynamic_cast<RectangleAnnotation*>(mpShapeAnnotation); mpEllipseAnnotation = dynamic_cast<EllipseAnnotation*>(mpShapeAnnotation); mpTextAnnotation = dynamic_cast<TextAnnotation*>(mpShapeAnnotation); mpBitmapAnnotation = dynamic_cast<BitmapAnnotation*>(mpShapeAnnotation); mpMainWindow = pMainWindow; QString title = getTitle(); setWindowTitle(QString(Helper::applicationName).append(" - ").append(title).append(" ").append(Helper::properties)); setAttribute(Qt::WA_DeleteOnClose); // heading label mpShapePropertiesHeading = new Label(QString(title).append(" ").append(Helper::properties)); mpShapePropertiesHeading->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize)); mpShapePropertiesHeading->setAlignment(Qt::AlignTop); // set separator line mHorizontalLine = new QFrame(); mHorizontalLine->setFrameShape(QFrame::HLine); mHorizontalLine->setFrameShadow(QFrame::Sunken); // Transformations Group Box mpTransformationGroupBox = new QGroupBox(tr("Transformation")); mpOriginXLabel = new Label(Helper::originX); mpOriginXSpinBox = new DoubleSpinBox; mpOriginXSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpOriginXSpinBox->setValue(mpShapeAnnotation->getOrigin().x()); mpOriginXSpinBox->setSingleStep(1); mpOriginYLabel = new Label(Helper::originY); mpOriginYSpinBox = new DoubleSpinBox; mpOriginYSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpOriginYSpinBox->setValue(mpShapeAnnotation->getOrigin().y()); mpOriginYSpinBox->setSingleStep(1); mpRotationLabel = new Label(Helper::rotation); mpRotationSpinBox = new DoubleSpinBox; mpRotationSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpRotationSpinBox->setValue(mpShapeAnnotation->getRotation()); mpRotationSpinBox->setSingleStep(90); // set the Transformations Group Box layout QGridLayout *pTransformationGridLayout = new QGridLayout; pTransformationGridLayout->setColumnStretch(1, 1); pTransformationGridLayout->setColumnStretch(3, 1); pTransformationGridLayout->setColumnStretch(5, 1); pTransformationGridLayout->addWidget(mpOriginXLabel, 0, 0); pTransformationGridLayout->addWidget(mpOriginXSpinBox, 0, 1); pTransformationGridLayout->addWidget(mpOriginYLabel, 0, 2); pTransformationGridLayout->addWidget(mpOriginYSpinBox, 0, 3); pTransformationGridLayout->addWidget(mpRotationLabel, 0, 4); pTransformationGridLayout->addWidget(mpRotationSpinBox, 0, 5); mpTransformationGroupBox->setLayout(pTransformationGridLayout); // Extent Group Box mpExtentGroupBox = new QGroupBox(Helper::extent); // Extent1X QList<QPointF> extents = mpShapeAnnotation->getExtents(); mpExtent1XLabel = new Label(Helper::extent1X); mpExtent1XSpinBox = new DoubleSpinBox; mpExtent1XSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpExtent1XSpinBox->setValue(extents.size() > 0 ? extents.at(0).x() : 0); mpExtent1XSpinBox->setSingleStep(10); mpExtent1YLabel = new Label(Helper::extent1Y); mpExtent1YSpinBox = new DoubleSpinBox; mpExtent1YSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpExtent1YSpinBox->setValue(extents.size() > 0 ? extents.at(0).y() : 0); mpExtent1YSpinBox->setSingleStep(10); mpExtent2XLabel = new Label(Helper::extent2X); mpExtent2XSpinBox = new DoubleSpinBox; mpExtent2XSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpExtent2XSpinBox->setValue(extents.size() > 0 ? extents.at(1).x() : 0); mpExtent2XSpinBox->setSingleStep(10); mpExtent2YLabel = new Label(Helper::extent2Y); mpExtent2YSpinBox = new DoubleSpinBox; mpExtent2YSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpExtent2YSpinBox->setValue(extents.size() > 0 ? extents.at(1).y() : 0); mpExtent2YSpinBox->setSingleStep(10); // set the extents Group Box layout QGridLayout *pExtentGroupBoxLayout = new QGridLayout; pExtentGroupBoxLayout->setColumnStretch(1, 1); pExtentGroupBoxLayout->setColumnStretch(3, 1); pExtentGroupBoxLayout->addWidget(mpExtent1XLabel, 0, 0); pExtentGroupBoxLayout->addWidget(mpExtent1XSpinBox, 0, 1); pExtentGroupBoxLayout->addWidget(mpExtent1YLabel, 0, 2); pExtentGroupBoxLayout->addWidget(mpExtent1YSpinBox, 0, 3); pExtentGroupBoxLayout->addWidget(mpExtent2XLabel, 1, 0); pExtentGroupBoxLayout->addWidget(mpExtent2XSpinBox, 1, 1); pExtentGroupBoxLayout->addWidget(mpExtent2YLabel, 1, 2); pExtentGroupBoxLayout->addWidget(mpExtent2YSpinBox, 1, 3); mpExtentGroupBox->setLayout(pExtentGroupBoxLayout); // Border style Group Box mpBorderStyleGroupBox = new QGroupBox(tr("Border Style")); // border pattern mpBorderPatternLabel = new Label(Helper::pattern); mpBorderPatternComboBox = new QComboBox; mpBorderPatternComboBox->addItem(StringHandler::getBorderPatternString(StringHandler::BorderNone)); mpBorderPatternComboBox->addItem(StringHandler::getBorderPatternString(StringHandler::BorderRaised)); mpBorderPatternComboBox->addItem(StringHandler::getBorderPatternString(StringHandler::BorderSunken)); mpBorderPatternComboBox->addItem(StringHandler::getBorderPatternString(StringHandler::BorderEngraved)); int currentIndex = mpBorderPatternComboBox->findText(StringHandler::getBorderPatternString( mpShapeAnnotation->getBorderPattern()), Qt::MatchExactly); if (currentIndex > -1) { mpBorderPatternComboBox->setCurrentIndex(currentIndex); } // radius mpRadiusLabel = new Label(Helper::radius); mpRadiusSpinBox = new DoubleSpinBox; mpRadiusSpinBox->setRange(0, std::numeric_limits<double>::max()); mpRadiusSpinBox->setValue(mpShapeAnnotation->getRadius()); mpRadiusSpinBox->setSingleStep(1); // set the border style Group Box layout QGridLayout *pBorderStyleGridLayout = new QGridLayout; pBorderStyleGridLayout->setColumnStretch(1, 1); pBorderStyleGridLayout->setColumnStretch(3, 1); pBorderStyleGridLayout->addWidget(mpBorderPatternLabel, 0, 0); pBorderStyleGridLayout->addWidget(mpBorderPatternComboBox, 0, 1); pBorderStyleGridLayout->addWidget(mpRadiusLabel, 0, 2); pBorderStyleGridLayout->addWidget(mpRadiusSpinBox, 0, 3); mpBorderStyleGroupBox->setLayout(pBorderStyleGridLayout); // Angle Group Box mpAngleGroupBox = new QGroupBox(tr("Angle")); // start angle mpStartAngleLabel = new Label(Helper::startAngle); mpStartAngleSpinBox = new DoubleSpinBox; mpStartAngleSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpStartAngleSpinBox->setValue(mpShapeAnnotation->getStartAngle()); mpStartAngleSpinBox->setSingleStep(90); // end angle mpEndAngleLabel = new Label(Helper::endAngle); mpEndAngleSpinBox = new DoubleSpinBox; mpEndAngleSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); mpEndAngleSpinBox->setValue(mpShapeAnnotation->getEndAngle()); mpEndAngleSpinBox->setSingleStep(90); // set the border style Group Box layout QGridLayout *pAngleGridLayout = new QGridLayout; pAngleGridLayout->setColumnStretch(1, 1); pAngleGridLayout->setColumnStretch(3, 1); pAngleGridLayout->addWidget(mpStartAngleLabel, 0, 0); pAngleGridLayout->addWidget(mpStartAngleSpinBox, 0, 1); pAngleGridLayout->addWidget(mpEndAngleLabel, 0, 2); pAngleGridLayout->addWidget(mpEndAngleSpinBox, 0, 3); mpAngleGroupBox->setLayout(pAngleGridLayout); // Text Group Box mpTextGroupBox = new QGroupBox(tr("Text")); mpTextTextBox = new QLineEdit(mpShapeAnnotation->getTextString()); // set the Text Group Box layout QHBoxLayout *pTextGroupBoxLayout = new QHBoxLayout; pTextGroupBoxLayout->addWidget(mpTextTextBox); mpTextGroupBox->setLayout(pTextGroupBoxLayout); // Font Style Group Box mpFontAndTextStyleGroupBox = new QGroupBox(tr("Font && Text Style")); mpFontNameLabel = new Label(Helper::name); mpFontNameComboBox = new QFontComboBox; mpFontNameComboBox->insertItem(0, "Default"); currentIndex = mpFontNameComboBox->findText(mpShapeAnnotation->getFontName(), Qt::MatchExactly); if (currentIndex > -1) { mpFontNameComboBox->setCurrentIndex(currentIndex); } else { mpFontNameComboBox->setCurrentIndex(0); } mpFontSizeLabel = new Label(Helper::size); mpFontSizeSpinBox = new DoubleSpinBox; mpFontSizeSpinBox->setRange(0, std::numeric_limits<double>::max()); mpFontSizeSpinBox->setValue(mpShapeAnnotation->getFontSize()); mpFontSizeSpinBox->setSingleStep(1); mpFontStyleLabel = new Label(tr("Style:")); mpTextBoldCheckBox = new QCheckBox(tr("Bold")); mpTextBoldCheckBox->setChecked(StringHandler::getFontWeight(mpShapeAnnotation->getTextStyles()) == QFont::Bold ? true : false); mpTextItalicCheckBox = new QCheckBox(tr("Italic")); mpTextItalicCheckBox->setChecked(StringHandler::getFontItalic(mpShapeAnnotation->getTextStyles())); mpTextUnderlineCheckBox = new QCheckBox(tr("Underline")); mpTextUnderlineCheckBox->setChecked(StringHandler::getFontUnderline(mpShapeAnnotation->getTextStyles())); mpTextHorizontalAlignmentLabel = new Label(tr("Horizontal Alignment:")); mpTextHorizontalAlignmentComboBox = new QComboBox; mpTextHorizontalAlignmentComboBox->addItem(StringHandler::getTextAlignmentString(StringHandler::TextAlignmentLeft)); mpTextHorizontalAlignmentComboBox->addItem(StringHandler::getTextAlignmentString(StringHandler::TextAlignmentCenter)); mpTextHorizontalAlignmentComboBox->addItem(StringHandler::getTextAlignmentString(StringHandler::TextAlignmentRight)); currentIndex = mpTextHorizontalAlignmentComboBox->findText(StringHandler::getTextAlignmentString( mpShapeAnnotation->getTextHorizontalAlignment()), Qt::MatchExactly); if (currentIndex > -1) { mpTextHorizontalAlignmentComboBox->setCurrentIndex(currentIndex); } // set the Font Style Group Box layout QGridLayout *pFontAndTextStyleGroupBox = new QGridLayout; pFontAndTextStyleGroupBox->setColumnStretch(5, 1); pFontAndTextStyleGroupBox->addWidget(mpFontNameLabel, 0, 0); pFontAndTextStyleGroupBox->addWidget(mpFontNameComboBox, 0, 1, 1, 3); pFontAndTextStyleGroupBox->addWidget(mpFontSizeLabel, 0, 4); pFontAndTextStyleGroupBox->addWidget(mpFontSizeSpinBox, 0, 5); pFontAndTextStyleGroupBox->addWidget(mpFontStyleLabel, 1, 0); pFontAndTextStyleGroupBox->addWidget(mpTextBoldCheckBox, 1, 1); pFontAndTextStyleGroupBox->addWidget(mpTextItalicCheckBox, 1, 2); pFontAndTextStyleGroupBox->addWidget(mpTextUnderlineCheckBox, 1, 3); pFontAndTextStyleGroupBox->addWidget(mpTextHorizontalAlignmentLabel, 1, 4); pFontAndTextStyleGroupBox->addWidget(mpTextHorizontalAlignmentComboBox, 1, 5); mpFontAndTextStyleGroupBox->setLayout(pFontAndTextStyleGroupBox); // Line style Group Box mpLineStyleGroupBox = new QGroupBox(Helper::lineStyle); // Line Color mpLineColorLabel = new Label(Helper::color); mpLinePickColorButton = new QPushButton(Helper::pickColor); mpLinePickColorButton->setAutoDefault(false); connect(mpLinePickColorButton, SIGNAL(clicked()), SLOT(linePickColor())); setLineColor(mpShapeAnnotation->getLineColor()); setLinePickColorButtonIcon(); // Line Pattern mpLinePatternLabel = new Label(Helper::pattern); mpLinePatternComboBox = StringHandler::getLinePatternComboBox(); currentIndex = mpLinePatternComboBox->findText(StringHandler::getLinePatternString(mpShapeAnnotation->getLinePattern()), Qt::MatchExactly); if (currentIndex > -1) { mpLinePatternComboBox->setCurrentIndex(currentIndex); } // Line Thickness mpLineThicknessLabel = new Label(Helper::thickness); mpLineThicknessSpinBox = new DoubleSpinBox; mpLineThicknessSpinBox->setRange(0, std::numeric_limits<double>::max()); mpLineThicknessSpinBox->setValue(mpShapeAnnotation->getLineThickness()); mpLineThicknessSpinBox->setSingleStep(0.25); // Line smooth mpLineSmoothLabel = new Label(Helper::smooth); mpLineSmoothCheckBox = new QCheckBox(Helper::bezier); if (mpShapeAnnotation->getSmooth() == StringHandler::SmoothBezier) { mpLineSmoothCheckBox->setChecked(true); } // set the Line style Group Box layout QGridLayout *pLineStyleGroupBoxLayout = new QGridLayout; pLineStyleGroupBoxLayout->setAlignment(Qt::AlignTop); pLineStyleGroupBoxLayout->setColumnStretch(1, 1); pLineStyleGroupBoxLayout->addWidget(mpLineColorLabel, 0, 0); pLineStyleGroupBoxLayout->addWidget(mpLinePickColorButton, 0, 1); pLineStyleGroupBoxLayout->addWidget(mpLinePatternLabel, 1, 0); pLineStyleGroupBoxLayout->addWidget(mpLinePatternComboBox, 1, 1); pLineStyleGroupBoxLayout->addWidget(mpLineThicknessLabel, 2, 0); pLineStyleGroupBoxLayout->addWidget(mpLineThicknessSpinBox, 2, 1); if (mpLineAnnotation || mpPolygonAnnotation) { pLineStyleGroupBoxLayout->addWidget(mpLineSmoothLabel, 3, 0); pLineStyleGroupBoxLayout->addWidget(mpLineSmoothCheckBox, 3, 1); } mpLineStyleGroupBox->setLayout(pLineStyleGroupBoxLayout); // Arrow style Group Box mpArrowStyleGroupBox = new QGroupBox(tr("Arrow Style")); // Start Arrow mpLineStartArrowLabel = new Label(Helper::startArrow); mpLineStartArrowComboBox = StringHandler::getStartArrowComboBox(); currentIndex = mpLineStartArrowComboBox->findText(StringHandler::getArrowString(mpShapeAnnotation->getStartArrow()), Qt::MatchExactly); if (currentIndex > -1) { mpLineStartArrowComboBox->setCurrentIndex(currentIndex); } mpLineEndArrowLabel = new Label(Helper::endArrow); mpLineEndArrowComboBox = StringHandler::getEndArrowComboBox(); currentIndex = mpLineEndArrowComboBox->findText(StringHandler::getArrowString(mpShapeAnnotation->getEndArrow()), Qt::MatchExactly); if (currentIndex > -1) { mpLineEndArrowComboBox->setCurrentIndex(currentIndex); } mpLineArrowSizeLabel = new Label(Helper::arrowSize); mpLineArrowSizeSpinBox = new DoubleSpinBox; mpLineArrowSizeSpinBox->setRange(0, std::numeric_limits<double>::max()); mpLineArrowSizeSpinBox->setValue(mpShapeAnnotation->getArrowSize()); mpLineArrowSizeSpinBox->setSingleStep(1); // set the Arrow style Group Box layout QGridLayout *pArrowStyleGroupBoxLayout = new QGridLayout; pArrowStyleGroupBoxLayout->setAlignment(Qt::AlignTop); pArrowStyleGroupBoxLayout->setColumnStretch(1, 1); pArrowStyleGroupBoxLayout->addWidget(mpLineStartArrowLabel, 0, 0); pArrowStyleGroupBoxLayout->addWidget(mpLineStartArrowComboBox, 0, 1); pArrowStyleGroupBoxLayout->addWidget(mpLineEndArrowLabel, 1, 0); pArrowStyleGroupBoxLayout->addWidget(mpLineEndArrowComboBox, 1, 1); pArrowStyleGroupBoxLayout->addWidget(mpLineArrowSizeLabel, 2, 0); pArrowStyleGroupBoxLayout->addWidget(mpLineArrowSizeSpinBox, 2, 1); mpArrowStyleGroupBox->setLayout(pArrowStyleGroupBoxLayout); // Fill style Group Box mpFillStyleGroupBox = new QGroupBox(Helper::fillStyle); // Fill Color mpFillColorLabel = new Label(Helper::color); mpFillPickColorButton = new QPushButton(Helper::pickColor); mpFillPickColorButton->setAutoDefault(false); connect(mpFillPickColorButton, SIGNAL(clicked()), SLOT(fillPickColor())); setFillColor(mpShapeAnnotation->getFillColor()); setFillPickColorButtonIcon(); // Fill Pattern mpFillPatternLabel = new Label(Helper::pattern); mpFillPatternComboBox = StringHandler::getFillPatternComboBox(); currentIndex = mpFillPatternComboBox->findText(StringHandler::getFillPatternString(mpShapeAnnotation->getFillPattern()), Qt::MatchExactly); if (currentIndex > -1) { mpFillPatternComboBox->setCurrentIndex(currentIndex); } // set the Fill style Group Box layout QGridLayout *pFillStyleGroupBoxLayout = new QGridLayout; pFillStyleGroupBoxLayout->setAlignment(Qt::AlignTop); pFillStyleGroupBoxLayout->setColumnStretch(1, 1); pFillStyleGroupBoxLayout->addWidget(mpFillColorLabel, 0, 0); pFillStyleGroupBoxLayout->addWidget(mpFillPickColorButton, 0, 1); pFillStyleGroupBoxLayout->addWidget(mpFillPatternLabel, 1, 0); pFillStyleGroupBoxLayout->addWidget(mpFillPatternComboBox, 1, 1); mpFillStyleGroupBox->setLayout(pFillStyleGroupBoxLayout); // Image Group Box mpImageGroupBox = new QGroupBox(tr("Image")); mpFileLabel = new Label(Helper::file); mpFileTextBox = new QLineEdit(mpShapeAnnotation->getFileName()); mpFileTextBox->setEnabled(false); mpBrowseFileButton = new QPushButton(Helper::browse); connect(mpBrowseFileButton, SIGNAL(clicked()), SLOT(browseImageFile())); mpStoreImageInModelCheckBox = new QCheckBox(tr("Store image in model")); mpStoreImageInModelCheckBox->setChecked(mpShapeAnnotation->getFileName().isEmpty()); connect(mpStoreImageInModelCheckBox, SIGNAL(toggled(bool)), SLOT(storeImageInModelToggled(bool))); mpPreviewImageLabel = new Label; mpPreviewImageLabel->setAlignment(Qt::AlignCenter); mpPreviewImageLabel->setPixmap(QPixmap::fromImage(mpShapeAnnotation->getImage())); mpPreviewImageScrollArea = new QScrollArea; mpPreviewImageScrollArea->setMinimumSize(400, 150); mpPreviewImageScrollArea->setWidgetResizable(true); mpPreviewImageScrollArea->setWidget(mpPreviewImageLabel); // set the Image Group Box QGridLayout *pImageGroupBoxLayout = new QGridLayout; pImageGroupBoxLayout->addWidget(mpFileLabel, 0, 0); pImageGroupBoxLayout->addWidget(mpFileTextBox, 0, 1); pImageGroupBoxLayout->addWidget(mpBrowseFileButton, 0, 2); pImageGroupBoxLayout->addWidget(mpStoreImageInModelCheckBox, 1, 0, 1, 3); pImageGroupBoxLayout->addWidget(mpPreviewImageScrollArea, 2, 0, 1, 3); mpImageGroupBox->setLayout(pImageGroupBoxLayout); // Points Group Box mpPointsGroupBox = new QGroupBox(tr("Points")); mpPointsTableWidget = new QTableWidget; mpPointsTableWidget->setTextElideMode(Qt::ElideMiddle); mpPointsTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); mpPointsTableWidget->setSelectionMode(QAbstractItemView::SingleSelection); mpPointsTableWidget->setColumnCount(2); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) mpPointsTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); #else /* Qt4 */ mpPointsTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch); #endif QStringList headerLabels; headerLabels << "X" << "Y"; mpPointsTableWidget->setHorizontalHeaderLabels(headerLabels); // add points to points table widget QList<QPointF> points = mpShapeAnnotation->getPoints(); mpPointsTableWidget->setRowCount(points.size()); int rowIndex = 0; LineAnnotation::LineType lineType = LineAnnotation::ShapeType; if (mpLineAnnotation) lineType = mpLineAnnotation->getLineType(); foreach (QPointF point, points) { QTableWidgetItem *pTableWidgetItemX = new QTableWidgetItem(QString::number(point.x())); if ((rowIndex == 0 || rowIndex == points.size() - 1) && (lineType == LineAnnotation::ConnectionType)) { pTableWidgetItemX->setFlags(Qt::NoItemFlags); } else { pTableWidgetItemX->setFlags(pTableWidgetItemX->flags() | Qt::ItemIsEditable); } mpPointsTableWidget->setItem(rowIndex, 0, pTableWidgetItemX); QTableWidgetItem *pTableWidgetItemY = new QTableWidgetItem(QString::number(point.y())); if ((rowIndex == 0 || rowIndex == points.size() - 1) && (lineType == LineAnnotation::ConnectionType)) { pTableWidgetItemY->setFlags(Qt::NoItemFlags); } else { pTableWidgetItemY->setFlags(pTableWidgetItemY->flags() | Qt::ItemIsEditable); } mpPointsTableWidget->setItem(rowIndex, 1, pTableWidgetItemY); rowIndex++; }
/** * Set the item color. * * It's an implementation of pure virtual method of base class used when in the * Item2D the color is needed. * * @param[in] color Color. */ void Arrow2D::setColor(const QColor &color) { setArrowFillColor(color); setArrowLineColor(color); setLineColor(color); }
foreach( ColorSelector *colorSelector, colorSelectorList ){ connect( colorSelector, SIGNAL(selected(QColor)), m_canvas, SLOT(setLineColor(QColor)) ); foreach( WidthSelector *widthSelector, m_widthSelectorList ){ connect( colorSelector, SIGNAL(selected(QColor)), widthSelector, SLOT(setColor(QColor)) ); }
void setColor(GLint toSet){ setLineColor(colorsAvailable[toSet]); }
RightPanel::RightPanel(QWidget *widget):QWidget(widget) { // TODO Auto-generated constructor stub inputusertextDialog = NULL; uid = QString(""); uid_index = -1; selectFlag = false; mapcanvasMPP = 0; // meter per 1 pixcel objectpanelMPP = 0; // meter per 1 pixcel // Object Panel define selectButton = new QToolButton; selectButton->setIcon(QIcon(":/images/object_select.png")); selectButton->setToolTip(QString("Selection")); selectButton->adjustSize(); connect(selectButton, SIGNAL(clicked()), this, SLOT(setDownSelect())); lineButton = new QToolButton; lineButton->setIcon(QIcon(":/images/object_line.png")); lineButton->setToolTip(QString("Line")); lineButton->adjustSize(); connect(lineButton, SIGNAL(clicked()), this, SLOT(setDownLine())); circleButton = new QToolButton; circleButton->setIcon(QIcon(":/images/object_circle.png")); circleButton->setToolTip(QString("Circle")); circleButton->adjustSize(); connect(circleButton, SIGNAL(clicked()), this, SLOT(setDownCircle())); eclipseButton = new QToolButton; eclipseButton->setIcon(QIcon(":/images/object_ellipse.png")); eclipseButton->setToolTip(QString("Eclipse")); eclipseButton->adjustSize(); connect(eclipseButton, SIGNAL(clicked()), this, SLOT(setDownEllipse())); rectangleButton = new QToolButton; rectangleButton->setIcon(QIcon(":/images/object_rectangle.png")); rectangleButton->setToolTip(QString("Rectangle")); rectangleButton->adjustSize(); connect(rectangleButton, SIGNAL(clicked()), this, SLOT(setDownRectangle())); polygonButton = new QToolButton; polygonButton->setIcon(QIcon(":/images/object_polygon.png")); polygonButton->setToolTip(QString("Polygon")); polygonButton->adjustSize(); connect(polygonButton, SIGNAL(clicked()), this, SLOT(setDownPolygon())); polylineButton = new QToolButton; polylineButton->setIcon(QIcon(":/images/object_polyline.png")); polylineButton->setToolTip(QString("Polyline")); polylineButton->adjustSize(); connect(polylineButton, SIGNAL(clicked()), this, SLOT(setDownPolyline())); textButton = new QToolButton; textButton->setIcon(QIcon(":/images/object_text.png")); textButton->setToolTip(QString("Text")); textButton->adjustSize(); connect(textButton, SIGNAL(clicked()), this, SLOT(setDownText())); arcButton = new QToolButton; arcButton->setIcon(QIcon(":/images/object_arc.png")); arcButton->setToolTip(QString("Arc")); arcButton->adjustSize(); connect(arcButton, SIGNAL(clicked()), this, SLOT(setDownArc())); symbolButton = new QToolButton; symbolButton->setIcon(QIcon(":/images/object_symbol.png")); symbolButton->setToolTip(QString("Symbol")); symbolButton->adjustSize(); connect(symbolButton, SIGNAL(clicked()), this, SLOT(setDownSymbol())); QGroupBox* groupboxDrawObject = new QGroupBox("Draw Object"); QVBoxLayout* vb1 = new QVBoxLayout; QGridLayout* grid = new QGridLayout; grid->addWidget(selectButton, 0, 0); grid->addWidget(lineButton, 0, 1); grid->addWidget(circleButton, 0, 2); grid->addWidget(eclipseButton, 0, 3); grid->addWidget(arcButton, 0, 4); grid->addWidget(rectangleButton, 1, 0); grid->addWidget(polygonButton, 1, 1); grid->addWidget(polylineButton, 1, 2); grid->addWidget(textButton, 1, 3); grid->addWidget(symbolButton, 1, 4); manualButton = new QPushButton(tr("&Manual Coord. Input")); connect(manualButton, SIGNAL(clicked()), this, SLOT(setDownManual())); QHBoxLayout* hb1 = new QHBoxLayout; hb1->addStretch(); hb1->addWidget(manualButton); hb1->addStretch(); vb1->addLayout(grid); vb1->addLayout(hb1); groupboxDrawObject->setLayout(vb1); // Line Properties QLabel* labelLineType = new QLabel(tr("Type")); QLabel* labelLineWidth = new QLabel(tr("Width")); QLabel* labelLineColor = new QLabel(tr("Color")); comboLineType = new LineTypeCombo; connect(comboLineType, SIGNAL(currentIndexChanged(int)), this, SLOT(setLineType(int))); spinLineWidth = new QSpinBox; spinLineWidth->setValue(1); spinLineWidth->setRange(1, 5); connect(spinLineWidth, SIGNAL(valueChanged(int)), this, SLOT(setLineWidth(int))); rgbLineColor = new ColorRgbPicker; connect(rgbLineColor, SIGNAL(changed()), this, SLOT(setLineColor())); QGridLayout* gridLine = new QGridLayout; gridLine->addWidget(labelLineType, 0, 0); gridLine->addWidget(comboLineType, 0, 1); gridLine->addWidget(labelLineWidth, 1, 0); gridLine->addWidget(spinLineWidth, 1, 1); gridLine->addWidget(labelLineColor, 2, 0); gridLine->addWidget(rgbLineColor, 2, 1); QGroupBox* groupboxLineProperties = new QGroupBox("Line Properties"); groupboxLineProperties->setLayout(gridLine); // Fill Properties QLabel* labelLineFillColor = new QLabel(tr("Fill Color")); QLabel* labelLinePattern = new QLabel(tr("Pattern")); rgbLineFillColor = new ColorRgbPicker; connect(rgbLineFillColor, SIGNAL(changed()), this, SLOT(setLineFillColor())); comboLinePattern = new FillPatternCombo; connect(comboLinePattern, SIGNAL(currentIndexChanged(int)), this, SLOT(setFillPattern(int))); QGridLayout* gridFill = new QGridLayout; gridFill->addWidget(labelLineFillColor, 0, 0); gridFill->addWidget(rgbLineFillColor, 0, 1); gridFill->addWidget(labelLinePattern, 1, 0); gridFill->addWidget(comboLinePattern, 1, 1); QGroupBox* groupboxFillProperties = new QGroupBox("Fill Properties"); groupboxFillProperties->setLayout(gridFill); // Text Properties QLabel* labelTextFont = new QLabel(tr("Font")); QLabel* labelTextSize = new QLabel(tr("Size")); QLabel* labelTextColor = new QLabel(tr("Color")); comboTextFont = new QFontComboBox; comboTextFont->setFontFilters(QFontComboBox::ScalableFonts); comboTextFont->setCurrentFont(QFont("Courier")); connect(comboTextFont, SIGNAL(currentFontChanged(QFont)), this, SLOT(setFontName(QFont))); spinTextSize = new QSpinBox; spinTextSize->setValue(10); spinTextSize->setRange(8, 30); connect(spinTextSize, SIGNAL(valueChanged(int)), this, SLOT(setTextSize(int))); rgbTextColor = new ColorRgbPicker; connect(rgbTextColor, SIGNAL(changed()), this, SLOT(setTextColor())); QGridLayout* gridText = new QGridLayout; gridText->addWidget(labelTextFont, 0, 0); gridText->addWidget(comboTextFont, 0, 1); gridText->addWidget(labelTextSize, 1, 0); gridText->addWidget(spinTextSize, 1, 1); gridText->addWidget(labelTextColor, 2, 0); gridText->addWidget(rgbTextColor, 2, 1); QGroupBox* groupboxTextProperties = new QGroupBox("Text Properties"); groupboxTextProperties->setLayout(gridText); // Usermap id List QGroupBox* groupboxUserMapId = new QGroupBox("User Map Id"); listUserMapId = new CheckListBox; listUserMapId->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); connect(listUserMapId, SIGNAL(currentRowChanged(QString)), this, SLOT(uidChanged(QString))); // Usermap delete changename button buttonUserMapIdDelete = new QPushButton(tr("&Delete")); connect(buttonUserMapIdDelete, SIGNAL(clicked()), this, SLOT(deleteUid())); buttonUserIdChange = new QPushButton(tr("&Change Id name")); connect(buttonUserIdChange, SIGNAL(clicked()), this, SLOT(changeUidName())); QVBoxLayout* umiVLayout = new QVBoxLayout; QHBoxLayout* umiHLayout = new QHBoxLayout; umiHLayout->addStretch(); umiHLayout->addWidget(buttonUserMapIdDelete); umiHLayout->addWidget(buttonUserIdChange); umiHLayout->addStretch(); umiVLayout->addWidget(listUserMapId); umiVLayout->addLayout(umiHLayout); groupboxUserMapId->setLayout(umiVLayout); // Zoom groupboxZoom = new QGroupBox("Zoom"); groupboxZoom->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); spinBoxZoom = new QSpinBox(); spinBoxZoom->setRange(10, 2000); // MPP hSliderZoom = new QSlider(); hSliderZoom->setOrientation(Qt::Horizontal); hSliderZoom->setRange(10, 2000); hSliderZoom->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); connect(spinBoxZoom, SIGNAL(valueChanged(int)), hSliderZoom, SLOT(setValue(int))); connect(hSliderZoom, SIGNAL(valueChanged(int)), spinBoxZoom, SLOT(setValue(int))); connect(spinBoxZoom, SIGNAL(valueChanged(int)), this, SLOT(changeZoom())); connect(hSliderZoom, SIGNAL(valueChanged(int)), this, SLOT(changeZoom())); zoomHLayout = new QHBoxLayout; zoomHLayout->addWidget(hSliderZoom); zoomHLayout->addWidget(spinBoxZoom); groupboxZoom->setLayout(zoomHLayout); // Main Setting QVBoxLayout* mainLayout = new QVBoxLayout; mainLayout->addWidget(groupboxDrawObject); mainLayout->addWidget(groupboxLineProperties); mainLayout->addWidget(groupboxFillProperties); mainLayout->addWidget(groupboxTextProperties); mainLayout->addWidget(groupboxUserMapId); mainLayout->addWidget(groupboxZoom); mainLayout->addStretch(); setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); setLayout(mainLayout); property = new LayerProperty; nowDrawType = Select; setDown(Select); }
void SetParameterOptionsDialog::chosseLineColor() { setLineColor( QColorDialog::getColor( this->LineColor(), this, tr( "Select color of lines"), QColorDialog::DontUseNativeDialog ) ); update(); }