Пример #1
0
void ProfileGraphicsView::addControlItems()
{
    QAction *scaleAction = new QAction(QIcon(":scale"), tr("Scale"), this);
    QAction *rulerAction = new QAction(QIcon(":ruler"), tr("Ruler"), this);
    QToolBar *toolBar = new QToolBar("", 0);
    toolBar->addAction(rulerAction);
    toolBar->addAction(scaleAction);
    //make toolbar transparent
    toolBar->setStyleSheet(QString::fromUtf8 ("background-color: rgba(255,255,255,0);"));

    connect(scaleAction, SIGNAL(triggered()), this, SLOT(on_scaleAction()));
    connect(rulerAction, SIGNAL(triggered()), this, SLOT(on_rulerAction()));
    toolBarProxy = scene()->addWidget(toolBar);
    //Put it into the lower right corner of the profile
    toolBarProxy->setPos(gc.maxx-toolBar->width(), gc.maxy-toolBar->height());
}