Example #1
0
void Link::trackNodes()
{
    setLine(QLineF(fromNode()->pos(), toNode()->pos()));
    update();
}
Example #2
0
void CodeView::reload()
{
    int currentLine = getCurrentLine();
    readSourceFile(m_sourceFile);
    setLine(currentLine);
}
void TContainerLine::m_inFocus(bool value) {
    setLine(value);
    emit inFocus(value);
}
Example #4
0
void Image::setLine(Location from, Location to, unsigned pixelSize, Color color) {
	setLine(from.getX(), from.getY(), to.getX(), to.getY(), pixelSize, color);
}
Example #5
0
void LineMode::move(int x, int y) {
    auto line = static_cast<QGraphicsLineItem*>(line_->graphicItems().at(0));
    QLineF l = line->line();
    l.setP2(QPointF(x, y));
    line->setLine(l);
}
Example #6
0
 void Line::setLine(const Point& start, const Point& end) throw(Exception::FatalError) {
     setLine(start.getPosition(), end.getPosition());
 }
Example #7
0
 Line::Line(const Point& start, const Point& end) throw(Exception::FatalError) {
     setLine(start, end);
 }
Example #8
0
KAlgebraCompletionObject::KAlgebraCompletionObject(const QString& command, int index, KAlgebraSession* session)
    : Cantor::CompletionObject(session)
{
    setLine(command, index);
}
//! [3]
void Arrow::updatePosition()
{
    QLineF line(mapFromItem(myStartItem, 0, 0), mapFromItem(myEndItem, 0, 0));
    setLine(line);
}
Example #10
0
void Link::trackNodes()
{
    setLine(QLineF(myFromNode->pos(), myToNode->pos()));
}
Example #11
0
void StrokePreview::moveTo(const dpcore::Point& to)
{
	Preview::moveTo(to);
	setLine(from().x(), from().y(), to.x(), to.y());
}
Example #12
0
 /**
  * Mouse left widget, update labels
  *
  * @param event
  */
 void VisualDisplay::leaveEvent(QEvent *event) {
   emit setSample("Sample: n/a");
   emit setLine("Line: n/a");
   emit setDn("DN: n/a");
 }
Example #13
0
  /**
   * Constructor, creates and sets up widgets for this tool.
   *
   * @param parent
   */
  StatisticsTool::StatisticsTool(QWidget *parent) : Tool(parent) {
    p_boxSamps = 3;
    p_boxLines = 3;

    p_ulSamp = -1;
    p_ulLine = -1;

    p_set = false;

    p_dialog = new QDialog(parent);
    p_dialog->setWindowTitle("Statistics");

    p_visualBox = new QGroupBox("Visual Display");

    p_visualScroll = new QScrollArea;
    p_visualScroll->setBackgroundRole(QPalette::Dark);
    
    p_visualDisplay = new VisualDisplay(p_visualScroll);
    p_visualDisplay->setObjectName("dnDisplay");

    QCheckBox *checkBox = new QCheckBox("Hide Display");
    connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(hideDisplay(bool)));

    QLabel *boxLabel = new QLabel("Box Size:");
    p_boxLabel = new QLabel;
    QString samps, lines;
    samps.setNum(p_boxSamps);
    lines.setNum(p_boxLines);
    p_boxLabel->setText(samps + "x" + lines);

    QHBoxLayout *boxLabelLayout = new QHBoxLayout;

    boxLabelLayout->addWidget(checkBox);
    boxLabelLayout->addStretch(1);
    boxLabelLayout->addWidget(boxLabel);
    boxLabelLayout->addWidget(p_boxLabel);

    QSlider *slider = new QSlider(Qt::Vertical);
    slider->setRange(2, 18);
    slider->setSliderPosition(10);
    slider->setSingleStep(1);
    slider->setTickInterval(1);
    slider->setTickPosition(QSlider::TicksBelow);
    connect(slider, SIGNAL(valueChanged(int)), p_visualDisplay, SLOT(setBoxSize(int)));
    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(resizeScrollbars()));
    p_visualScroll->setWidget(p_visualDisplay);

    QGroupBox *displayMode = new QGroupBox("Display Mode");
    QRadioButton *displayText = new QRadioButton("Show Text");
    displayText->setToolTip("Display the pixels of a region as text");
    QRadioButton *displayPixels = new QRadioButton("Show Pixel Values");
    displayPixels->setToolTip("Display the pixels of a region");
    QRadioButton *displayDeviation = new QRadioButton("Show Deviation");
    displayDeviation->setToolTip("Display standard deviation over a region,\n where red denotes a larger deviation");

    QHBoxLayout *displayModeLayout = new QHBoxLayout;
    displayModeLayout->addWidget(displayText);
    displayModeLayout->addWidget(displayPixels);
    displayModeLayout->addWidget(displayDeviation);

    displayMode->setLayout(displayModeLayout);

    connect(displayText, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showText(bool)));
    connect(displayText, SIGNAL(toggled(bool)), slider, SLOT(setDisabled(bool)));
    connect(displayPixels, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showPixels(bool)));
    connect(displayDeviation, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showDeviation(bool)));

    displayText->setChecked(true);

    QHBoxLayout *visualHBoxLayout = new QHBoxLayout;
    visualHBoxLayout->addWidget(p_visualScroll);
    visualHBoxLayout->addWidget(slider);

    QVBoxLayout *visualVBoxLayout = new QVBoxLayout;
    visualVBoxLayout->addLayout(visualHBoxLayout);
    visualVBoxLayout->addWidget(displayMode);

    p_visualBox->setLayout(visualVBoxLayout);

    QGroupBox *statsBox = new QGroupBox("Statistics");

    p_minLabel = new QLabel("Minimum: n/a");
    p_minLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    p_minLabel->setLineWidth(1);
    p_minLabel->setMargin(10);
    p_minLabel->setAlignment(Qt::AlignLeft);

    p_maxLabel = new QLabel("Maximum: n/a");
    p_maxLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    p_maxLabel->setLineWidth(1);
    p_maxLabel->setMargin(10);
    p_maxLabel->setAlignment(Qt::AlignLeft);

    p_avgLabel = new QLabel("Average: n/a");
    p_avgLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    p_avgLabel->setLineWidth(1);
    p_avgLabel->setMargin(10);
    p_avgLabel->setAlignment(Qt::AlignLeft);

    p_stdevLabel = new QLabel("Standard Dev: n/a");
    p_stdevLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    p_stdevLabel->setLineWidth(1);
    p_stdevLabel->setMargin(10);
    p_stdevLabel->setAlignment(Qt::AlignLeft);

    p_dnLabel = new QLabel("DN: n/a");
    QFont labelFont = p_dnLabel->font();
    labelFont.setPointSize(8);
    p_dnLabel->setFont(labelFont);
    p_dnLabel->setAlignment(Qt::AlignRight);
    connect(p_visualDisplay, SIGNAL(setDn(QString)), p_dnLabel, SLOT(setText(QString)));

    p_sampLabel = new QLabel("Sample: n/a");
    p_sampLabel->setFont(labelFont);
    p_sampLabel->setAlignment(Qt::AlignLeft);
    connect(p_visualDisplay, SIGNAL(setSample(QString)), p_sampLabel, SLOT(setText(QString)));

    p_lineLabel = new QLabel("Line: n/a");
    p_lineLabel->setFont(labelFont);
    p_lineLabel->setAlignment(Qt::AlignCenter);
    connect(p_visualDisplay, SIGNAL(setLine(QString)), p_lineLabel, SLOT(setText(QString)));

    QGridLayout *statsLayout = new QGridLayout;
    statsLayout->addWidget(p_minLabel, 0, 0, 1, 2);
    statsLayout->addWidget(p_maxLabel, 1, 0, 1, 2);
    statsLayout->addWidget(p_avgLabel, 0, 2, 1, 2);
    statsLayout->addWidget(p_stdevLabel, 1, 2, 1, 2);
    statsLayout->addWidget(p_sampLabel, 2, 0);
    statsLayout->addWidget(p_lineLabel, 2, 1, 1, 2);
    statsLayout->addWidget(p_dnLabel, 2, 3);

    statsBox->setLayout(statsLayout);

    QVBoxLayout *dialogLayout = new QVBoxLayout;
    dialogLayout->addLayout(boxLabelLayout);
    dialogLayout->addWidget(p_visualBox);
    dialogLayout->addWidget(statsBox);

    p_dialog->setLayout(dialogLayout);

    checkBox->setChecked(true);
  }
Example #14
0
void Arrow::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
          QWidget *)
{
    qDebug() << "Arrow: paint";

    if (myStartItem->collidesWithItem(myEndItem))
        return;
/*
    QPen myPen = pen();
    myPen.setColor(myColor);
    qreal arrowSize = 20;
    painter->setPen(myPen);
    painter->setBrush(myColor);


    QLineF centerLine(myStartItem->pos(), myEndItem->pos());
    QPolygonF endPolygon = myEndItem->polygon();
    //p1 = coordinates of first pointer of enditem in
    //scene coordinates
    QPointF p1 = endPolygon.first() + myEndItem->pos();
    QPointF p2;
    QPointF intersectPoint;
    QLineF polyLine;
    //.count()=.size()
    for (int i = 1; i < endPolygon.count(); ++i) {
        p2 = endPolygon.at(i) + myEndItem->pos();
        polyLine = QLineF(p1, p2);
        QLineF::IntersectType intersectType =
            polyLine.intersect(centerLine, &intersectPoint);
        if (intersectType == QLineF::BoundedIntersection)
            break;
            p1 = p2;
    }
    */

    //qreal comp1=intersectPoint.x();
    //qreal comp2;

    //TODO:
    //This is my patch to define input and output points for lines
    //All code above this point is rendered useless and should be removed

    QPointF intersectPoint;
    QPen myPen = pen();
    myPen.setColor(myColor);
    qreal arrowSize = 20;
    painter->setPen(myPen);
    painter->setBrush(myColor);

    intersectPoint=myEndItem->pos();
    intersectPoint.setX(intersectPoint.x()-myEndItem->boundingRect().width()/2);

    QPointF otherPoint;
    otherPoint=myStartItem->pos();
    otherPoint.setX(otherPoint.x()+myStartItem->boundingRect().width()/2);
    //original
    setLine(QLineF(otherPoint, intersectPoint));

    if(isZone2()){
        zone2(otherPoint);
    }
    else{
        zone1(otherPoint);
    }

    //double angle = ::acos(line().dx() / line().length());
    double angle=Pi;
    if (line().dy() >= 0)
        angle = (Pi * 2) - angle;


    QPointF arrowP1 = line().p2() + QPointF(sin(angle + Pi / 3) * arrowSize,
                                    cos(angle + Pi / 3) * arrowSize);
    QPointF arrowP2 = line().p2() + QPointF(sin(angle + Pi - Pi / 3) * arrowSize,
                                    cos(angle + Pi - Pi / 3) * arrowSize);

    arrowHead.clear();
    arrowHead << line().p2() << arrowP1 << arrowP2;

    for(int i=0;i<part.size();++i)
        painter->drawLine(*part[i]);

    //setLine(*part[0]);
    //painter->drawLine(line());
    painter->drawPolygon(arrowHead);
    if (isSelected()) {
        painter->setPen(QPen(myColor, 1, Qt::DashLine));

        QLineF myLine = line();
        myLine.translate(0, 4.0);
        painter->drawLine(myLine);
        myLine.translate(0,-8.0);
        painter->drawLine(myLine);
    }

    //qDebug() << "PAINT ORDER FINISH";
}
Example #15
0
 Line& Line::operator=(const Line& line) throw(Exception::FatalError) {
     setLine(line.getPoint1(), line.getPoint2());
     return *this;
 }
Example #16
0
void Line::setP1(const QPointF &p)
{
	setLine(QLineF(p, line().p2()));
}
Example #17
0
 void Line::setLine(const Line& line) {
     setLine(line.getPoint1(), line.getPoint2());
 }
Example #18
0
void Line::setP2(const QPointF &p)
{
	setLine(QLineF(line().p1(), p));
}
Example #19
0
 Line::Line() {
     setLine(Point(0.0f, 0.0f), Point(1.0f, 1.0f));
 }
Example #20
0
 void TrailLineItem::setLineSlot()
 {
     setLine(m_map->FromLatLngToLocal(this->coord1).X(),m_map->FromLatLngToLocal(this->coord1).Y(),m_map->FromLatLngToLocal(this->coord2).X(),m_map->FromLatLngToLocal(this->coord2).Y());
 }
Example #21
0
void Image::setLine(Location from, Location to, Color color) {
	setLine(from, to, 1, color);
}
Example #22
0
 void GraphicsEdge::updatePosition()
 {
     QLineF line(mapFromItem(myStartItem, 0, 0), mapFromItem(myEndItem, 0, 0));
     setLine(line);
 }
Example #23
0
void Image::setLine(unsigned fromX, unsigned fromY, unsigned toX, unsigned toY, Color color)
{
	setLine(fromX, fromY, toX, toY, 1, color);
}
KoReportDesignerItemLine::KoReportDesignerItemLine(QDomNode & entity, KoReportDesigner * d, QGraphicsScene * scene)
        : KoReportItemLine(entity), KoReportDesignerItemBase(d)
{
    init(scene, d);
    setLine ( m_start.toScene().x(), m_start.toScene().y(), m_end.toScene().x(), m_end.toScene().y() );
}
Example #25
0
void CodeView::setExceptionLine(int line)
{
    m_currentSourceLine = line;
    setLine(line);
}
Example #26
0
 Line::Line(const glm::vec2& start, const glm::vec2& end) throw(Exception::FatalError) {
     setLine(start, end);
 }
void TContainerLine::focusInEvent(QFocusEvent *e) {
    XYZContainer::focusInEvent(e);
    setLine(true);
}
Example #28
0
 Line::Line(const Line& line) throw(Exception::FatalError) {
     setLine(line.getPoint1(), line.getPoint2());
 }
Example #29
0
PythonCompletionObject::PythonCompletionObject(const QString& command, int index, PythonSession* session) : Cantor::CompletionObject(session)
{
    setLine(command, index);
}
void PathLine::updatePosition()
{
    QLineF oLine(mapFromItem(m_oStartItem, 0, 0), mapFromItem(m_oEndItem, 0, 0));
    setLine(oLine);
}