void qt_tm_widget_rep::set_full_screen(bool flag) { full_screen = flag; QWidget *win = mainwindow()->window(); if (win) { if (flag ) { #ifdef UNIFIED_TOOLBAR if (use_unified_toolbar) { //HACK: we disable unified toolbar since otherwise // the application will crash when we return to normal mode // (bug in Qt? present at least with 4.7.1) mainwindow()->setUnifiedTitleAndToolBarOnMac(false); mainwindow()->centralWidget()->layout()->setContentsMargins(0,0,0,0); } #endif // mainwindow()->window()->setContentsMargins(0,0,0,0); //win->showFullScreen(); win->setWindowState(win->windowState() ^ Qt::WindowFullScreen); } else { bool cache = visibility[0]; visibility[0] = false; update_visibility(); // win->showNormal(); win->setWindowState(win->windowState() ^ Qt::WindowFullScreen); visibility[0] = cache; update_visibility(); #ifdef UNIFIED_TOOLBAR if (use_unified_toolbar) { mainwindow()->centralWidget()->layout()->setContentsMargins (0,1,0,0); //HACK: we reenable unified toolbar (see above HACK) // the application will crash when we return to normal mode mainwindow()->setUnifiedTitleAndToolBarOnMac(true); } #endif } } scrollarea()->setHorizontalScrollBarPolicy(flag ? Qt::ScrollBarAlwaysOff : Qt::ScrollBarAsNeeded); scrollarea()->setVerticalScrollBarPolicy(flag ? Qt::ScrollBarAlwaysOff : Qt::ScrollBarAsNeeded); }
void qt_tm_widget_rep::write (slot s, blackbox index, widget w) { if (DEBUG_QT_WIDGETS) debug_widgets << "qt_tm_widget_rep::write " << slot_name (s) << LF; switch (s) { // Widget w is usually a qt_simple_widget_rep, with a QTMWidget as // underlying widget. We must discard the current main_widget and // display the new. But while switching buffers the widget w is a // glue_widget, so we may not just use canvas() everywhere. case SLOT_SCROLLABLE: { check_type_void (index, s); QWidget* q = main_widget->qwid; q->hide(); QLayout* l = centralwidget()->layout(); l->removeWidget(q); q = concrete(w)->as_qwidget(); // force creation of the new QWidget l->addWidget(q); /* " When you use a layout, you do not need to pass a parent when constructing the child widgets. The layout will automatically reparent the widgets (using QWidget::setParent()) so that they are children of the widget on which the layout is installed " */ main_widget = concrete (w); // canvas() now returns the new QTMWidget (or 0) if (scrollarea()) // Fix size to draw margins around. scrollarea()->surface()->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed); send_keyboard_focus (abstract (main_widget)); } break; case SLOT_MAIN_MENU: check_type_void (index, s); { waiting_main_menu_widget = concrete (w); if (menu_count <= 0) install_main_menu(); else if (!contains (waiting_widgets, this)) // menu interaction ongoing, postpone new menu installation until done waiting_widgets << this; } break; case SLOT_MAIN_ICONS: check_type_void (index, s); { main_icons_widget = concrete (w); QMenu* m = main_icons_widget->get_qmenu(); if (m) { replaceButtons (mainToolBar, m); update_visibility(); } } break; case SLOT_MODE_ICONS: check_type_void (index, s); { mode_icons_widget = concrete (w); QMenu* m = mode_icons_widget->get_qmenu(); if (m) { replaceButtons (modeToolBar, m); update_visibility(); } } break; case SLOT_FOCUS_ICONS: check_type_void (index, s); { focus_icons_widget = concrete (w); QMenu* m = focus_icons_widget->get_qmenu(); if (m) { replaceButtons (focusToolBar, m); update_visibility(); } } break; case SLOT_USER_ICONS: check_type_void (index, s); { user_icons_widget = concrete (w); QMenu* m = user_icons_widget->get_qmenu(); if (m) { replaceButtons (userToolBar, m); update_visibility(); } } break; case SLOT_SIDE_TOOLS: check_type_void (index, s); { side_tools_widget = concrete (w); QWidget* new_qwidget = side_tools_widget->as_qwidget(); QWidget* old_qwidget = sideTools->widget(); if (old_qwidget) old_qwidget->deleteLater(); sideTools->setWidget (new_qwidget); update_visibility(); new_qwidget->show(); } break; case SLOT_BOTTOM_TOOLS: check_type_void (index, s); { bottom_tools_widget = concrete (w); QWidget* new_qwidget = bottom_tools_widget->as_qwidget(); QWidget* old_qwidget = bottomTools->widget(); if (old_qwidget) old_qwidget->deleteLater(); bottomTools->setWidget (new_qwidget); update_visibility(); new_qwidget->show(); } break; case SLOT_INTERACTIVE_PROMPT: check_type_void (index, s); int_prompt= concrete (w); break; case SLOT_INTERACTIVE_INPUT: check_type_void (index, s); int_input= concrete (w); break; default: qt_window_widget_rep::write (s, index, w); } }