Qt 4.8
Classes | Functions
qmainwindow.cpp File Reference
#include "qmainwindow.h"
#include "qmainwindowlayout_p.h"
#include "qdockwidget.h"
#include "qtoolbar.h"
#include <qapplication.h>
#include <qmenubar.h>
#include <qstatusbar.h>
#include <qevent.h>
#include <qstyle.h>
#include <qdebug.h>
#include <qpainter.h>
#include <private/qwidget_p.h>
#include "qtoolbar_p.h"
#include "qwidgetanimator_p.h"
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>

Go to the source code of this file.

Classes

class  QMainWindowPrivate
 

Functions

static bool checkDockWidgetArea (Qt::DockWidgetArea area, const char *where)
 
static bool checkToolBarArea (Qt::ToolBarArea area, const char *where)
 
OSWindowRef qt_mac_window_for (const QWidget *)
 
QMainWindowLayoutqt_mainwindow_layout (const QMainWindow *mainWindow)
 

Function Documentation

◆ checkDockWidgetArea()

static bool checkDockWidgetArea ( Qt::DockWidgetArea  area,
const char *  where 
)
static

Definition at line 1003 of file qmainwindow.cpp.

Referenced by QMainWindow::addDockWidget(), and QMainWindow::tabPosition().

1004 {
1005  switch (area) {
1008  case Qt::TopDockWidgetArea:
1010  return true;
1011  default:
1012  break;
1013  }
1014  qWarning("%s: invalid 'area' argument", where);
1015  return false;
1016 }
Q_CORE_EXPORT void qWarning(const char *,...)
static int area(const QSize &s)
Definition: qicon.cpp:155

◆ checkToolBarArea()

static bool checkToolBarArea ( Qt::ToolBarArea  area,
const char *  where 
)
static

Definition at line 714 of file qmainwindow.cpp.

Referenced by QMainWindow::addToolBar(), and QMainWindow::addToolBarBreak().

715 {
716  switch (area) {
717  case Qt::LeftToolBarArea:
719  case Qt::TopToolBarArea:
721  return true;
722  default:
723  break;
724  }
725  qWarning("%s: invalid 'area' argument", where);
726  return false;
727 }
Q_CORE_EXPORT void qWarning(const char *,...)
static int area(const QSize &s)
Definition: qicon.cpp:155

◆ qt_mac_window_for()

OSWindowRef qt_mac_window_for ( const QWidget )

Definition at line 484 of file qwidget_mac.mm.

485 {
486  if (OSViewRef hiview = qt_mac_effectiveview_for(w)) {
488  if (window)
489  return window;
490 
491  if (qt_isGenuineQWidget(hiview)) {
492  // This is a workaround for NSToolbar. When a widget is hidden
493  // by clicking the toolbar button, Cocoa reparents the widgets
494  // to another window (but Qt doesn't know about it).
495  // When we start showing them, it reparents back,
496  // but at this point it's window is nil, but the window it's being brought
497  // into (the Qt one) is for sure created.
498  // This stops the hierarchy moving under our feet.
499  QWidget *toplevel = w->window();
500  if (toplevel != w) {
501  hiview = qt_mac_nativeview_for(toplevel);
502  if (OSWindowRef w = qt_mac_window_for(hiview))
503  return w;
504  }
505 
506  toplevel->d_func()->createWindow_sys();
507  // Reget the hiview since "create window" could potentially move the view (I guess).
508  hiview = qt_mac_nativeview_for(toplevel);
509  return qt_mac_window_for(hiview);
510  }
511  }
512  return 0;
513 }
Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
Definition: qwidget_mac.mm:453
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
NSWindow * window
static bool qt_isGenuineQWidget(OSViewRef ref)
Definition: qwidget_mac.mm:464
WindowRef OSWindowRef
Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
Definition: qwidget_mac.mm:419
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
HIViewRef OSViewRef
Q_GUI_EXPORT OSViewRef qt_mac_effectiveview_for(const QWidget *w)
Definition: qwidget_mac.mm:424

◆ qt_mainwindow_layout()

QMainWindowLayout* qt_mainwindow_layout ( const QMainWindow mainWindow)