Esempio n. 1
0
/** Creates and sets up list widget.
  * \return Poiter to created list widget.
  * \sa insertItem()
  */
QListWidget *OptionsDialog::createListWidget() {
    QListWidget *listWidget = new QListWidget(this);

    insertItems(listWidget);

    listWidget->setObjectName(QString::fromUtf8("listWidget"));
    listWidget->setMaximumWidth(120);
    listWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
    listWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    listWidget->setFlow(QListView::LeftToRight);
    listWidget->setGridSize(QSize(110, 60));
    listWidget->setViewMode(QListView::IconMode);

    return listWidget;
}
Esempio n. 2
0
bool Configurator::loadSection( QDomNode section )
{
	// make some checks
	if( false == section.hasChildNodes() )
		return false;

	if( section.nodeName() != c_sectionNodeName )
		return false;

	QDomNamedNodeMap sectionAttributes = section.attributes();
	if( false == sectionAttributes.contains(c_attributeName) )
		return false;

	if( false == sectionAttributes.contains(c_attributeText) )
		return false;

	// we have all the attribbutes for this section, now build it usign GUI controls
	QString sectionName = sectionAttributes.namedItem(c_attributeName).nodeValue();
	QString sectionText = sectionAttributes.namedItem(c_attributeText).nodeValue();
	
	// build the UI
	QListWidget*	listWidget = new QListWidget();
				    listWidget->setObjectName( sectionName );
				    listWidget->setSelectionBehavior( QAbstractItemView::SelectRows );

	connect( listWidget,    SIGNAL	(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
			 this,		    SLOT	(currentItemChanged(QListWidgetItem*,QListWidgetItem*))	);

	_sections->addItem( listWidget, sectionText );
			
	// adding items for this section
	QDomNode sectionItem = section.firstChild();
	while( false == sectionItem.isNull() )
	{
	    if( QDomNode::CommentNode != section.nodeType() )
		if( false == loadSectionItem(sectionItem,*listWidget) )
			return false;
	
		sectionItem = sectionItem.nextSibling();				
	}

	return true;
}