Ejemplo n.º 1
0
void MenuItemMgr::insertMenu( QMenu* menu , QWidgetAction* item )
{
	Q_ASSERT( menu!= NULL ) ;

	QAction* action = NULL ;
	QObjectList::iterator it ;

	QActionGroup* pActionGroup = myMainWindow->getActionGroup() ;
	Q_ASSERT( pActionGroup!= NULL ) ;

	QObjectList menuitems = item->children() ;
	for( it = menuitems.begin() ; it != menuitems.end() ; it++ )
	{
		QWidgetAction *wa = (QWidgetAction*)*it ; 
		if( wa->children().isEmpty() )
		{
			//action = menu->addAction( wa->icon() , wa->text() ) ;
			menu->addAction(wa);
			registerAction( wa ) ;
			pActionGroup->addAction( wa ) ;
		}
		else
			insertMenu( menu , wa ) ;
	}
}
Ejemplo n.º 2
0
void LteMainWindow::loadPlugins()
{
    QObjectList objList = QPluginLoader::staticInstances();
    for(QObjectList::iterator it = objList.begin(); it != objList.end(); ++it)
    {
        populateMenus(*it);
    }

    pluginsDir = QDir(qApp->applicationDirPath());
    pluginsDir.cd("plugins");

    QStringList fileList = pluginsDir.entryList(QDir::Files);
    for(QStringList::iterator it = fileList.begin(); it != fileList.end(); ++it)
    {
        QPluginLoader loader(pluginsDir.absoluteFilePath(*it));
        QObject *plugin = loader.instance();
        if(plugin)
        {
            populateMenus(plugin);
            pluginFileNames += *it;
        }
    }

    lteMenu->setEnabled(!lteMenu->actions().isEmpty());
    miscMenu->setEnabled(!miscMenu->actions().isEmpty());
}
Ejemplo n.º 3
0
bool MenuItemMgr::updateRibbonMenu( Qtitan::RibbonBar* ribonBar)
{
	QObjectList::iterator it , git ;
	Q_ASSERT( myMainWindow!= NULL ) ;
	Q_ASSERT( myMenuItems!= NULL ) ;

	QObjectList pages = myMenuItems->children() ;

	for( it = pages.begin() ; it != pages.end() ; it++ )
	{
		QWidgetAction *wa = (QWidgetAction*)*it ; 
		if( wa != NULL )
		{
			Qtitan::RibbonPage* page = ribonBar->addPage( wa->text() );
			if( page != NULL )
			{
				insertMenu( page , wa ) ;
			}
		}// if
	}// for
	

	
	connect( myMainWindow->getActionGroup() , SIGNAL( triggered( QAction* ) ), myMainWindow, SLOT( onMenuAction( QAction*) ) );

	return true ;
}
Ejemplo n.º 4
0
void MenuItemMgr::insertMenu( Qtitan::RibbonGroup* rGroup , QWidgetAction* item )
{
	QObjectList::iterator it ;

	QActionGroup* pActionGroup = myMainWindow->getActionGroup() ;
	Q_ASSERT( pActionGroup!= NULL ) ;

	QObjectList menuitems = item->children() ;
	if( menuitems.isEmpty() )
		return  ;

	for( it = menuitems.begin() ; it != menuitems.end() ; it++ )
	{
		QWidgetAction *wa = (QWidgetAction*)*it ; 
		if( wa->children().isEmpty() )
		{
			// 不含有子菜单
			//QAction* action = rGroup->addAction( wa->icon(), 
			//	              wa->text(), Qt::ToolButtonTextUnderIcon);
			rGroup->addAction(wa, Qt::ToolButtonTextUnderIcon);
			registerAction( wa ) ;
			pActionGroup->addAction( wa ) ;
            
		}
		else
		{
			// 含有子菜单
			 QMenu* menuPopup = rGroup->addMenu( wa->icon(), 
				 wa->text() , Qt::ToolButtonTextUnderIcon);

			insertMenu( menuPopup , wa ) ;
		}
	}

}
Ejemplo n.º 5
0
QString quoteMeHelper(const QObjectList &children)
{
    QStringList res;
    for (QObjectList::const_iterator it = children.begin(); it != children.end(); ++it) {
        const AbstractPartWidget *w = dynamic_cast<const AbstractPartWidget *>(*it);
        if (w)
            res += w->quoteMe();
    }
    return res.join("\n");
}
Ejemplo n.º 6
0
void dumpall( const QObjectList& olist )
{
	for (QObjectList::ConstIterator it = olist.begin(); it != olist.end(); ++it)
	{
		qDebug( "---------------------------------------" );
		qDebug( "Pointer: %p", *it );
		(*it)->dumpObjectInfo();

		dumpall( (*it)->children() );
	}
}
Ejemplo n.º 7
0
void  MenuItemMgr::insertMenu( Qtitan::RibbonPage* rPage , QWidgetAction* item )
{
	QObjectList::iterator git ;
	QObjectList groups = item->children() ;
	for( git = groups.begin() ; git != groups.end() ; git++ )
	{
		QWidgetAction *wa = (QWidgetAction*)*git ; 
		Qtitan::RibbonGroup* group = rPage->addGroup( wa->text() ) ;
		insertMenu( group , wa ) ;
	}
}
Ejemplo n.º 8
0
void closeDialogs(QWidget *w)
{
	// close qmessagebox?
	QList<QDialog*> dialogs;
	QObjectList list = w->children();
	for(QObjectList::Iterator it = list.begin() ; it != list.end(); ++it) {
		if((*it)->inherits("QDialog"))
			dialogs.append((QDialog *)(*it));
	}
	for(QList<QDialog*>::Iterator w = dialogs.begin(); w != dialogs.end(); ++w) {
		(*w)->close();
	}
}
Ejemplo n.º 9
0
void ExpanderButton::nextCheckState()
{
	_expanded = !_expanded;
	setIcon(_expanded ? _expandedIcon : _contractedIcon);

	QObjectList siblings = this->parentWidget()->children();

	for (QObjectList::Iterator itr = siblings.begin(); itr != siblings.end(); itr++) {
		QWidget* w = dynamic_cast<QWidget*>(*itr);
        if (w != NULL && w != this)
			w->setVisible(_expanded);
	}
}
Ejemplo n.º 10
0
void MainWindow::showForm(Analysis *analysis)
{
	closeCurrentOptionsWidget();

	_currentOptionsWidget = loadForm(analysis);

	if (_currentOptionsWidget != NULL)
	{

//sizing of options widget and panel to fit buttons and conform to largest size for consistency

		QObjectList siblings = _currentOptionsWidget->children();
		for (QObjectList::Iterator itr = siblings.begin(); itr != siblings.end(); itr++) {
			QWidget* w = dynamic_cast<QWidget*>(*itr);
			if (w != NULL && w->objectName() == "topWidget") {
				w->setContentsMargins(0, 0, _buttonPanel->width(), 0);
				break;
			}
		}

		int requiredSize = _currentOptionsWidget->sizeHint().width();
		int currentOptionSpace = ui->panelMid->minimumWidth() - _scrollbarWidth;
		if (requiredSize > currentOptionSpace) {
			ui->panelMid->setMinimumWidth(requiredSize + _scrollbarWidth);
			_buttonPanel->move(ui->panelMid->width() - _buttonPanel->width() - _scrollbarWidth, 0);
		}
		_currentOptionsWidget->setMinimumWidth(ui->panelMid->minimumWidth() - _scrollbarWidth);
//#########################

		Options *options = analysis->options();
		DataSet *dataSet = _package->dataSet;
		_currentOptionsWidget->bindTo(options, dataSet);

		connect(_currentOptionsWidget, SIGNAL(illegalChanged()), this, SLOT(illegalOptionStateChanged()));
		illegalOptionStateChanged();

		_currentOptionsWidget->show();
		ui->optionsContentAreaLayout->addWidget(_currentOptionsWidget,0, 0, Qt::AlignRight | Qt::AlignTop);

		if (ui->panelMid->isVisible() == false)
			showOptionsPanel();

		_runButton->setVisible(_currentAnalysis->isAutorun() == false);
		_runButton->setEnabled(_currentAnalysis->status() == Analysis::InitedAndWaiting);
		_buttonPanel->raise();
		_buttonPanel->show();

		QString helpPage = QString("analyses/") + tq(analysis->name()).toLower();
		requestHelpPage(helpPage);
	}
}
Ejemplo n.º 11
0
QSize ExpanderButton::minimumSizeHint() const {
	 QSize sizeHint = QPushButton::minimumSizeHint();

	 int width = sizeHint.width();
	QObjectList siblings = this->parentWidget()->children();
	for (QObjectList::Iterator itr = siblings.begin(); itr != siblings.end(); itr++) {
		QWidget* w = dynamic_cast<QWidget*>(*itr);
		if (w != NULL && w != this && w->minimumSizeHint().width() > width)
			width = w->minimumSizeHint().width();
	}

	sizeHint.setWidth(width);

	return sizeHint;
}
Ejemplo n.º 12
0
bool Task::take(const QDomElement &x)
{
	const QObjectList p = children();

	// pass along the xml
	Task *t;
	for(QObjectList::ConstIterator it = p.begin(); it != p.end(); ++it) {
		QObject *obj = *it;
		if(!obj->inherits("XMPP::Task"))
			continue;

		t = static_cast<Task*>(obj);
		if(t->take(x))
			return true;
	}

	return false;
}
Ejemplo n.º 13
0
IPCamSetting::IPCamSetting(QWidget *parent) :
    QGroupBox(parent),
    ui(new Ui::IPCamSetting)
{
    ui->setupUi(this);
    QObjectList objList = this->children();
    QObjectList::iterator objIter = objList.begin(), objEnd = objList.end();
    QObjectList::iterator lineEditIter = objList.begin();
    IsInherit predLabel("QLabel"), predLineEdit("QLineEdit");
    while ((objIter = std::find_if(objIter, objEnd, predLabel)) != objEnd) {
        lineEditIter = std::find_if(lineEditIter, objEnd, predLineEdit);
        if (lineEditIter != objEnd) {
            m_mapLabelToLineEdit.insert(dynamic_cast<QLabel*>(*objIter)->text(),
                                        dynamic_cast<QLineEdit*>(*lineEditIter));
            ++lineEditIter;
        }
        ++objIter;
    }
}
///
///Return a QStringList with the Widget's brothers names
///
QStringList * getWidgetBrothers(const QWidget * w)
{
    //FIXME check if this method returns empty-name children
    QStringList * brothers = new QStringList();
    assert(w->parent());
    QObjectList oblist = w->parent()->children();
    QString objectName = getWidgetPath((QObject *)w);

    QObjectList::iterator it;
    for(it = oblist.begin();
    it != oblist.end();
    it++)
    {
        assert((QObject *)*it);
        QString childName = getWidgetPath((QObject *)*it);
        if ((childName!="") && (objectName != childName))
                brothers->push_back(childName);
    }

    return brothers;
}
Ejemplo n.º 15
0
		void PTEDialog::connectChilds_(QObject* o)
		{
			QPushButton* w = dynamic_cast<QPushButton*>(o);
			if (w != 0) 
			{
				String s = ascii(w->text());
				if (s.size() > 2) return;
				Position an = PTE[s].getAtomicNumber();
				w->setToolTip(atomProperties_(an));
				connect(w, SIGNAL(released()), this, SLOT(elementClicked_()));
				return;
			}

			// iterate over all buttons in the button group
			QObjectList ol = o->children();
			QObjectList::iterator it = ol.begin();
			for (; it != ol.end(); it++)
			{
				connectChilds_(*it);
			}
		}