예제 #1
0
LookupInfoDialog::LookupInfoDialog(AddressTableModel *addressModelIn, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::LookupInfoDialog), model(0), proxyModel(0), address(""), addressModel(addressModelIn)
{
    ui->setupUi(this);

    GUIUtil::setupAddressWidget(ui->addressEdit, this);
    
    setWindowTitle(tr("Lookup Address Info"));
    ui->addressEdit->setEnabled(true);
    
    ui->tableView->setContextMenuPolicy(Qt::CustomContextMenu);
    
    // Context menu actions
    QAction *copyValueAction = new QAction(tr("Copy Value"), this);
    QAction *copyDateAction = new QAction(tr("Copy Date"), this);
    QAction *copyKeyAction = new QAction(tr("Copy Key"), this);
    
    contextMenu = new QMenu();
    contextMenu->addAction(copyValueAction);
    contextMenu->addAction(copyDateAction);
    contextMenu->addAction(copyKeyAction);
    
    connect(copyValueAction, SIGNAL(triggered()), this, SLOT(onCopyValueAction()));
    connect(copyDateAction, SIGNAL(triggered()), this, SLOT(onCopyDateAction()));
    connect(copyKeyAction, SIGNAL(triggered()), this, SLOT(onCopyKeyAction()));
    
    connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
    connect(ui->addressEdit, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString)));
}
예제 #2
0
ManageNamesPage::ManageNamesPage(const PlatformStyle *platformStyle, QWidget *parent) :
    QWidget(parent),
    platformStyle(platformStyle),
    ui(new Ui::ManageNamesPage),
    model(0),
    walletModel(0),
    proxyModel(0)
{
    ui->setupUi(this);

    // Context menu actions
    QAction *copyNameAction = new QAction(tr("Copy &Name"), this);
    QAction *copyValueAction = new QAction(tr("Copy &Value"), this);
    QAction *configureNameAction = new QAction(tr("&Configure Name..."), this);
    QAction *renewNameAction = new QAction(tr("&Renew Name"), this);

    // Build context menu
    contextMenu = new QMenu();
    contextMenu->addAction(copyNameAction);
    contextMenu->addAction(copyValueAction);
    contextMenu->addAction(configureNameAction);
    contextMenu->addAction(renewNameAction);

    // Connect signals for context menu actions
    connect(copyNameAction, SIGNAL(triggered()), this, SLOT(onCopyNameAction()));
    connect(copyValueAction, SIGNAL(triggered()), this, SLOT(onCopyValueAction()));
    connect(configureNameAction, SIGNAL(triggered()), this, SLOT(on_configureNameButton_clicked()));
    connect(renewNameAction, SIGNAL(triggered()), this, SLOT(on_renewNameButton_clicked()));

    connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
    connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_configureNameButton_clicked()));
    ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);

    ui->registerName->installEventFilter(this);
    ui->tableView->installEventFilter(this);
}