ich will nun eine context menu erstellen es klappt aber nciht!
ich kann im Dialog mit rechts klick nichts auswählen!
hier mein DownloadsDialog.cpp:
Code: Alles auswählen
#include "rshare.h"
#include "DownloadsDialog.h"
#include <QHeaderView>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
/** 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*)
{
popMenu = new QMenu(this);
popMenu->addAction(_showdowninfoAct);
popMenu->addSeparator();
popMenu->addAction(_resumeAct);
popMenu->exec();
}
void DownloadsDialog::createActions()
{
_showdowninfoAct = new QAction(QIcon(), tr("Show Informations"), this);
connect(_showdowninfoAct, SIGNAL(triggered()), this, SLOT(showPreferencesWindow()));
_resumeAct = new QAction(QIcon(), tr("Resume"), this);
connect(_resumeAct, SIGNAL(triggered()), this, SLOT(close()));
}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:
private:
/** Create the actions on the tray menu or menubar */
void createActions();
/** Create the context popup menu and it's submenus */
void contextMenuEvent( QContextMenuEvent* );
/** 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
DownloadtableWidget Properity Editor:


