Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MyApp::setVmListContextMenu()
- {
- ui->table_ServerList->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(ui->table_ServerList, SIGNAL(customContextMenuRequested(const QPoint &)),
- this, SLOT(vmContextMenuShow(const QPoint &)));
- }
- void MyGandiCloud::vmContextMenuShow(const QPoint &pos)
- {
- QModelIndex i = ui->table_ServerList->indexAt(pos);
- if (! i.isValid())
- return;
- QList<QTableWidgetItem *> selected = ui->table_ServerList->selectedItems();
- QTableWidgetItem * this_selection = selected.first();
- int row = this_selection->row();
- QString vm_id = this_selection->text();
- QMenu * cMenu = new QMenu;
- cMenu->addAction(QIcon(":/images/general/images/forwd_32.gif"),(tr("Start Server")),
- this, SLOT(DummyMenuContainer(QString)));
- cMenu->addAction(QIcon(":/images/general/images/stop_32.gif"), (tr("Stop Server")),
- this, SLOT(DummyMenuContainer(QString)));
- cMenu->addAction(QIcon(":/images/general/images/undo_32.gif"), (tr("Reboot Server")),
- this, SLOT(DummyMenuContainer(QString)));
- cMenu->addSeparator();
- cMenu->addAction(QIcon(":/images/general/images/apps_32.gif"), (tr("Advanced Controls")),
- this, SLOT(DummyMenuContainer(QString)));
- cMenu->exec(ui->table_ServerList->viewport()->mapToGlobal(pos));
- }
- void MyGandiCloud::DummyMenuContainer()
- {
- // need to capture the "which" here...
- // i.e. which vm was the object of the context menu.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement