Changeset 418 for experimental/osgVisualGuiNG
- Timestamp:
- Aug 17, 2012, 10:36:03 PM (12 years ago)
- Location:
- experimental/osgVisualGuiNG
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/osgVisualGuiNG/main.cpp
r415 r418 1 1 #include "osgvisualgui.h" 2 #include "debug.h" 2 3 #include <QtGui/QApplication> 3 4 … … 5 6 { 6 7 QApplication a(argc, argv); 8 a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); 9 10 QCoreApplication::setOrganizationName("osgVisual"); 11 QCoreApplication::setOrganizationDomain("osgvisual.org"); 12 QCoreApplication::setApplicationName("osgVisualGUI"); 13 14 // DEBUG-Handler installieren 15 QTextEdit *debug = new QTextEdit; 16 debug->hide(); 17 setDebugPointer( debug ); 18 qInstallMsgHandler( myMessageOutput ); 19 qDebug("MessageHandler installiert"); 20 7 21 osgVisualGUI w; 22 w.setDebug(debug); 8 23 w.show(); 9 24 return a.exec(); -
experimental/osgVisualGuiNG/osgvisualgui.cpp
r415 r418 1 1 #include "osgvisualgui.h" 2 3 #include <QSettings> 4 #include <QCloseEvent> 5 #include <QTextEdit> 6 #include <QMessageBox> 2 7 3 8 osgVisualGUI::osgVisualGUI(QWidget *parent, Qt::WFlags flags) 4 9 : QMainWindow(parent, flags) 5 10 { 11 debug = NULL; 12 13 // GUI instanziieren 6 14 ui.setupUi(this); 15 16 // GUI-Klassen instanziieren & connectieren 17 18 19 20 // Toolbars initialisieren 21 void setupDockWidgets(); 22 void setupToolbars(); 23 void setupMenus(); 24 25 // Windowgeometrie wiederherstellen 26 QSettings settings; 27 restoreGeometry(settings.value("mainwindow/maingeometry").toByteArray() ); 28 restoreState( settings.value("mainwindow/DockwidgetLayout").toByteArray() ); 29 30 // Und schlußendlich die GUI zeigen 31 this->show(); 7 32 } 8 33 … … 11 36 12 37 } 38 39 void osgVisualGUI::closeEvent( QCloseEvent *event ) 40 { 41 // Close application 42 this->hide(); 43 44 // Save geometries 45 QSettings settings; 46 settings.setValue("mainwindow/maingeometry", saveGeometry()); 47 settings.setValue("mainwindow/DockwidgetLayout", saveState() ); 48 49 // Close debug widget 50 if( debug != NULL ) 51 { 52 settings.setValue("debugwindow/geometry", debug->saveGeometry()); 53 qInstallMsgHandler(0); 54 debug->close(); 55 } 56 57 // accept event 58 event->accept(); 59 } 60 61 void osgVisualGUI::setDebug(QTextEdit* debug_) 62 { 63 if ( debug_ != NULL ) 64 { 65 debug = debug_; 66 ui.dW_Debug->setWidget(debug); 67 } 68 } 69 70 void osgVisualGUI::setupDockWidgets() 71 { 72 73 } 74 75 void osgVisualGUI::setupToolbars() 76 { 77 78 } 79 80 void osgVisualGUI::setupMenus() 81 { 82 ui.menuEdit->addAction( ui.actionSettings ); 83 } 84 85 void osgVisualGUI::on_actionToggle_top_left_corner_triggered() 86 { 87 if( this->corner( Qt::TopLeftCorner ) == Qt::LeftDockWidgetArea ) 88 setCorner( Qt::TopLeftCorner, Qt::BottomDockWidgetArea ); 89 else if( this->corner( Qt::TopLeftCorner ) == Qt::BottomDockWidgetArea ) 90 setCorner( Qt::TopLeftCorner, Qt::LeftDockWidgetArea ); 91 } 92 93 void osgVisualGUI::on_actionToggle_top_right_corner_triggered() 94 { 95 if( this->corner( Qt::TopRightCorner ) == Qt::RightDockWidgetArea ) 96 setCorner( Qt::TopRightCorner, Qt::TopDockWidgetArea ); 97 else if( this->corner( Qt::TopRightCorner ) == Qt::TopDockWidgetArea ) 98 setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea ); 99 } 100 101 void osgVisualGUI::on_actionToggle_bottom_left_corner_triggered() 102 { 103 if( this->corner( Qt::BottomLeftCorner ) == Qt::LeftDockWidgetArea ) 104 setCorner( Qt::BottomLeftCorner, Qt::BottomDockWidgetArea ); 105 else if( this->corner( Qt::BottomLeftCorner ) == Qt::BottomDockWidgetArea ) 106 setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea ); 107 } 108 109 void osgVisualGUI::on_actionToggle_bottom_right_corner_triggered() 110 { 111 if( this->corner( Qt::BottomRightCorner ) == Qt::RightDockWidgetArea ) 112 setCorner( Qt::BottomRightCorner, Qt::BottomDockWidgetArea ); 113 else if( this->corner( Qt::BottomRightCorner ) == Qt::BottomDockWidgetArea ) 114 setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea ); 115 } 116 117 void osgVisualGUI::on_actionAbout_This_Programm_triggered() 118 { 119 QMessageBox::about( this, tr("About %1").arg(QApplication::applicationName()) , 120 tr("OSG Visual is a GUI application for easy controlling and testing of the OSG-Visual programm.\n\n It is freely available unter GNU LGPL license\n\n Developement version 0.1\n\nLGPL icons created & copyright by the \"Crystal - Interaction Design Project\".\nPlease visit http://www.everaldo.com/crystal/") ); 121 122 } -
experimental/osgVisualGuiNG/osgvisualgui.h
r415 r418 4 4 #include <QtGui/QMainWindow> 5 5 #include "ui_osgvisualgui.h" 6 7 class QTextEdit; 6 8 7 9 class osgVisualGUI : public QMainWindow … … 13 15 ~osgVisualGUI(); 14 16 17 /** 18 * Intercepts closeEvents to perform userdef actions and finally accept the event. 19 * Zu den Aktionen gehört das Speichern der Einstellungen, das Schliessen das Debugfensters etc. 20 * @return void 21 * @param event: Abzufangender CloseEvent 22 */ 23 void closeEvent( QCloseEvent *event ); 24 25 void setDebug(QTextEdit* debug_); 26 15 27 private: 28 void setupDockWidgets(); 29 void setupToolbars(); 30 void setupMenus(); 31 16 32 Ui::osgVisualGUIClass ui; 33 34 /** 35 * Pointer to the debug widget 36 */ 37 QTextEdit* debug; 38 39 private slots: 40 void on_actionToggle_bottom_right_corner_triggered(); 41 void on_actionToggle_bottom_left_corner_triggered(); 42 void on_actionToggle_top_right_corner_triggered(); 43 void on_actionToggle_top_left_corner_triggered(); 44 void on_actionAbout_This_Programm_triggered(); 17 45 }; 18 46 -
experimental/osgVisualGuiNG/osgvisualgui.ui
r415 r418 1 <UI version="4.0" > 1 <?xml version="1.0" encoding="UTF-8"?> 2 <ui version="4.0"> 2 3 <class>osgVisualGUIClass</class> 3 <widget class="QMainWindow" name="osgVisualGUIClass" > 4 <property name="objectName" > 5 <string notr="true">osgVisualGUIClass</string> 6 </property> 7 <property name="geometry" > 4 <widget class="QMainWindow" name="osgVisualGUIClass"> 5 <property name="geometry"> 8 6 <rect> 9 10 11 12 7 <x>0</x> 8 <y>0</y> 9 <width>600</width> 10 <height>400</height> 13 11 </rect> 14 12 </property> 15 <property name="windowTitle" 13 <property name="windowTitle"> 16 14 <string>osgVisualGUI</string> 17 15 </property> 18 <widget class="QMenuBar" name="menuBar" /> 19 <widget class="QToolBar" name="mainToolBar" /> 20 <widget class="QWidget" name="centralWidget" /> 21 <widget class="QStatusBar" name="statusBar" /> 16 <widget class="QWidget" name="centralWidget"/> 17 <widget class="QMenuBar" name="menuBar"> 18 <property name="geometry"> 19 <rect> 20 <x>0</x> 21 <y>0</y> 22 <width>600</width> 23 <height>21</height> 24 </rect> 25 </property> 26 <widget class="QMenu" name="menuFile"> 27 <property name="title"> 28 <string>File</string> 29 </property> 30 <addaction name="actionQuit"/> 31 </widget> 32 <widget class="QMenu" name="menu"> 33 <property name="title"> 34 <string>?</string> 35 </property> 36 <addaction name="actionAbout"/> 37 </widget> 38 <widget class="QMenu" name="menuEdit"> 39 <property name="title"> 40 <string>Edit</string> 41 </property> 42 </widget> 43 <addaction name="menuFile"/> 44 <addaction name="menuEdit"/> 45 <addaction name="menu"/> 46 </widget> 47 <widget class="QToolBar" name="mainToolBar"> 48 <attribute name="toolBarArea"> 49 <enum>TopToolBarArea</enum> 50 </attribute> 51 <attribute name="toolBarBreak"> 52 <bool>false</bool> 53 </attribute> 54 </widget> 55 <widget class="QStatusBar" name="statusBar"/> 56 <widget class="QDockWidget" name="dW_Debug"> 57 <attribute name="dockWidgetArea"> 58 <number>2</number> 59 </attribute> 60 <widget class="QWidget" name="dockWidgetContents"/> 61 </widget> 62 <action name="actionAbout"> 63 <property name="text"> 64 <string>About</string> 65 </property> 66 </action> 67 <action name="actionQuit"> 68 <property name="text"> 69 <string>Quit</string> 70 </property> 71 </action> 22 72 </widget> 23 <layoutDefault spacing="6" margin="11" /> 24 <pixmapfunction></pixmapfunction> 73 <layoutdefault spacing="6" margin="11"/> 25 74 <resources> 26 75 <include location="osgvisualgui.qrc"/> 27 76 </resources> 28 77 <connections/> 29 </ UI>78 </ui>
Note: See TracChangeset
for help on using the changeset viewer.