Exemplo n.º 1
0
void ParStore::addLocation()
{
    StorageButton *toolButton = new StorageButton(this);
    toolButton->setText(QString::number(list.count()));
    toolButton->setProperty("index", list.count());
    connect(toolButton, SIGNAL(pressed()), this, SLOT(mapRestoreSignal()));

    toolButton->setContextMenuPolicy(Qt::ContextMenuPolicy(Qt::CustomContextMenu));
    connect(toolButton, SIGNAL(customContextMenuRequested(const QPoint &))
                    , this, SLOT(showLocContextMenu(const QPoint &)));

    jumpToIndexMenu->addAction(new QAction(QString::number(list.count()), this));
    jumpToIndexMenu->actions().last()->setActionGroup(jumpToGroup);
    jumpToIndexMenu->actions().last()->setProperty("index", list.count() - 1);
    jumpToIndexMenu->actions().last()->setCheckable(true);

    layout()->itemAt(0)->layout()->addWidget(toolButton);
    jumpToList.append(-2);
    onlyPatternList.append(false);
}
Exemplo n.º 2
0
void GlobStore::addLocation()
{
    QAction* storeAction = new QAction(tr("&Store"), this);
    QToolButton *storeButton = new QToolButton;
    storeButton->setDefaultAction(storeAction);
    storeButton->setFixedSize(15, 25);
    storeAction->setIcon(QPixmap(filesave_xpm));
    connect(storeAction, SIGNAL(triggered()), storeSignalMapper, SLOT(map()));
    storeSignalMapper->setMapping(storeAction, widgetList.count());

    QAction* restoreAction = new QAction(tr("&Restore"), this);
    QToolButton *restoreButton = new QToolButton;
    restoreButton->setDefaultAction(restoreAction);
    restoreButton->setFixedSize(45, 25);
    restoreAction->setText(QString::number(widgetList.count() + 1));
    restoreButton->setStyleSheet("font: 18pt");
    restoreAction->setDisabled(true);
    restoreAction->setObjectName("-1");
    restoreAction->setProperty("index", widgetList.count() + 1);
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(mapRestoreSignal()));

    QWidget* globWidget = new QWidget;
    QHBoxLayout* globLayout = new QHBoxLayout;
    globLayout->setSpacing(0);
    globLayout->setMargin(0);
    globLayout->addWidget(storeButton);
    globLayout->addWidget(restoreButton);
    globWidget->setLayout(globLayout);

    indivButtonLayout->itemAt(0)->layout()->itemAt(0)->layout()->addWidget(globWidget);

    if (widgetList.count()) {
        widgetList.last()->layout()->itemAt(1)->widget()->setEnabled(true);
    }
    widgetList.append(globWidget);
    modified = true;
}