oopapidocs  2.0
qobjectbrowseraction.cpp
00001 
00002 #include "qobjectbrowseraction.h"
00003 
00004 QObjectBrowserAction::QObjectBrowserAction(QObject* parent)
00005         : QAction(tr("Object Browser"), parent), 
00006         m_browser(0) {
00007         setObjectName(tr("ObjectBrowserAction"));
00008         setCheckable(true);
00009         connect (this, SIGNAL(triggered(bool)), this, SLOT(setChecked(bool)));
00010         if (parent == 0)
00011             connect (qApp, SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));
00012     }
00013 
00014     bool QObjectBrowserAction::isChecked() const {
00015         if (m_browser.isNull()) return false;
00016         return m_browser->isVisible();
00017     }
00018 
00019     void QObjectBrowserAction::setChecked(bool checked) {
00020         QAction::setChecked(checked);
00021         if (checked && m_browser.isNull()) {
00022             m_browser.reset(new QObjectBrowser);
00023             connect (m_browser.data(), SIGNAL(hidden()),
00024                      this, SLOT(checkCheck()));
00025         }
00026         m_browser->setVisible(checked);
00027     }
00028 
00029     void QObjectBrowserAction::checkCheck() {
00030         setChecked(false);
00031     }
 All Classes Namespaces Functions Enumerations