also ich konnte schon lang nicht mein problem mit dme context menue nicht lösen trotz paar hilfen hier im forum,
vielleicht sieht jemand der sich damit auskennt meine fehler.
DownloadsDialog.cpp:
Code: Alles auswählen
#include "rshare.h"
#include "DownloadsDialog.h"
#include "downinfo/DownInfoWindow.h"
#include <QHeaderView>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
/* Images for context menu icons */
#define IMAGE_INFO ":/images/informations_16x16.png"
/** Constructor */
DownloadsDialog::DownloadsDialog(QWidget *parent)
: MainPage(parent)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void DownloadsDialog::contextMenuEvent(QContextMenuEvent *e)
{
//QMenu popMenu(this);
popMenu = new QMenu(this);
//popMenu.addAction(_showdowninfoAct);
//popMenu.addSeparator();
//popMenu.addAction(_resumeAct);
//popMenu.exec(e->globalPos());
popMenu->addAction(_showdowninfoAct);
popMenu->addSeparator();
//popMenu->addAction(_resumeAct);
popMenu->exec(e->globalPos());
}
void DownloadsDialog::createActions()
{
_showdowninfoAct = new QAction(QIcon(IMAGE_INFO), tr("Show Informations"), this);
connect(_showdowninfoAct, SIGNAL(triggered()), this, SLOT(showDownInfoWindow()));
// _resumeAct = new QAction(QIcon(), tr("Resume"), this);
// connect(_resumeAct, SIGNAL(triggered()), this, SLOT(close()));
}
/** Shows Downloads Informations */
void DownloadsDialog::showDownInfoWindow()
{
DownInfoWindow *downinfoWindow = new DownInfoWindow();
downinfoWindow->show();
}Code: Alles auswählen
#ifndef _DOWNLOADSDIALOG_H
#define _DOWNLOADSDIALOG_H
#include <QFileDialog>
#include <config/rsharesettings.h>
#include "mainpage.h"
#include "ui_DownloadsDialog.h"
class DownloadsDialog : public MainPage
{
Q_OBJECT
public:
/** Default Constructor */
DownloadsDialog(QWidget *parent = 0);
/** Default Destructor */
private slots:
void showDownInfoWindow();
private:
/** Create the actions on the tray menu or menubar */
void createActions();
/** Create the context popup menu and it's submenus */
void contextMenuEvent( QContextMenuEvent *e);
/** Define the popup menus for the Context menu */
QMenu* popMenu;
/** Defines the actions for the context menu */
QAction* _showdowninfoAct;
QAction* _resumeAct;
/** Adds a new action to the toolbar. */
void addAction(QAction *action, const char *slot = 0);
/** Qt Designer generated object */
Ui::DownloadsDialog ui;
};
#endif
also habe die policy zum context menue schon alle probiert ohne erfolg bis jetzt.

