mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
added main menu and implemented new view function
This commit is contained in:
parent
758371d7e4
commit
789cecb9df
2 changed files with 30 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QMenuBar>
|
||||
|
||||
#include "viewmanager.hpp"
|
||||
|
||||
|
@ -13,11 +14,25 @@ void CSVDoc::View::closeEvent (QCloseEvent *event)
|
|||
event->ignore();
|
||||
}
|
||||
|
||||
void CSVDoc::View::setupUi()
|
||||
{
|
||||
// window menu
|
||||
QMenu *view = menuBar()->addMenu (tr ("&View"));
|
||||
|
||||
QAction *newWindow = new QAction (tr ("&New View"), this);
|
||||
connect (newWindow, SIGNAL (triggered()), this, SLOT (newView()));
|
||||
|
||||
view->addAction (newWindow);
|
||||
}
|
||||
|
||||
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document)
|
||||
: mViewManager (viewManager), mDocument (document)
|
||||
{
|
||||
setCentralWidget (new QWidget);
|
||||
resize (200, 200);
|
||||
setWindowTitle ("New Document");
|
||||
|
||||
setupUi();
|
||||
}
|
||||
|
||||
const CSMDoc::Document *CSVDoc::View::getDocument() const
|
||||
|
@ -29,3 +44,8 @@ CSMDoc::Document *CSVDoc::View::getDocument()
|
|||
{
|
||||
return mDocument;
|
||||
}
|
||||
|
||||
void CSVDoc::View::newView()
|
||||
{
|
||||
mViewManager.addView (mDocument);
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef CSV_DOC_VIEW_H
|
||||
#define CSV_DOC_VIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMainWindow>
|
||||
|
||||
class QAction;
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
|
@ -12,7 +14,7 @@ namespace CSVDoc
|
|||
{
|
||||
class ViewManager;
|
||||
|
||||
class View : public QWidget
|
||||
class View : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -27,6 +29,8 @@ namespace CSVDoc
|
|||
|
||||
void closeEvent (QCloseEvent *event);
|
||||
|
||||
void setupUi();
|
||||
|
||||
public:
|
||||
|
||||
View (ViewManager& viewManager, CSMDoc::Document *document);
|
||||
|
@ -35,6 +39,10 @@ namespace CSVDoc
|
|||
const CSMDoc::Document *getDocument() const;
|
||||
|
||||
CSMDoc::Document *getDocument();
|
||||
|
||||
private slots:
|
||||
|
||||
void newView();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue