Commit 689acb5e authored by Christophe Courtaut's avatar Christophe Courtaut

Added docks into view menu to be able to toggle visibility

parent 819cd688
......@@ -35,7 +35,7 @@ DockWidgetManager *DockWidgetManager::instance( QObject *parent )
return (m_instance);
}
void DockWidgetManager::setMainWindow( QMainWindow *mainWin )
void DockWidgetManager::setMainWindow( MainWindow *mainWin )
{
m_mainWin = mainWin;
}
......@@ -56,6 +56,7 @@ void DockWidgetManager::addDockedWidget( QWidget *widget,
dock->setAllowedAreas( areas );
dock->setFeatures( features );
m_mainWin->addDockWidget( startArea, dock );
m_mainWin->registerWidgetInViewMenu( dock );
widget->show();
}
......
......@@ -24,37 +24,39 @@
#define DOCKWIDGETMANAGER_H
#include <QObject>
#include <QMainWindow>
#include <QWidget>
#include <QDockWidget>
#include <QString>
#include <QMap>
#include "MainWindow.h"
class MainWindow;
class DockWidgetManager : public QObject
{
Q_OBJECT
Q_OBJECT
public:
static DockWidgetManager *instance( QObject *parent = 0 );
void setMainWindow( QMainWindow *mainWin );
void addDockedWidget( QWidget *widget,
const QString &qs_name,
Qt::DockWidgetAreas areas,
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea );
public:
static DockWidgetManager *instance( QObject *parent = 0 );
void setMainWindow( MainWindow *mainWin );
void addDockedWidget( QWidget *widget,
const QString &qs_name,
Qt::DockWidgetAreas areas,
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea );
protected:
//virtual void changeEvent( QEvent *e );
private:
explicit DockWidgetManager( QObject *parent = 0 );
private:
explicit DockWidgetManager( QObject *parent = 0 );
virtual ~DockWidgetManager();
DockWidgetManager(const DockWidgetManager &);
DockWidgetManager & operator = ( const DockWidgetManager & );
DockWidgetManager(const DockWidgetManager &);
DockWidgetManager & operator = ( const DockWidgetManager & );
QMainWindow *m_mainWin;
MainWindow *m_mainWin;
QMap<QString, QDockWidget*> m_dockWidgets;
static DockWidgetManager *m_instance;
static DockWidgetManager *m_instance;
public slots:
void transLateWidgetTitle();
......
......@@ -235,3 +235,8 @@ void MainWindow::on_actionFullscreen_triggered( bool checked )
else
showNormal();
}
void MainWindow::registerWidgetInViewMenu( QDockWidget* widget )
{
m_ui.menuView->addAction( widget->toggleViewAction() );
}
......@@ -42,6 +42,7 @@ class MainWindow : public QMainWindow
public:
explicit MainWindow( QWidget *parent = 0 );
void registerWidgetInViewMenu( QDockWidget* widget );
~MainWindow();
public slots:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment