src/mainwindow.cpp

changeset 1023
9450ac3cd930
parent 1018
49358df9495b
child 1024
67ba0ee049eb
equal deleted inserted replaced
1022:a7f8ce5aa858 1023:9450ac3cd930
54 #include "dialogs/configdialog.h" 54 #include "dialogs/configdialog.h"
55 #include "guiutilities.h" 55 #include "guiutilities.h"
56 #include "glCompiler.h" 56 #include "glCompiler.h"
57 #include "documentmanager.h" 57 #include "documentmanager.h"
58 #include "ldobjectiterator.h" 58 #include "ldobjectiterator.h"
59 #include "grid.h"
59 60
60 ConfigOption (bool ColorizeObjectsList = true) 61 ConfigOption (bool ColorizeObjectsList = true)
61 ConfigOption (QString QuickColorToolbar = "4:25:14:27:2:3:11:1:22:|:0:72:71:15") 62 ConfigOption (QString QuickColorToolbar = "4:25:14:27:2:3:11:1:22:|:0:72:71:15")
62 ConfigOption (bool ListImplicitFiles = false) 63 ConfigOption (bool ListImplicitFiles = false)
63 ConfigOption (QStringList HiddenToolbars) 64 ConfigOption (QStringList HiddenToolbars)
67 MainWindow::MainWindow(class Configuration& config, QWidget* parent, Qt::WindowFlags flags) : 68 MainWindow::MainWindow(class Configuration& config, QWidget* parent, Qt::WindowFlags flags) :
68 QMainWindow (parent, flags), 69 QMainWindow (parent, flags),
69 m_config(config), 70 m_config(config),
70 m_guiUtilities (new GuiUtilities (this)), 71 m_guiUtilities (new GuiUtilities (this)),
71 m_primitives(new PrimitiveManager(this)), 72 m_primitives(new PrimitiveManager(this)),
73 m_grid(new Grid(this)),
72 ui (*new Ui_MainWindow), 74 ui (*new Ui_MainWindow),
73 m_externalPrograms (nullptr), 75 m_externalPrograms (nullptr),
74 m_settings (makeSettings (this)), 76 m_settings (makeSettings (this)),
75 m_documents (new DocumentManager (this)), 77 m_documents (new DocumentManager (this)),
76 m_currentDocument (nullptr), 78 m_currentDocument (nullptr),
879 } 881 }
880 882
881 // ============================================================================ 883 // ============================================================================
882 void ObjectList::contextMenuEvent (QContextMenuEvent* ev) 884 void ObjectList::contextMenuEvent (QContextMenuEvent* ev)
883 { 885 {
884 g_win->spawnContextMenu (ev->globalPos()); 886 MainWindow* mainWindow = qobject_cast<MainWindow*>(parent());
887
888 if (mainWindow)
889 mainWindow->spawnContextMenu (ev->globalPos());
885 } 890 }
886 891
887 // --------------------------------------------------------------------------------------------------------------------- 892 // ---------------------------------------------------------------------------------------------------------------------
888 // 893 //
889 QPixmap GetIcon (QString iconName) 894 QPixmap GetIcon (QString iconName)
1327 Configuration* MainWindow::config() 1332 Configuration* MainWindow::config()
1328 { 1333 {
1329 return &m_config; 1334 return &m_config;
1330 } 1335 }
1331 1336
1337 Grid* MainWindow::grid()
1338 {
1339 return m_grid;
1340 }
1341
1332 // --------------------------------------------------------------------------------------------------------------------- 1342 // ---------------------------------------------------------------------------------------------------------------------
1333 // 1343 //
1334 ColorToolbarItem::ColorToolbarItem (LDColor color, QToolButton* toolButton) : 1344 ColorToolbarItem::ColorToolbarItem (LDColor color, QToolButton* toolButton) :
1335 m_color (color), 1345 m_color (color),
1336 m_toolButton (toolButton) {} 1346 m_toolButton (toolButton) {}

mercurial