mirror of https://github.com/OpenMW/openmw.git
Move context menu code to PageBase
parent
16f8341de3
commit
cd75c5618c
@ -1,33 +0,0 @@
|
||||
#include "contextmenuwidget.hpp"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
#include "../../model/prefs/state.hpp"
|
||||
|
||||
CSVPrefs::ContextMenuWidget::ContextMenuWidget(const std::string& category, QWidget* parent)
|
||||
:QWidget(parent)
|
||||
,mCategory(category)
|
||||
{
|
||||
}
|
||||
|
||||
void CSVPrefs::ContextMenuWidget::contextMenuEvent(QContextMenuEvent* e)
|
||||
{
|
||||
QMenu* menu = new QMenu();
|
||||
|
||||
menu->addAction("Reset category to default", this, SLOT(resetCategory()));
|
||||
menu->addAction("Reset all to default", this, SLOT(resetAll()));
|
||||
|
||||
menu->exec(e->globalPos());
|
||||
delete menu;
|
||||
}
|
||||
|
||||
void CSVPrefs::ContextMenuWidget::resetCategory()
|
||||
{
|
||||
CSMPrefs::State::get().resetCategory(mCategory);
|
||||
}
|
||||
|
||||
void CSVPrefs::ContextMenuWidget::resetAll()
|
||||
{
|
||||
CSMPrefs::State::get().resetAll();
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
#ifndef CSV_PREFS_CONTEXTMENUWIDGET_H
|
||||
#define CSV_PREFS_CONTEXTMENUWIDGET_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QContextMenuEvent;
|
||||
|
||||
namespace CSVPrefs
|
||||
{
|
||||
class ContextMenuWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
ContextMenuWidget(const std::string& category, QWidget* parent = 0);
|
||||
|
||||
protected:
|
||||
|
||||
void contextMenuEvent(QContextMenuEvent* e);
|
||||
|
||||
private slots:
|
||||
|
||||
void resetCategory();
|
||||
|
||||
void resetAll();
|
||||
|
||||
private:
|
||||
|
||||
std::string mCategory;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue