LegendWidget::LegendWidget(Graph *plot):FrameWidget(plot), d_angle(0), h_space(5), left_margin(10), top_margin(5), line_length(20), d_auto_update(false) { setAttribute(Qt::WA_DeleteOnClose); d_text = new QwtText(QString::null, QwtText::RichText); d_text->setFont(QFont("Arial", 12, QFont::Normal, false)); d_text->setRenderFlags(Qt::AlignTop|Qt::AlignLeft); d_text->setBackgroundBrush(QBrush(Qt::NoBrush)); d_text->setColor(Qt::black); d_text->setBackgroundPen (QPen(Qt::NoPen)); d_text->setPaintAttribute(QwtText::PaintBackground); move(plot->mapToParent(plot->canvas()->pos() + QPoint(10, 10))); connect (this, SIGNAL(enableEditor()), plot, SLOT(enableTextEditor())); setMouseTracking(true); show(); setFocus(); }
LegendWidget::LegendWidget(Plot *plot):QWidget(plot), d_plot(plot), d_frame (0), d_angle(0), d_fixed_coordinates(false) { setAttribute(Qt::WA_DeleteOnClose); d_text = new QwtText(QString::null, QwtText::RichText); d_text->setFont(QFont("Arial", 12, QFont::Normal, false)); d_text->setRenderFlags(Qt::AlignTop|Qt::AlignLeft); d_text->setBackgroundBrush(QBrush(Qt::NoBrush)); d_text->setColor(Qt::black); d_text->setBackgroundPen (QPen(Qt::NoPen)); d_text->setPaintAttribute(QwtText::PaintBackground); h_space = 5; left_margin = 10; top_margin = 5; line_length = 20; QPoint pos = plot->canvas()->pos(); pos = QPoint(pos.x() + 10, pos.y() + 10); move(pos); d_selector = NULL; connect (this, SIGNAL(showDialog()), plot->parent(), SIGNAL(viewTextDialog())); connect (this, SIGNAL(showMenu()), plot->parent(), SIGNAL(showMarkerPopupMenu())); connect (this, SIGNAL(enableEditor()), plot->parent(), SLOT(enableTextEditor())); setMouseTracking(true); show(); setFocus(); }