コード例 #1
0
ファイル: objecttree.cpp プロジェクト: Afreeca/qt
AncestorConstIterator::AncestorConstIterator(const QObject& leaf)
{
    m_ancestors.push(&leaf);
    QObject* ancestor = leaf.parent();
    while(ancestor)
    {
        m_ancestors.push(ancestor);
        ancestor = ancestor->parent();
    }
}
コード例 #2
0
QObject* ossimQtApplicationUtility::getRoot(QObject* obj)
{
   if(!obj) return NULL;
   QObject* current = obj;
   while(current->parent())
   {
      current = current->parent();
   }
   
   return current;
}
コード例 #3
0
QModelIndex DemandScenarioModel::parent(const QModelIndex &index) const
{
  if( !index.isValid() )
    return QModelIndex();
    
  QObject *indexObject = static_cast<QObject*>( index.internalPointer() );
  QObject *parentObject = indexObject->parent();
  
  if( parentObject == m_root )
    return QModelIndex();
    
  QObject *grandParentObject = parentObject->parent();
  
  return createIndex( grandParentObject->children().indexOf( parentObject ), 0, parentObject );
}
コード例 #4
0
QModelIndex MyIndexedModel::parent(const QModelIndex &child) const
{
    if (child == QModelIndex() || !child.isValid())
        return QModelIndex();

    QObject *object = static_cast<QObject *>(child.internalPointer());
    QObject *parent = object->parent();

    if (parent == root)
        return QModelIndex();

    QObject *grandParent = parent->parent();

    return createIndex(grandParent->children().indexOf(parent), 0, parent);
}
コード例 #5
0
QObject *QQuickAnimatorProxyJob::findAnimationContext(QQuickAbstractAnimation *a)
{
    QObject *p = a->parent();
    while (p != 0 && qobject_cast<QQuickWindow *>(p) == 0 && qobject_cast<QQuickItem *>(p) == 0)
        p = p->parent();
    return p;
}
コード例 #6
0
bool OffscreenSurface::eventFilter(QObject* originalDestination, QEvent* event) {
    if (!filterEnabled(originalDestination, event)) {
        return false;
    }
#ifdef DEBUG
    // Don't intercept our own events, or we enter an infinite recursion
    {
        auto rootItem = _sharedObject->getRootItem();
        auto quickWindow = _sharedObject->getWindow();
        QObject* recurseTest = originalDestination;
        while (recurseTest) {
            Q_ASSERT(recurseTest != rootItem && recurseTest != quickWindow);
            recurseTest = recurseTest->parent();
        }
    }
#endif

    switch (event->type()) {
        case QEvent::KeyPress:
        case QEvent::KeyRelease: {
            event->ignore();
            if (QCoreApplication::sendEvent(_sharedObject->getWindow(), event)) {
                return event->isAccepted();
            }
            break;
        }

        case QEvent::Wheel: {
            QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
            QPointF transformedPos = mapToVirtualScreen(wheelEvent->pos());
            QWheelEvent mappedEvent(transformedPos, wheelEvent->delta(), wheelEvent->buttons(), wheelEvent->modifiers(),
                                    wheelEvent->orientation());
            mappedEvent.ignore();
            if (QCoreApplication::sendEvent(_sharedObject->getWindow(), &mappedEvent)) {
                return mappedEvent.isAccepted();
            }
            break;
        }
        case QEvent::MouseMove: {
            QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
            QPointF transformedPos = mapToVirtualScreen(mouseEvent->localPos());
            QMouseEvent mappedEvent(mouseEvent->type(), transformedPos, mouseEvent->screenPos(), mouseEvent->button(),
                                    mouseEvent->buttons(), mouseEvent->modifiers());
            if (event->type() == QEvent::MouseMove) {
                // TODO - this line necessary for the QML Tooltop to work (which is not currently being used), but it causes interface to crash on launch on a fresh install
                // need to investigate into why this crash is happening.
                //_qmlContext->setContextProperty("lastMousePosition", transformedPos);
            }
            mappedEvent.ignore();
            if (QCoreApplication::sendEvent(_sharedObject->getWindow(), &mappedEvent)) {
                return mappedEvent.isAccepted();
            }
            break;
        }
        default:
            break;
    }

    return false;
}
コード例 #7
0
ファイル: itemModel.cpp プロジェクト: HBPVIS/Servus
QModelIndex ItemModel::parent(const QModelIndex& index_) const
{
    if (!index_.isValid())
        return QModelIndex();

    QObject* childItem = static_cast<QObject*>(index_.internalPointer());
    QObject* parentItem = childItem->parent();

    if (parentItem == _impl->rootItem.get())
        return QModelIndex();

    if (!parentItem->parent())
        return createIndex(0, 0, parentItem);
    const int row = parentItem->parent()->children().indexOf(parentItem);
    return createIndex(row, 0, parentItem);
}
コード例 #8
0
ファイル: param.cpp プロジェクト: MzHub/cefabs
ParamEnum::ParamEnum( QObject *parent, const char* name, int value, const QString& e, int *ptr ) 
    : AbstractParam(parent, name, QVariant::Int)
{
    m_ptr = ptr;

    QStringList L = e.split('|', QString::SkipEmptyParts);
    if (!L.isEmpty()) {
        for (int i = 0; i < L.size(); ++i) {
            m_keys.append(L[i]);
            m_values.append(i);
        }
    } else {
        QObject *p = parent;
        while (p) {
            const QMetaObject *mo = p->metaObject();
            int index = mo->indexOfEnumerator(e.toLatin1().data());
            if (index >= 0) {
                const QMetaEnum me = mo->enumerator(index);
                for (int i = 0; i < me.keyCount(); ++i) {
                    m_keys.append(me.key(i));
                    m_values.append(me.value(i));
                }
                break;
            }
            p = p->parent();
        }
    }

    m_value = m_defaultValue = value;
    if (m_ptr) *m_ptr = m_value;
}
コード例 #9
0
ファイル: bibletime_init.cpp プロジェクト: Gandh1PL/bibletime
void BibleTime::slotDebugTimeout() {
    QMutexLocker lock(&m_debugWindowLock);
    if (m_debugWindow == 0 || m_debugWindow->isVisible() == false) return;

    QTimer::singleShot(0, this, SLOT(slotDebugTimeout()));
    QObject *w = QApplication::widgetAt(QCursor::pos());
    if (w != 0) {
        QString objectHierarchy;
        do {
            const QMetaObject *m = w->metaObject();
            QString classHierarchy;
            do {
                if (!classHierarchy.isEmpty()) classHierarchy += ": ";
                classHierarchy += m->className();

                m = m->superClass();
            } while (m != 0);
            if (!objectHierarchy.isEmpty()) {
                objectHierarchy += "<br/><b>child of:</b> ";
            } else {
                objectHierarchy += "<b>This widget is:</b> ";
            }
            objectHierarchy += classHierarchy;
            w = w->parent();
        } while (w != 0);
        m_debugWindow->setText(objectHierarchy);
    } else {
        m_debugWindow->setText("No widget");
    }
    m_debugWindow->resize(m_debugWindow->minimumSizeHint());
}
コード例 #10
0
StyleSet::StyleSet(QObject* pParent)
  : QObject(pParent)
  , mpStyleSetProps(StyleSetProps::nullStyleSetProps())
{
  auto* pEngine = StyleEngineHost::globalStyleEngine();

  QObject* p = parent();
  if (p) {
    QQuickItem* pItem = qobject_cast<QQuickItem*>(p);
    if (pItem != nullptr) {
      connect(pItem, &QQuickItem::parentChanged, this, &StyleSet::onParentChanged);
    } else if (p->parent() != nullptr) {
      styleSheetsLogInfo() << "Parent to StyleSet is not a QQuickItem but '"
                           << p->metaObject()->className() << "'. "
                           << "Hierarchy changes for this component won't be detected.";

      if (pEngine) {
        Q_EMIT pEngine->exception(
          QString::fromLatin1("noParentChangeReports"),
          QString::fromLatin1("Hierarchy changes for this component won't be detected"));
      }
    }

    mPath = traversePathUp(p);

    if (!pEngine) {
      connect(StyleEngineHost::globalStyleEngineHost(),
              &StyleEngineHost::styleEngineLoaded, this, &StyleSet::onStyleEngineLoaded);
    }

    setupStyle();
  }
}
コード例 #11
0
void ColumnDropCSVView::mousePressEvent(QMouseEvent *press)
{
	QModelIndex atClick = indexAt(press->pos());
	if (!atClick.isValid() || atClick.row())
		return;

	QRect indexRect = visualRect(atClick);
	QPixmap pix(indexRect.width(), indexRect.height());
	pix.fill(QColor(0,0,0,0));
	render(&pix, QPoint(0, 0),QRegion(indexRect));

	QDrag *drag = new QDrag(this);
	QMimeData *mimeData = new QMimeData;
	mimeData->setData(subsurface_mimedata, atClick.data().toByteArray());
	mimeData->setData(subsurface_index, QString::number(atClick.column()).toUtf8());
	drag->setPixmap(pix);
	drag->setMimeData(mimeData);
	if (drag->exec() != Qt::IgnoreAction){
		QObject *target = drag->target();
		if (target->objectName() ==  "qt_scrollarea_viewport")
			target = target->parent();
		if (target != drag->source())
			model()->setData(atClick, QString());
	}
}
コード例 #12
0
WeatherCfg::WeatherCfg(QWidget *parent, WeatherPlugin *plugin)
        : WeatherCfgBase(parent)
{
    m_plugin = plugin;
    lblLnk->setUrl("http://www.weather.com/?prod=xoap&par=1004517364");
    lblLnk->setText(QString("Weather data provided by weather.com") + QChar((unsigned short)174));
    connect(btnSearch, SIGNAL(clicked()), this, SLOT(search()));
    connect(cmbLocation->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(cmbLocation, SIGNAL(activated(int)), this, SLOT(activated(int)));
    textChanged("");
    fill();
    memset(&m_handler, 0, sizeof(m_handler));
    m_handler.startElement = p_element_start;
    m_handler.endElement   = p_element_end;
    m_handler.characters   = p_char_data;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_iface = new WIfaceCfg(tab, plugin);
        tab->addTab(m_iface, i18n("Interface"));
        tab->adjustSize();
        break;
    }
}
コード例 #13
0
MessageConfig::MessageConfig(QWidget *parent, void *_data)
        : MessageConfigBase(parent)
{
	m_file = NULL;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_file = new FileConfig(tab, _data);
        tab->addTab(m_file, i18n("File"));
        tab->adjustSize();
        break;
    }

    CoreUserData *data = (CoreUserData*)_data;
    chkOnline->setChecked((data->OpenOnOnline) != 0);
    chkStatus->setChecked((data->LogStatus) != 0);
    switch (data->OpenNewMessage){
    case NEW_MSG_NOOPEN:
        btnNoOpen->setChecked(true);
        break;
    case NEW_MSG_MINIMIZE:
        btnMinimize->setChecked(true);
        break;
    case NEW_MSG_RAISE:
        btnRaise->setChecked(true);
        break;
    }
}
コード例 #14
0
void TSBrowserApplication::addNamedJSObject(QObject *wid, const QString& _name)
{
	if( !wid ) return;

	if( _name.isEmpty() || _name.isNull() ) return;

	QObject *p = wid;
	TSMainWindow *_mw = 0;
	TSWebViewer	*_wv = 0;
	
	while(p)
	{	
		_wv = dynamic_cast<TSWebViewer*>(p);
		if( _wv ) 
		{
			_wv->addNamedJSObject(_name);
			return;
		}

		_mw = dynamic_cast<TSMainWindow*>(p);	
		if( _mw ) 
		{
			_mw->currentWebViewr()->addNamedJSObject(_name);
			return;
		}

		p = p->parent();
	}	
}
コード例 #15
0
ファイル: libkvieditor.cpp プロジェクト: kartagis/KVIrc
static bool editor_module_cleanup(KviModule *)
{
	/*
	 * This causes 2 crashes: one in KviApplication destructor (closing windows needs
	 * g_pMainWindow, that is deleted before this unloading routine) and the second in
	 * the codetester window (it deletes us in its denstructor, and we tries to back-delete it)
	 * So it's commented out by now..
	 */

	while(g_pScriptEditorWindowList->first())
	{
		QObject * w = g_pScriptEditorWindowList->first()->parent();
		while(w)
		{
			//qDebug("%s %s %i %s",__FILE__,__FUNCTION__,__LINE__,w->className());
			if(w->inherits("KviWindow"))
			{
			//	qDebug("%s %s %i",__FILE__,__FUNCTION__,__LINE__);
				//((KviWindow *)w)->close();
			//	qDebug("%s %s %i",__FILE__,__FUNCTION__,__LINE__);
				break;
			}
		w = w->parent();
		}
		delete g_pScriptEditorWindowList->first();
	}

	delete g_pScriptEditorWindowList;
	g_pScriptEditorWindowList = 0;

	return true;
}
コード例 #16
0
ファイル: qaction.cpp プロジェクト: 3163504123/phantomjs
/*!
    Returns the parent widget.
*/
QWidget *QAction::parentWidget() const
{
    QObject *ret = parent();
    while (ret && !ret->isWidgetType())
        ret = ret->parent();
    return (QWidget*)ret;
}
コード例 #17
0
ファイル: osdconfig.cpp プロジェクト: BackupTheBerlios/sim-im
OSDConfig::OSDConfig(QWidget *parent, SIM::PropertyHubPtr data, OSDPlugin *plugin)
  : QWidget(parent)
  , m_plugin(plugin)
{
    setupUi(this);
    chkMessage->setChecked(data->value("EnableMessage").toBool());
    chkMessageContent->setChecked(data->value("EnableMessageShowContent").toBool());
    chkCapsLockFlash->setChecked(data->value("EnableCapsLockFlash").toBool());
    chkStatus->setChecked(data->value("EnableAlert").toBool());
    chkStatusOnline->setChecked(data->value("EnableAlertOnline").toBool());
    chkStatusAway->setChecked(data->value("EnableAlertAway").toBool());
    chkStatusNA->setChecked(data->value("EnableAlertNA").toBool());
    chkStatusDND->setChecked(data->value("EnableAlertDND").toBool());
    chkStatusOccupied->setChecked(data->value("EnableAlertOccupied").toBool());
    chkStatusFFC->setChecked(data->value("EnableAlertFFC").toBool());
    chkStatusOffline->setChecked(data->value("EnableAlertOffline").toBool());
    chkTyping->setChecked(data->value("EnableTyping").toBool());
    for (QObject *p = parent; p != NULL; p = p->parent()){
        QTabWidget *tab = qobject_cast<QTabWidget*>(p);
        if (!tab)
            continue;
		SIM::PropertyHubPtr data = getContacts()->getUserData("OSD");
        m_iface = new OSDIface(tab, data, plugin);
        tab->addTab(m_iface, i18n("&Interface"));
        break;
    }
    edtLines->setValue(data->value("ContentLines").toUInt());
    connect(chkStatus, SIGNAL(toggled(bool)), this, SLOT(statusToggled(bool)));
    connect(chkMessage, SIGNAL(toggled(bool)), this, SLOT(showMessageToggled(bool)));
    connect(chkMessageContent, SIGNAL(toggled(bool)), this, SLOT(contentToggled(bool)));
    showMessageToggled(chkMessage->isChecked());
    contentToggled(chkMessageContent->isChecked());
    statusToggled(data->value("EnableAlert").toBool());
}
コード例 #18
0
OSDConfig::OSDConfig(QWidget *parent, void *d, OSDPlugin *plugin)
        : OSDConfigBase(parent)
{
    m_plugin = plugin;
    OSDUserData *data = (OSDUserData*)d;
    chkMessage->setChecked(data->EnableMessage.bValue);
    chkMessageContent->setChecked(data->EnableMessageShowContent.bValue);
    chkStatus->setChecked(data->EnableAlert.bValue);
    chkStatusOnline->setChecked(data->EnableAlertOnline.bValue);
    chkStatusAway->setChecked(data->EnableAlertAway.bValue);
    chkStatusNA->setChecked(data->EnableAlertNA.bValue);
    chkStatusDND->setChecked(data->EnableAlertDND.bValue);
    chkStatusOccupied->setChecked(data->EnableAlertOccupied.bValue);
    chkStatusFFC->setChecked(data->EnableAlertFFC.bValue);
    chkStatusOffline->setChecked(data->EnableAlertOffline.bValue);
    chkTyping->setChecked(data->EnableTyping.bValue);
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        void *data = getContacts()->getUserData(plugin->user_data_id);
        m_iface = new OSDIface(tab, data, plugin);
        tab->addTab(m_iface, i18n("&Interface"));
        break;
    }
    edtLines->setValue(data->ContentLines.value);
    connect(chkStatus, SIGNAL(toggled(bool)), this, SLOT(statusToggled(bool)));
    connect(chkMessage, SIGNAL(toggled(bool)), this, SLOT(showMessageToggled(bool)));
    connect(chkMessageContent, SIGNAL(toggled(bool)), this, SLOT(contentToggled(bool)));
    showMessageToggled(chkMessage->isChecked());
    contentToggled(chkMessageContent->isChecked());
    statusToggled(data->EnableAlert.bValue);
}
コード例 #19
0
ファイル: fileserver.cpp プロジェクト: mnutt/pillow
	virtual bool handleRequest(Pillow::HttpRequest* rq)
	{
		HttpServer* server = NULL;
		HttpHandler* handler = NULL;
		
		for (QObject* h = parent(); h != NULL; h = h->parent())
		{
			if (qobject_cast<HttpHandler*>(h)) handler = static_cast<HttpHandler*>(h);
			else if (qobject_cast<HttpServer*>(h)) server = static_cast<HttpServer*>(h);
		}
		
		if (rq->requestPath() == "/_stats")
		{
			QByteArray result;
			if (server != NULL)
			{
				result.append("Alive connections: ").append(QByteArray::number(server->findChildren<Pillow::HttpRequest*>().size())).append("\n");
			}
			if (handler != NULL)
			{
				result.append("Alive big file transfers: ").append(QByteArray::number(handler->findChildren<Pillow::HttpHandlerFileTransfer*>().size())).append("\n");
			}
			
			rq->writeResponse(200, HttpHeaderCollection(), result);
			return true;
		}
		return false;
	}
コード例 #20
0
ファイル: navigation.cpp プロジェクト: berntsim/sonetta
bool Navigation::dispatchNavigationEvent(NavEvent *event)
{
    if (event->key() == Navigation::Undefined)
        return false;

    QObject * receiver = QGuiApplication::focusObject();

    while (receiver && !event->isAccepted())
    {
        // Send to object
        QCoreApplication::sendEvent(receiver, event);

        if (!event->isAccepted())
        {
            // Send to attached item
            QObject * attachee = qmlAttachedPropertiesObject<Navigation>(receiver, false);

            if (attachee)
                QCoreApplication::sendEvent(attachee, event);

            // Try parent next, visual items if Quick items
            QQuickItem * qItem = qobject_cast<QQuickItem *>(receiver);
            if (qItem && qItem->parentItem())
                receiver = qItem->parentItem();
            else
                receiver = receiver->parent();
        }
    }

    return event->isAccepted();
}
コード例 #21
0
int main() {
    QObject* pobj1 = new QObject;
    QObject* pobj2 = new QObject(pobj1);
    QObject* pobj4 = new QObject(pobj2);
    QObject* pobj3 = new QObject(pobj1);
    pobj2->setObjectName("the first child of pobj1");
    pobj3->setObjectName("the second child of pobj1");
    pobj4->setObjectName("the first child of pobj2");

    for (QObject* pobj = pobj4; pobj; pobj = pobj->parent()) {
        qDebug() << pobj->objectName();
    }

    QObject* pobj =
        pobj1->findChild<QObject*>("the first child of pobj2");
    QList<QObject*> plist1 = 
        pobj1->findChildren<QObject*>(QRegExp("th*"));
    QList<QObject*> plist2 =
        pobj1->findChildren<QObject*>();

    pobj1->dumpObjectInfo();
    pobj1->dumpObjectTree();

    qDebug() << pobj1->metaObject()->className();

    return 0;
}
コード例 #22
0
ファイル: msgcfg.cpp プロジェクト: BackupTheBerlios/sim-im
MessageConfig::MessageConfig(QWidget *parent, SIM::PropertyHubPtr _data)
  : QWidget(parent)
{
    setupUi(this);
    m_file = NULL;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        QTabWidget *tab = qobject_cast<QTabWidget*>(p);
        if(!tab)
            continue;
        m_file = new FileConfig(tab, _data);
        tab->addTab(m_file, i18n("File"));
        tab->adjustSize();
        break;
    }

	SIM::PropertyHubPtr data = _data;
    chkOnline->setChecked(data->value("OpenOnOnline").toBool());
    chkStatus->setChecked(data->value("LogStatus").toBool());
    switch (data->value("OpenNewMessage").toUInt()){
    case NEW_MSG_NOOPEN:
        btnNoOpen->setChecked(true);
        break;
    case NEW_MSG_MINIMIZE:
        btnMinimize->setChecked(true);
        break;
    case NEW_MSG_RAISE:
        btnRaise->setChecked(true);
        break;
    }
}
コード例 #23
0
ファイル: menumanager.cpp プロジェクト: serghei/kde3-kdebase
void MenuManager::kmenuAccelActivated()
{
    if(m_kmenu->isVisible())
    {
        m_kmenu->hide();
        return;
    }

    m_kmenu->initialize();

    if(m_kbuttons.isEmpty())
    {
        // no button to use, make it behave like a desktop menu
        QPoint p;
        // Popup the K-menu at the center of the screen.
        QDesktopWidget *desktop = KApplication::desktop();
        QRect r = desktop->screenGeometry(desktop->screenNumber(QCursor::pos()));
        // kMenu->rect() is not valid before showing, use sizeHint()
        p = r.center() - QRect(QPoint(0, 0), m_kmenu->sizeHint()).center();
        m_kmenu->popup(p);

        // when the cursor is in the area where the menu pops up,
        // the item under the cursor gets selected. The single shot
        // avoids this from happening by allowing the item to be selected
        // when the event loop is enterred, and then resetting it.
        QTimer::singleShot(0, this, SLOT(slotSetKMenuItemActive()));
    }
    else
    {
        // We need the kmenu's size to place it at the right position.
        // We cannot rely on the popup menu's current size(), if it wasn't
        // shown before, so we resize it here according to its sizeHint().
        const QSize size = m_kmenu->sizeHint();
        m_kmenu->resize(size.width(), size.height());

        PanelPopupButton *button = findKButtonFor(m_kmenu);

        // let's unhide the panel while we're at it. traverse the widget
        // hierarchy until we find the panel, if any
        QObject *menuParent = button->parent();
        while(menuParent)
        {
            ExtensionContainer *ext = dynamic_cast< ExtensionContainer * >(menuParent);

            if(ext)
            {
                ext->unhideIfHidden();
                // make sure it's unhidden before we use it to figure out
                // where to popup
                qApp->processEvents();
                break;
            }

            menuParent = menuParent->parent();
        }

        button->showMenu();
    }
}
コード例 #24
0
ファイル: actioncfg.cpp プロジェクト: BackupTheBerlios/sim-im
ActionConfig::ActionConfig(QWidget *parent, SIM::PropertyHubPtr data, ActionPlugin *plugin)
  : QWidget(parent)
  , m_menu(NULL)
  , m_data(data)
  , m_plugin(plugin)
{
    setupUi(this);
    setButtonsPict(this);

    connect(btnHelp, SIGNAL(clicked()), this, SLOT(help()));

    int row = 0;
    addRow(lstEvent, row, Icon("SIM"), i18n("Contact online"), CONTACT_ONLINE, data->value("OnLine").toString() );

    row++;
    addRow(lstEvent, row, Icon("SIM"), i18n("Status changed"), CONTACT_STATUS, data->value("Status").toString() );

    CommandDef *cmd;
    CorePlugin *core = GET_CorePlugin();
    CommandsMapIterator it(core->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if ((def == NULL) || (cmd->icon.isEmpty()) ||
                (def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
            continue;
        if ((def->singular == NULL) || (def->plural == NULL) ||
                (*def->singular == 0) || (*def->plural == 0))
            continue;
        QString type = i18n(def->singular, def->plural, 1);
        int pos = type.indexOf("1 ");
        if (pos == 0){
            type = type.mid(2);
        }else if (pos > 0){
            type = type.left(pos);
        }
        type = type.left(1).toUpper() + type.mid(1);

        row++;
        addRow(lstEvent, row, Icon(cmd->icon), type, cmd->id, data->stringMapValue("Message", cmd->id));
    }
    EventTmplHelpList e;
    e.process();
    LineEditDelegate *dg = new LineEditDelegate(1, lstEvent);
    dg->setHelpList(e.helpList());
    lstEvent->setItemDelegate(dg);
    lstEvent->resizeColumnToContents(0);
    lstEvent->sortByColumn(0, Qt::AscendingOrder);

    for (QObject *p = parent; p != NULL; p = p->parent()){
        QTabWidget *tab = qobject_cast<QTabWidget*>(p);
        if (!tab)
            continue;
        m_menu = new MenuConfig(tab, data);
        tab->addTab(m_menu, i18n("Menu"));
        tab->adjustSize();
        break;
    }
}
コード例 #25
0
ファイル: GUITestWindow.cpp プロジェクト: m-angelov/ugene
void GUITestingWindow::sl_getParentInfo(){
    QObject* o = filter->getBufferObject();
    if(o == NULL || o->parent() == NULL){
        label->setText("parent is NULL!");
        return;
    }
    filter->getInfo(qobject_cast<QWidget*>(filter->getBufferObject()->parent()));
    updateTable();
}
コード例 #26
0
ファイル: vtkWidget.cpp プロジェクト: WeiqiJust/DrawOn3D
VtkView * VtkWidget::mvc()
{
  QObject * curParent = this->parent();
  while(qobject_cast<VtkView *>(curParent) == 0)
  {
    curParent = curParent->parent();
  }
  return qobject_cast<VtkView *>(curParent);
}
コード例 #27
0
QTabWidgetqq *QTabWidgetsContainer::focusQTabWidgetqq(bool fallback)
{
    QObject *focus = this->focusWidget();

    if(focus == 0) {
        if(fallback && this->count() > 0)
            return this->QTabWidgetqqAt(0);
        else
            return 0;
    } else {
        // Find the first top level focused widget
        while(focus->parent() != this) {
            focus = focus->parent();
        }

        return static_cast<QTabWidgetqq *>(focus);
    }
}
コード例 #28
0
ファイル: webview.cpp プロジェクト: mariuz/fram
TabWidget *WebView::tabWidget() const
{
    QObject *widget = this->parent();
    while (widget) {
        if (TabWidget *tw = qobject_cast<TabWidget*>(widget))
            return tw;
        widget = widget->parent();
    }
    return 0;
}
コード例 #29
0
ファイル: misc.cpp プロジェクト: bacchante95/fritzing
bool isParent(QObject * candidateParent, QObject * candidateChild) {
	QObject * parent = candidateChild->parent();
	while (parent) {
		if (parent == candidateParent) return true;

		parent = parent->parent();
	}

	return false;
}
コード例 #30
0
BrowserMainWindow *WebPage::mainWindow()
{
    QObject *w = this->parent();
    while (w) {
        if (BrowserMainWindow *mw = qobject_cast<BrowserMainWindow*>(w))
            return mw;
        w = w->parent();
    }
    return BrowserApplication::instance()->mainWindow();
}