Qt 4.8
Public Functions | Properties | List of all members
QMdi::ControlContainer Class Reference

#include <qmdisubwindow_p.h>

Inheritance diagram for QMdi::ControlContainer:
QObject

Public Functions

 ControlContainer (QMdiSubWindow *mdiChild)
 
QWidgetcontrollerWidget () const
 
QMenuBarmenuBar () const
 
void removeButtonsFromMenuBar (QMenuBar *menuBar=0)
 
void showButtonsInMenuBar (QMenuBar *menuBar)
 
QWidgetsystemMenuLabel () const
 
void updateWindowIcon (const QIcon &windowIcon)
 
 ~ControlContainer ()
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Properties

QPointer< QWidgetm_controllerWidget
 
QPointer< QMenuBarm_menuBar
 
QPointer< QWidgetm_menuLabel
 
QPointer< QMdiSubWindowmdiChild
 
QPointer< QWidgetpreviousLeft
 
QPointer< QWidgetpreviousRight
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 94 of file qmdisubwindow_p.h.

Constructors and Destructors

◆ ControlContainer()

ControlContainer::ControlContainer ( QMdiSubWindow mdiChild)

Definition at line 719 of file qmdisubwindow.cpp.

720  : QObject(mdiChild),
721  previousLeft(0),
722  previousRight(0),
723 #ifndef QT_NO_MENUBAR
724  m_menuBar(0),
725 #endif
726  mdiChild(mdiChild)
727 {
728  Q_ASSERT(mdiChild);
729 
731  connect(m_controllerWidget, SIGNAL(_q_close()), mdiChild, SLOT(close()));
732  connect(m_controllerWidget, SIGNAL(_q_restore()), mdiChild, SLOT(showNormal()));
733  connect(m_controllerWidget, SIGNAL(_q_minimize()), mdiChild, SLOT(showMinimized()));
734 
736  m_menuLabel->setWindowIcon(mdiChild->windowIcon());
737 #ifndef QT_NO_MENU
738  connect(m_menuLabel, SIGNAL(_q_clicked()), mdiChild, SLOT(showSystemMenu()));
739 #endif
740  connect(m_menuLabel, SIGNAL(_q_doubleClicked()), mdiChild, SLOT(close()));
741 }
QPointer< QMdiSubWindow > mdiChild
#define SLOT(a)
Definition: qobjectdefs.h:226
QPointer< QWidget > m_controllerWidget
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QPointer< QMenuBar > m_menuBar
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QIcon windowIcon() const
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
QPointer< QWidget > m_menuLabel
QPointer< QWidget > previousRight
void setWindowIcon(const QIcon &icon)
Definition: qwidget.cpp:6362
QPointer< QWidget > previousLeft
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753

◆ ~ControlContainer()

ControlContainer::~ControlContainer ( )

Definition at line 743 of file qmdisubwindow.cpp.

744 {
745 #ifndef QT_NO_MENUBAR
747 #endif
748  delete m_menuLabel;
749  m_menuLabel = 0;
750  delete m_controllerWidget;
751  m_controllerWidget = 0;
752 }
QPointer< QWidget > m_controllerWidget
QPointer< QWidget > m_menuLabel
void removeButtonsFromMenuBar(QMenuBar *menuBar=0)

Functions

◆ controllerWidget()

QWidget* QMdi::ControlContainer::controllerWidget ( ) const
inline

◆ menuBar()

QMenuBar* QMdi::ControlContainer::menuBar ( ) const
inline

Definition at line 103 of file qmdisubwindow_p.h.

Referenced by removeButtonsFromMenuBar(), and showButtonsInMenuBar().

103 { return m_menuBar; }
QPointer< QMenuBar > m_menuBar

◆ removeButtonsFromMenuBar()

void ControlContainer::removeButtonsFromMenuBar ( QMenuBar menuBar = 0)

Definition at line 810 of file qmdisubwindow.cpp.

Referenced by QMdiSubWindowPrivate::removeButtonsFromMenuBar(), and ~ControlContainer().

811 {
812  if (menuBar && menuBar != m_menuBar) {
813  // m_menubar was deleted while sub-window was maximized
814  previousRight = 0;
815  previousLeft = 0;
816  m_menuBar = menuBar;
817  }
818 
819  if (!m_menuBar || !mdiChild || qt_widget_private(mdiChild->window())->data.in_destructor)
820  return;
821 
822  QMdiSubWindow *child = 0;
823  if (m_controllerWidget) {
825  if (currentRight == m_controllerWidget) {
826  if (ControlElement<ControllerWidget> *ce = ptr<ControllerWidget>(previousRight)) {
827  if (!ce->mdiChild || !ce->mdiChild->isMaximized())
828  previousRight = 0;
829  else
830  child = ce->mdiChild;
831  }
833  if (previousRight) {
834  previousRight->show();
835  previousRight = 0;
836  }
837  }
840  }
841  if (m_menuLabel) {
843  if (currentLeft == m_menuLabel) {
844  if (ControlElement<ControlLabel> *ce = ptr<ControlLabel>(previousLeft)) {
845  if (!ce->mdiChild || !ce->mdiChild->isMaximized())
846  previousLeft = 0;
847  else if (!child)
848  child = mdiChild;
849  }
851  if (previousLeft) {
852  previousLeft->show();
853  previousLeft = 0;
854  }
855  }
856  m_menuLabel->hide();
858  }
859  m_menuBar->update();
860  if (child)
861  child->d_func()->setNewWindowTitle();
862  else if (mdiChild)
863  mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle());
864 }
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
QPointer< QMdiSubWindow > mdiChild
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QPointer< QWidget > m_controllerWidget
QPointer< QMenuBar > m_menuBar
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
QWidget * cornerWidget(Qt::Corner corner=Qt::TopRightCorner) const
Returns the widget on the left of the first or on the right of the last menu item, depending on corner.
Definition: qmenubar.cpp:2022
QPointer< QWidget > m_menuLabel
static const char * data(const QByteArray &arr)
QPointer< QWidget > previousRight
void show()
Shows the widget and its child widgets.
void hide()
Hides the widget.
Definition: qwidget.h:501
QPointer< QWidget > previousLeft
void setCornerWidget(QWidget *w, Qt::Corner corner=Qt::TopRightCorner)
This sets the given widget to be shown directly on the left of the first menu item, or on the right of the last menu item, depending on corner.
Definition: qmenubar.cpp:1980
QMenuBar * menuBar() const
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60

◆ showButtonsInMenuBar()

void ControlContainer::showButtonsInMenuBar ( QMenuBar menuBar)

Definition at line 777 of file qmdisubwindow.cpp.

Referenced by QMdiSubWindowPrivate::showButtonsInMenuBar().

778 {
779  if (!menuBar || !mdiChild || mdiChild->windowFlags() & Qt::FramelessWindowHint)
780  return;
781  m_menuBar = menuBar;
782 
784  QWidget *currentLeft = menuBar->cornerWidget(Qt::TopLeftCorner);
785  if (currentLeft)
786  currentLeft->hide();
787  if (currentLeft != m_menuLabel) {
789  previousLeft = currentLeft;
790  }
791  m_menuLabel->show();
792  }
794  if (controllerWidget && controllerWidget->hasVisibleControls()) {
795  QWidget *currentRight = menuBar->cornerWidget(Qt::TopRightCorner);
796  if (currentRight)
797  currentRight->hide();
798  if (currentRight != m_controllerWidget) {
800  previousRight = currentRight;
801  }
803  }
804  mdiChild->d_func()->setNewWindowTitle();
805 }
QPointer< QMdiSubWindow > mdiChild
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QPointer< QWidget > m_controllerWidget
T * qobject_cast(QObject *object)
Definition: qobject.h:375
QPointer< QMenuBar > m_menuBar
QWidget * cornerWidget(Qt::Corner corner=Qt::TopRightCorner) const
Returns the widget on the left of the first or on the right of the last menu item, depending on corner.
Definition: qmenubar.cpp:2022
QPointer< QWidget > m_menuLabel
QPointer< QWidget > previousRight
void show()
Shows the widget and its child widgets.
void hide()
Hides the widget.
Definition: qwidget.h:501
QPointer< QWidget > previousLeft
void setCornerWidget(QWidget *w, Qt::Corner corner=Qt::TopRightCorner)
This sets the given widget to be shown directly on the left of the first menu item, or on the right of the last menu item, depending on corner.
Definition: qmenubar.cpp:1980
QMenuBar * menuBar() const
QWidget * controllerWidget() const
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
bool hasVisibleControls() const

◆ systemMenuLabel()

QWidget* QMdi::ControlContainer::systemMenuLabel ( ) const
inline

Definition at line 107 of file qmdisubwindow_p.h.

Referenced by QMdiSubWindowPrivate::showButtonsInMenuBar().

107 { return m_menuLabel; }
QPointer< QWidget > m_menuLabel

◆ updateWindowIcon()

void ControlContainer::updateWindowIcon ( const QIcon windowIcon)

Definition at line 868 of file qmdisubwindow.cpp.

869 {
870  if (m_menuLabel)
871  m_menuLabel->setWindowIcon(windowIcon);
872 }
QPointer< QWidget > m_menuLabel
void setWindowIcon(const QIcon &icon)
Definition: qwidget.cpp:6362

Properties

◆ m_controllerWidget

QPointer<QWidget> QMdi::ControlContainer::m_controllerWidget
private

◆ m_menuBar

QPointer<QMenuBar> QMdi::ControlContainer::m_menuBar
private

Definition at line 113 of file qmdisubwindow_p.h.

Referenced by removeButtonsFromMenuBar(), and showButtonsInMenuBar().

◆ m_menuLabel

QPointer<QWidget> QMdi::ControlContainer::m_menuLabel
private

◆ mdiChild

QPointer<QMdiSubWindow> QMdi::ControlContainer::mdiChild
private

◆ previousLeft

QPointer<QWidget> QMdi::ControlContainer::previousLeft
private

Definition at line 110 of file qmdisubwindow_p.h.

Referenced by removeButtonsFromMenuBar(), and showButtonsInMenuBar().

◆ previousRight

QPointer<QWidget> QMdi::ControlContainer::previousRight
private

Definition at line 111 of file qmdisubwindow_p.h.

Referenced by removeButtonsFromMenuBar(), and showButtonsInMenuBar().


The documentation for this class was generated from the following files: