31 #if defined(G4UI_BUILD_QT_SESSION) || defined(G4UI_USE_QT)
40 #include <qstringlist.h>
41 #include <qtabwidget.h>
42 #include <qdockwidget.h>
50 class QTreeWidgetItem;
63 class QStandardItemModel;
86 class G4QTabWidget :
public QTabWidget {
89 G4QTabWidget(QWidget* aParent,
int sizeX,
int sizeY);
90 void paintEvent ( QPaintEvent * event );
91 inline void setTabSelected(
bool a) { fTabSelected =
a; };
92 inline void setLastTabCreated(
int a) { fLastCreated =
a; };
93 inline bool isTabSelected() {
return fTabSelected; };
98 inline void setPreferredSize(QSize
s) {
99 fPreferedSizeX = s.width() + 6;
100 fPreferedSizeY = s.height() + 58;
102 inline QSize sizeHint ()
const {
103 return QSize(fPreferedSizeX, fPreferedSizeY);
107 class G4UIOutputString {
109 G4UIOutputString(QString text,
G4String thread =
"",
G4String outputstream=
"info");
110 inline QString GetOutputList() {
return " all info warning error ";};
117 class G4UIDockWidget :
public QDockWidget {
119 G4UIDockWidget(QString txt);
120 void closeEvent(QCloseEvent *);
132 void AddMenu(
const char*,
const char*);
137 void AddButton(
const char*,
const char*,
const char*);
143 void AddIcon(
const char* userLabel,
const char* iconFile,
const char* command,
const char* file_name=
"");
154 bool AddTabWidget(QWidget*,QString);
157 inline QTabWidget* GetViewerTabWidget() {
158 return fViewerTabWidget;
161 QWidget* GetSceneTreeWidget();
164 QWidget* GetViewerPropertiesWidget();
167 QWidget* GetPickInfosWidget();
170 bool IsSplitterReleased();
172 inline bool IsIconMoveSelected() {
173 return fMoveSelected;
175 inline bool IsIconRotateSelected() {
176 return fRotateSelected;
178 inline bool IsIconPickSelected() {
179 return fPickSelected;
181 inline bool IsIconZoomInSelected() {
182 return fZoomInSelected;
184 inline bool IsIconZoomOutSelected() {
185 return fZoomOutSelected;
188 void SetIconMoveSelected();
189 void SetIconRotateSelected();
190 void SetIconPickSelected();
191 void SetIconZoomInSelected();
192 void SetIconZoomOutSelected();
193 void SetIconHLHSRSelected();
194 void SetIconHLRSelected();
195 void SetIconSolidSelected();
196 void SetIconWireframeSelected();
197 void SetIconPerspectiveSelected();
198 void SetIconOrthoSelected();
200 inline QMainWindow * GetMainWindow() {
205 inline QPixmap* getSearchIcon() {
return fSearchIcon;};
207 inline QPixmap* getClearIcon() {
return fClearIcon;};
210 void SetStartPage(
const std::string&);
215 inline QWidget* GetCoutWidget() {
216 return fCoutDockWidget->widget();
220 inline G4UIDockWidget* GetCoutDockWidget() {
221 return fCoutDockWidget;
225 inline G4UIDockWidget* GetUserInterfaceWidget() {
226 return fUIDockWidget;
230 inline QTabWidget* GetUITabWidget() {
235 inline QWidget* GetHistoryWidget() {
236 return fHistoryTBWidget;
240 inline QWidget* GetHelpWidget() {
241 return fHelpTBWidget;
245 bool AddViewerTab(QWidget*
w, std::string
title);
248 bool AddViewerTabFromFile(std::string fileName, std::string
title);
254 void SessionTerminate();
262 void CreateHelpWidget();
263 void InitHelpTreeAndVisParametersWidget();
265 void UpdateCommandCompleter();
268 void SetDefaultIconsToolbar();
271 QTreeWidgetItem* FindTreeItem(QTreeWidgetItem *,
const QString&);
276 bool eventFilter(QObject*,QEvent*);
278 QMap<int,QString> LookForHelpStringInChildTree(
G4UIcommandTree *,
const QString&);
280 QWidget* CreateVisParametersTBWidget();
281 QWidget* CreateHelpTBWidget();
282 G4UIDockWidget* CreateCoutTBWidget();
283 QWidget* CreateHistoryTBWidget();
284 G4UIDockWidget* CreateUITabWidget();
285 QWidget* CreateSceneTreeWidget();
286 void CreateViewerWidget();
287 void OpenHelpTreeOnCommand(
const QString &);
288 QString GetShortCommandPath(QString);
289 QString GetLongCommandPath(QTreeWidgetItem*);
291 bool CreateVisCommandGroupAndToolBox(
G4UIcommand*, QWidget*,
int,
bool isDialog);
292 bool CreateCommandWidget(
G4UIcommand* command, QWidget* parent,
bool isDialog);
293 void CreateViewerPropertiesDialog();
294 void CreatePickInfosDialog();
295 #ifdef G4MULTITHREADED
296 void UpdateCoutThreadFilter();
298 void FilterAllOutputTextArea();
299 QString FilterOutput(
const G4UIOutputString&,
const QString&,
const QString&);
301 bool CheckG4EnvironmentVariable(
char* txt,
char*
version);
302 QStandardItemModel* CreateCompleterModel(
G4String aCmd);
303 void CreateEmptyViewerPropertiesWidget();
304 void CreateEmptyPickInfosWidget();
307 QMainWindow * fMainWindow;
308 QLabel *fCommandLabel;
309 QLineEdit * fCommandArea;
310 QTextEdit *fCoutTBTextArea;
311 QTabWidget* fUITabWidget;
312 std::vector <G4UIOutputString> fG4OutputString;
313 QLineEdit * fCoutFilter;
314 QCompleter* fCompleter;
317 QListWidget *fHistoryTBTableList;
318 QTreeWidget *fHelpTreeWidget;
319 QWidget* fHelpTBWidget;
320 QWidget* fHistoryTBWidget;
321 G4UIDockWidget* fCoutDockWidget;
322 G4UIDockWidget* fUIDockWidget;
323 QWidget* fSceneTreeWidget;
324 QWidget* fViewerPropertiesWidget;
325 QWidget* fPickInfosWidget;
326 QLineEdit* fHelpLine;
327 G4QTabWidget* fViewerTabWidget;
329 QTextEdit *fStartPage;
330 QSplitter * fHelpVSplitter;
331 QTextEdit* fParameterHelpLabel;
332 QTableWidget* fParameterHelpTable;
334 QToolBar *fToolbarApp;
335 QToolBar *fToolbarUser;
336 QString fStringSeparator;
338 QString fLastOpenPath;
339 QToolButton* fViewModePopupButton;
340 QToolButton* fSurfaceModePopupButton;
342 QPixmap* fSearchIcon;
347 QPixmap* fRotateIcon;
349 QPixmap* fZoomInIcon;
350 QPixmap* fZoomOutIcon;
351 QPixmap* fWireframeIcon;
353 QPixmap* fHiddenLineRemovalIcon;
354 QPixmap* fHiddenLineAndSurfaceRemovalIcon;
355 QPixmap* fPerspectiveIcon;
357 QPixmap* fCommandIcon;
361 QPixmap* fPickTargetIcon;
363 #ifdef G4MULTITHREADED
364 QComboBox* fThreadsFilterComboBox;
366 std::string fDefaultViewerFirstPageHTMLText;
368 QDialog* fViewerPropertiesDialog;
369 QDialog* fPickInfosDialog;
370 QString fLastCompleteCommand;
372 bool fRotateSelected;
374 bool fZoomInSelected;
375 bool fZoomOutSelected;
379 void ClearButtonCallback();
380 void SaveOutputCallback();
381 void CommandEnteredCallback();
382 void CommandEditedCallback(
const QString & text);
383 void ButtonCallback(
const QString&);
384 void HelpTreeClicCallback();
385 void HelpTreeDoubleClicCallback();
386 void ShowHelpCallback();
387 void CommandHistoryCallback();
388 void LookForHelpStringCallback();
389 void UpdateTabWidget(
int);
390 void ResizeTabWidget( QResizeEvent* );
391 void CoutFilterCallback(
const QString&);
392 void ThreadComboBoxCallback(
int);
393 void TabCloseCallback(
int);
394 void ToolBoxActivated(
int);
395 void VisParameterCallback(QWidget*);
396 void ChangeColorCallback(QWidget*);
397 void ChangeCursorAction(
const QString&);
398 void ChangeSurfaceStyle(
const QString&);
399 void OpenIconCallback(
const QString&);
400 void SaveIconCallback(
const QString&);
401 void ViewerPropertiesIconCallback(
int);
402 void ChangePerspectiveOrtho(
const QString&);