bool eventFilter(QObject* obj, QEvent* event) override
    {
        // check input
        if (event->type() != QEvent::MouseButtonDblClick)
            return false;

         QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
         if (mouseEvent->button() != Qt::LeftButton)
             return false;

        QSplitterHandle* splitterHandle = qobject_cast<QSplitterHandle*>(obj);
        if (!splitterHandle)
            return false;

        QSplitter* splitter = splitterHandle->splitter();
        if (!splitter || splitter->count() < 2)
            return false;

        // change splitter sizes to make description panel occupy ideal height
        QWidget* bottomWidget = splitter->widget(1);
        QList<int> sizes = splitter->sizes();
        if (sizes.size() != 2)
            return false;

        sizes[0] += sizes[1];
        sizes[1] = bottomWidget->heightForWidth(bottomWidget->size().width());
        sizes[0] -= qMax(sizes[1], 0);

        splitter->setSizes(sizes);

        return true;
    }
示例#2
0
QSplitterLayoutStruct *QSplitter::addWidget( QWidget *w, bool first )
{
    QSplitterLayoutStruct *s;
    QSplitterHandle *newHandle = 0;
    if ( data->list.count() > 0 ) {
	s = new QSplitterLayoutStruct;
	s->mode = KeepSize;
	newHandle = new QSplitterHandle( orientation(), this );
	s->wid = newHandle;
	newHandle->setId(data->list.count());
	s->isSplitter = TRUE;
	s->sizer = pick( newHandle->sizeHint() );
	if ( first )
	    data->list.insert( 0, s );
	else
	    data->list.append( s );
    }
    s = new QSplitterLayoutStruct;
    s->mode = Stretch;
    s->wid = w;
    if ( !testWState( WState_Resized ) && w->sizeHint().isValid() )
	s->sizer = pick( w->sizeHint() );
    else
	s->sizer = pick( w->size() );
    s->isSplitter = FALSE;
    if ( first )
	data->list.insert( 0, s );
    else
	data->list.append( s );
    if ( newHandle && isVisible() )
	newHandle->show(); //will trigger sending of post events
    return s;
}
示例#3
0
ContentWidget::ContentWidget(QWidget *parent)
	:QWidget(parent)
{
    QPalette palette;
	palette.setBrush(QPalette::Window, QBrush(Qt::white));
    setPalette(palette);
    setAutoFillBackground(true);
	
	main_splitter = new QSplitter();
	main_splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	main_splitter->setOrientation(Qt::Horizontal);
	main_splitter->setHandleWidth(1);
	main_splitter->setStyleSheet("QSplitter::handle{background:lightgray;}");

	this->initLeft();
	this->initRight();
	this->initRightTop();
	this->initRightCenter();
	this->initRightCenterFunction();
	this->initRightBottom();

	right_splitter->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	right_splitter->setOrientation(Qt::Vertical);
	right_splitter->setHandleWidth(1);
	right_splitter->setStyleSheet("QSplitter::handle{background:lightgray;}");

	right_top_widget->setFixedSize(250, 130);
	right_center_widget->setFixedSize(250, 90);
	right_bottom_widget->setFixedSize(250, 30);
	right_splitter->addWidget(right_top_widget);
	right_splitter->addWidget(right_center_widget);
	right_splitter->addWidget(right_center_function_widget);
	right_splitter->addWidget(right_bottom_widget);

	main_splitter->addWidget(left_widget);
	main_splitter->addWidget(right_splitter);

	//½ûÖ¹Í϶¯
	for(int i = 0; i<right_splitter->count();i++) 
	{ 
		QSplitterHandle *handle = right_splitter->handle(i); 
		handle->setEnabled(false); 
	} 

	for(int i = 0; i<main_splitter->count();i++) 
	{ 
		QSplitterHandle *handle = main_splitter->handle(i); 
		handle->setEnabled(false); 
	}

	QHBoxLayout *main_layout = new QHBoxLayout();
	main_layout->addWidget(main_splitter);
	main_layout->setSpacing(0);
	main_layout->setContentsMargins(0, 0, 0, 0);

	setLayout(main_layout);
	
	this->translateLanguage();
}
示例#4
0
CMainWindow::CMainWindow(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::CMainWindow),
	_controller(new CController),
	_currentFileList(0),
	_otherFileList(0),
	_quickViewActive(false)
{
	assert_r(!_instance);
	_instance = this;
	ui->setupUi(this);

	connect(qApp, &QApplication::focusChanged, this, &CMainWindow::focusChanged);

	_controller->pluginProxy().setToolMenuEntryCreatorImplementation(CPluginProxy::CreateToolMenuEntryImplementationType(std::bind(&CMainWindow::createToolMenuEntries, this, std::placeholders::_1)));

	_currentFileList = ui->leftPanel;
	_otherFileList   = ui->rightPanel;

	connect(ui->leftPanel->fileListView(),  &CFileListView::ctrlEnterPressed, this, &CMainWindow::pasteCurrentFileName);
	connect(ui->rightPanel->fileListView(), &CFileListView::ctrlEnterPressed, this, &CMainWindow::pasteCurrentFileName);
	connect(ui->leftPanel->fileListView(),  &CFileListView::ctrlShiftEnterPressed, this, &CMainWindow::pasteCurrentFilePath);
	connect(ui->rightPanel->fileListView(), &CFileListView::ctrlShiftEnterPressed, this, &CMainWindow::pasteCurrentFilePath);

	connect(ui->leftPanel, &CPanelWidget::currentItemChangedSignal, this, &CMainWindow::currentItemChanged);
	connect(ui->rightPanel, &CPanelWidget::currentItemChangedSignal, this, &CMainWindow::currentItemChanged);

	connect(ui->leftPanel, &CPanelWidget::itemActivated, this, &CMainWindow::itemActivated);
	connect(ui->rightPanel, &CPanelWidget::itemActivated, this, &CMainWindow::itemActivated);

	ui->leftPanel->fileListView()->addEventObserver(this);
	ui->rightPanel->fileListView()->addEventObserver(this);

	initButtons();
	initActions();

	ui->leftPanel->setPanelPosition(LeftPanel);
	ui->rightPanel->setPanelPosition(RightPanel);

	ui->fullPath->clear();

	QSplitterHandle * handle = ui->splitter->handle(1);
	handle->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(handle, &QSplitterHandle::customContextMenuRequested, this, &CMainWindow::splitterContextMenuRequested);

	connect(ui->commandLine, &CHistoryComboBox::itemActivated, this, &CMainWindow::executeCommand);

	_commandLineCompleter.setCaseSensitivity(Qt::CaseInsensitive);
	_commandLineCompleter.setCompletionMode(QCompleter::InlineCompletion);
	_commandLineCompleter.setCompletionColumn(NameColumn);
	ui->commandLine->setCompleter(&_commandLineCompleter);
	ui->commandLine->setClearEditorOnItemActivation(true);

	ui->leftWidget->setCurrentIndex(0); // PanelWidget
	ui->rightWidget->setCurrentIndex(0); // PanelWidget

	connect(&_uiThreadTimer, &QTimer::timeout, this, &CMainWindow::uiThreadTimerTick);
	_uiThreadTimer.start(5);
}
示例#5
0
void GTUtilsOptionsPanel::resizeToMaximum(GUITestOpStatus &os) {
    QSplitter *optionsPanelSplitter = GTWidget::findExactWidget<QSplitter *>(os, "OPTIONS_PANEL_SPLITTER");
    GT_CHECK(nullptr != optionsPanelSplitter, "Options panel splitter is nullptr");
    QSplitterHandle *handle = optionsPanelSplitter->handle(1);
    GT_CHECK(nullptr != handle, "Options panel splitter handle is nullptr");

    const QPoint handleCenter = optionsPanelSplitter->mapToGlobal(handle->geometry().center());
    const int delta = 500;
    GTMouseDriver::dragAndDrop(handleCenter, handleCenter - QPoint(delta, 0));
}
示例#6
0
文件: qsplitter.cpp 项目: Fale/qtmoko
QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w)
{
    Q_Q(QSplitter);
    QSplitterLayoutStruct *sls = 0;
    int i;
    int last = list.count();
    for (i = 0; i < list.size(); ++i) {
        QSplitterLayoutStruct *s = list.at(i);
        if (s->widget == w) {
            sls = s;
            --last;
            break;
        }
    }
    if (index < 0 || index > last)
        index = last;

    if (sls) {
        list.move(i,index);
    } else {
        QSplitterHandle *newHandle = 0;
        sls = new QSplitterLayoutStruct;
        QString tmp = QLatin1String("qt_splithandle_");
        tmp += w->objectName();
        newHandle = q->createHandle();
        newHandle->setObjectName(tmp);
        sls->handle = newHandle;
        sls->widget = w;
        w->lower();
        list.insert(index,sls);

        if (newHandle && q->isVisible())
            newHandle->show(); // will trigger sending of post events

#ifdef QT3_SUPPORT
        if (compatMode) {
            int sf = getStretch(sls->widget);
            if (sf == 243)
                setStretch(sls->widget, 0);
            else if (sf == 0)
                setStretch(sls->widget, 1);
        }
#endif
    }
    return sls;
}
示例#7
0
文件: qsplitter.cpp 项目: Fale/qtmoko
void QSplitterPrivate::setGeo(QSplitterLayoutStruct *sls, int p, int s, bool allowCollapse)
{
    Q_Q(QSplitter);
    QWidget *w = sls->widget;
    QRect r;
    QRect contents = q->contentsRect();
    if (orient == Qt::Horizontal) {
        r.setRect(p, contents.y(), s, contents.height());
    } else {
        r.setRect(contents.x(), p, contents.width(), s);
    }
    sls->rect = r;

    int minSize = pick(qSmartMinSize(w));

    if (orient == Qt::Horizontal && q->isRightToLeft())
        r.moveRight(contents.width() - r.left());

    if (allowCollapse)
        sls->collapsed = s <= 0 && minSize > 0 && !w->isHidden();

    //   Hide the child widget, but without calling hide() so that
    //   the splitter handle is still shown.
    if (sls->collapsed)
        r.moveTopLeft(QPoint(-r.width()-1, -r.height()-1));

    w->setGeometry(r);

    if (!sls->handle->isHidden()) {
        QSplitterHandle *h = sls->handle;
        QSize hs = h->sizeHint();
        int left, top, right, bottom;
        h->getContentsMargins(&left, &top, &right, &bottom);
        if (orient==Qt::Horizontal) {
            if (q->isRightToLeft())
                p = contents.width() - p + hs.width();
            h->setGeometry(p-hs.width() - left, contents.y(), hs.width() + left + right, contents.height());
        } else {
            h->setGeometry(contents.x(), p-hs.height() - top, contents.width(), hs.height() + top + bottom);
        }
    }
}
SettingWidget::SettingWidget(QString cur_desktop, QWidget *parent) :
    QWidget(parent), desktop(cur_desktop)
{
    this->setFixedSize(900, 403);
    //set white background color
    this->setAutoFillBackground(true);
    QPalette palette;
    palette.setBrush(QPalette::Window, QBrush(Qt::white));
    this->setPalette(palette);

//    this->mainwindow_width = 850;
//    this->mainwindow_height = 600;

    stacked_widget = new QStackedWidget(this);//stacked_widget will delete when SettingWidget delete
    theme_widget = NULL;
    icon_widget = NULL;
    mouse_widget = NULL;
    voice_widget = NULL;
    animation_widget = NULL;
    launcher_widget = NULL;
    panel_widget = NULL;
    window_widget = NULL;
    font_widget = NULL;
    touchpad_widget = NULL;
    deadpixel_widget = NULL;
    conserve_widget = NULL;
    nautilus_widget = NULL;

    h_splitter = new QSplitter();
    h_splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    h_splitter->setOrientation(Qt::Horizontal);
    h_splitter->setHandleWidth(1);

    this->initIndividuationWidget();
    this->initDesktopWidget();
    this->initFontWidget();
    this->initOptionWidget();
    this->initOtherWidget();

    individuation_widget->setFixedSize(170, 426);
    dekstop_widget->setFixedSize(170, 426);
    fonts_widget->setFixedSize(170, 426);
    option_widget->setFixedSize(170, 426);
    h_splitter->addWidget(individuation_widget);
    h_splitter->addWidget(dekstop_widget);
    h_splitter->addWidget(fonts_widget);
    h_splitter->addWidget(option_widget);
    h_splitter->addWidget(other_widget);

    for(int i = 0; i<h_splitter->count();i++)
    {
        QSplitterHandle *handle = h_splitter->handle(i);
        handle->setEnabled(false);
    }

//    for(int i = 0; i<v_splitter->count();i++)
//    {
//        QSplitterHandle *handle = v_splitter->handle(i);
//        handle->setEnabled(false);
//    }

//    QHBoxLayout *main_layout = new QHBoxLayout();
//    main_layout->addWidget(v_splitter);
//    main_layout->setSpacing(0);
//    main_layout->setContentsMargins(0, 0, 0, 0);


//    connect(theme_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(icon_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(mouse_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(voice_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(animation_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(launcher_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(panel_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(window_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(font_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(touchpad_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(deadpixel_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
//    connect(nautilus_widget, SIGNAL(showSettingMainWidget()), this, SLOT(displaySettingHomePage()));
}
示例#9
0
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
    setWindowTitle(QCoreApplication::applicationName());
    ui.setupUi(this);

    // setup preferences dialog
    connect(&preferences,   SIGNAL(accepted()),                     this,   SLOT(getApplicationSettings()));

    connect(&builder,   SIGNAL(highlightLine(const QString &,
                                             int,
                                             int,
                                             const QString &)),

            this,       SLOT(highlightFileLine(const QString &,
                                               int,
                                               int)));

    connect(&builder,   SIGNAL(finished()),     this,           SLOT(setBuildAvailable()));
    connect(&builder,   SIGNAL(buildError()),   &preferences,   SLOT(showPreferences()));

    parser = language.parser();

    connect(&preferences, SIGNAL(updateColors()),               this,   SLOT(recolorProjectView()));
    connect(&preferences, SIGNAL(updateFonts(const QFont &)),   this,   SLOT(recolorProjectView()));

    connect(&preferences, SIGNAL(updateFonts(const QFont &)),   this,   SLOT(recolorBuildManager()));

    connect(&preferences, SIGNAL(accepted()),                   ui.editorTabs,   SIGNAL(accepted()));
    connect(&preferences, SIGNAL(updateColors()),               ui.editorTabs,   SIGNAL(updateColors()));
    connect(&preferences, SIGNAL(updateFonts(const QFont &)),   ui.editorTabs,   SIGNAL(updateFonts(const QFont &)));

    recolorProjectView();
    recolorBuildManager();

    // project editor tabs
    ui.finder->connectFileManager(ui.editorTabs);
    QSplitterHandle *hndl = ui.splitter->handle(1);
    hndl->setEnabled(false);

    connect(ui.editorTabs, SIGNAL(fileUpdated(int)),    this,   SLOT(setProject()));

    // File Menu
    connect(ui.action_New,              SIGNAL(triggered()),    ui.editorTabs,  SLOT(newFile()));
    connect(ui.actionNew_From_File,     SIGNAL(triggered()),    ui.editorTabs,  SLOT(newFromFile()));
    connect(ui.actionNew_From_Template, SIGNAL(triggered()),    this,           SLOT(newFromTemplate()));
    connect(ui.action_Open,             SIGNAL(triggered()),    ui.editorTabs,  SLOT(open()));

    connect(ui.action_Save,SIGNAL(triggered()),ui.editorTabs,SLOT(save()));
    connect(ui.actionSave_As,SIGNAL(triggered()),ui.editorTabs,SLOT(saveAs()));
    connect(ui.actionSave_All,SIGNAL(triggered()),ui.editorTabs,SLOT(saveAll()));

    ui.actionPrint->setEnabled(true);
    connect(ui.actionPrint,SIGNAL(triggered()),this,SLOT(printFile()));

    ui.action_Zip->setEnabled(true);
    connect(ui.action_Zip,SIGNAL(triggered()),this,SLOT(zipFiles()));

    recentFiles = findChildren<QAction *>(QRegExp("action_[0-9]+_File"));
    for (int i = 0; i < recentFiles.size(); i++)
        connect(recentFiles.at(i), SIGNAL(triggered()),this, SLOT(openRecentFile()));
    
    connect(ui.action_Close,       SIGNAL(triggered()),    ui.editorTabs, SLOT(closeFile()));
    connect(ui.actionClose_All,    SIGNAL(triggered()),    ui.editorTabs, SLOT(closeAll()));
    connect(ui.action_Quit,        SIGNAL(triggered()),    this,          SLOT(quitProgram()));

    connect(ui.editorTabs, SIGNAL(saveAvailable(bool)),    this,          SLOT(setSaveAvailable(bool)));
    connect(ui.editorTabs, SIGNAL(saveAvailable(bool)),    this,          SLOT(setSaveAvailable(bool)));
    connect(ui.editorTabs, SIGNAL(closeAvailable(bool)),   this,          SLOT(setCloseAvailable(bool)));
    connect(ui.editorTabs, SIGNAL(closeAvailable(bool)),   this,          SLOT(setCloseAvailable(bool)));
    connect(ui.editorTabs, SIGNAL(closeAvailable(bool)),   this,          SLOT(setBuildAvailable(bool)));

    // Edit Menu
    connect(ui.action_Undo,        SIGNAL(triggered()), ui.editorTabs, SLOT(undo()));
    connect(ui.action_Redo,        SIGNAL(triggered()), ui.editorTabs, SLOT(redo()));

    connect(ui.action_Cut,         SIGNAL(triggered()), ui.editorTabs, SLOT(cut()));
    connect(ui.action_Copy,        SIGNAL(triggered()), ui.editorTabs, SLOT(copy()));
    connect(ui.action_Paste,       SIGNAL(triggered()), ui.editorTabs, SLOT(paste()));
    connect(ui.actionSelect_All,   SIGNAL(triggered()), ui.editorTabs, SLOT(selectAll()));

    connect(ui.action_Find,        SIGNAL(triggered()), ui.finder, SLOT(showFinder()));
    connect(ui.actionFind_Next,    SIGNAL(triggered()), ui.finder, SLOT(findNext()));
    connect(ui.actionFind_Previous,SIGNAL(triggered()), ui.finder, SLOT(findPrevious()));

    connect(ui.actionPreferences,  SIGNAL(triggered()), &preferences, SLOT(showPreferences()));

    connect(ui.editorTabs, SIGNAL(undoAvailable(bool)), ui.action_Undo,SLOT(setEnabled(bool)));
    connect(ui.editorTabs, SIGNAL(redoAvailable(bool)), ui.action_Redo,SLOT(setEnabled(bool)));
    connect(ui.editorTabs, SIGNAL(copyAvailable(bool)), ui.action_Cut,SLOT(setEnabled(bool)));
    connect(ui.editorTabs, SIGNAL(copyAvailable(bool)), ui.action_Copy,SLOT(setEnabled(bool)));

    // View Menu
    connect(ui.actionShow_Browser, SIGNAL(triggered()), this, SLOT(showBrowser()));
    connect(ui.actionBigger_Font,  SIGNAL(triggered()), this, SLOT(fontBigger()));
    connect(ui.actionSmaller_Font, SIGNAL(triggered()), this, SLOT(fontSmaller()));

    ui.actionBigger_Font->setShortcuts(QList<QKeySequence>() << QKeySequence::ZoomIn
                                                             << Qt::CTRL+Qt::Key_Equal);

    // Project Menu
    connect(ui.actionMemory_Map,SIGNAL(triggered()), this, SLOT(spawnMemoryMap()));
    connect(ui.actionBuild,     SIGNAL(triggered()), this, SLOT(programBuild()));
    connect(ui.actionRun,       SIGNAL(triggered()), this, SLOT(programRun()));
    connect(ui.actionWrite,     SIGNAL(triggered()), this, SLOT(programWrite()));
    connect(ui.actionTerminal,  SIGNAL(triggered()), this, SLOT(spawnTerminal()));

    // Help Menu
    connect(ui.actionPropeller_Quick_Reference, SIGNAL(triggered()), this, SLOT(propellerQuickReference()));
    connect(ui.actionPropeller_Datasheet,       SIGNAL(triggered()), this, SLOT(propellerDatasheet()));
    connect(ui.actionPropeller_Manual,          SIGNAL(triggered()), this, SLOT(propellerManual()));
    connect(ui.actionPropBASIC_Manual,          SIGNAL(triggered()), this, SLOT(propBasicManual()));
    connect(ui.action_About,                    SIGNAL(triggered()), this, SLOT(about()));

    // Toolbar Extras
    cbPort = new QComboBox(this);
    cbPort->setLayoutDirection(Qt::LeftToRight);
    cbPort->setToolTip(tr("Select Serial Port"));
    cbPort->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    ui.toolBar->addWidget(cbPort);

    connect(ui.projectview, SIGNAL(showFileLine(QString, int)),
            this,           SLOT(highlightFileLine(QString, int)));

    updateRecentFileActions();

    connect(ui.editorTabs, SIGNAL(sendMessage(const QString &)),   this,SLOT(showMessage(const QString &)));
    connect(ui.finder,     SIGNAL(sendMessage(const QString &)),   this,SLOT(showMessage(const QString &)));

    restoreGeometry(QSettings().value("windowSize").toByteArray());

    getApplicationSettings();

    connect(&manager, SIGNAL(portListChanged()), this, SLOT(updatePorts()));
    manager.enablePortMonitor(true);
    updatePorts();

    
    QSettings settings;
    QString lastport = settings.value("lastPort", QString()).toString();
    if (!lastport.isEmpty())
    {
        int index = cbPort->findText(lastport);
        if (index != -1)
            cbPort->setCurrentIndex(index);
    }

    ui.editorTabs->newFile();
    loadSession();

    installEventFilter(this);
    statusBar();
}
示例#10
0
void mafViewCompoundConfigurator::parseDocument(QDomNode current, QObject *parent) {
    QDomNodeList dnl = current.childNodes();
    for (int n=0; n < dnl.count(); ++n) {
        QDomNode node = dnl.item(n);
        if (node.nodeType() == QDomNode::ElementNode) {
            QDomElement ce = node.toElement();
            QDomNamedNodeMap attributes = ce.attributes();
            QString elem_name = ce.tagName();
            if (elem_name == "splitter") {
                mafSplitter *splitter = new mafSplitter(Qt::Horizontal, (QWidget *)parent);
                if (parent == NULL) {
                    // parent is the root object, this is the first splitter created
                    m_RootObject = splitter;
                }
                QString sepThikness = attributes.namedItem("separatorThikness").nodeValue();
                QString sepEnabled = attributes.namedItem("enableSeparator").nodeValue();
                splitter->setHandleWidth(sepThikness.toInt());
                QString orientation = attributes.namedItem("orientation").nodeValue();
                if (orientation == "vertical") {
                    // Check only for vertical, horizontal is the default.
                    splitter->setOrientation(Qt::Vertical);
                }
                QStringList sizesString = attributes.namedItem("sizes").nodeValue().split(",", QString::SkipEmptyParts);
                QList<int> sizes;
                for (int s = 0; s < sizesString.count(); ++s) {
                    sizes.append(sizesString[s].toInt());
                }
                splitter->setSizes(sizes);
                // Check if there are children and parse them...
                QDomNodeList splitter_dnl = node.childNodes();
                if (splitter_dnl.count() > 0) {
                    parseDocument(node, splitter);
                }
                QSplitterHandle *handler = splitter->handle(1);
                handler->setEnabled(sepEnabled.toInt() != 0);
            } else if (elem_name == "view") {
                // view objects are added at the parent splitter.
                QString viewClassType = attributes.namedItem("classtype").nodeValue();
                // Instantiate the class type
                mafCore::mafObjectBase *obj = mafNEWFromString(viewClassType);
                // Then extract all the attributes representing the object's properties.
                int s = attributes.size();
                int i = 0;
                for (; i < s; ++i) {
                    QDomNode n(attributes.item(i));
                    if (n.nodeName() != "classtype") {
                        QByteArray ba(n.nodeName().toAscii());
                        bool isOk(obj->setProperty(ba.constData(), n.nodeValue()));
                        if (!isOk) {
                            qWarning() << mafTr("Problem assigning property named: %1 to view of type: %2").arg(n.nodeName(), viewClassType);
                        }
                    }
                }
                mafSplitter *parentSplitter = qobject_cast<mafSplitter *>(parent);
                if (parentSplitter) {
                    // and add it to the splitter.
                    parentSplitter->addView(obj);
                }
                // Check if there are children and parse them...
                QDomNodeList view_dnl = node.childNodes();
                if (view_dnl.count() > 0) {
                    parseDocument(node, obj);
                }
                // The splitter retain the view object, so we can release the instance.
                mafDEL(obj);
            } else if (elem_name == "visualpipe") {
                // Visual pipe to plug into the previous created view...
                QVariant visualPipeClassType(attributes.namedItem("classtype").nodeValue());
                QString dataType(attributes.namedItem("datatype").nodeValue());
                QVariantHash h;
                h.insert(dataType, visualPipeClassType);
                mafCore::mafObjectBase *viewObj = dynamic_cast<mafCore::mafObjectBase *>(parent);
                if (viewObj) {
                    viewObj->setProperty("visualPipeHash", h);

                    int s = attributes.size();
                    int i = 0;
                    QVariantHash propertyHash;
                    for (; i < s; ++i) {
                        QDomNode n(attributes.item(i));
                        if (n.nodeName() != "classtype" && n.nodeName() != "datatype") {
                            propertyHash.insert(n.nodeName(), n.nodeValue());
                        }
                    }
                    if (propertyHash.size() > 0) {
                        // Found some custom properties used to initialize the pipe
                        QString vp(visualPipeClassType.toString());
                        bool isOk(viewObj->metaObject()->invokeMethod(viewObj, "plugPipeParametersHashItem",
                                                    Q_ARG(QString, vp),
                                                    Q_ARG(QVariantHash, propertyHash)));
                        if (!isOk) {
                            qWarning() << mafTr("Problem invoking method used to plug the pipe's parameter for pipe: %1").arg(visualPipeClassType.toString());
                        }
                    }
                }
            } else {
                qWarning() << mafTr("Unrecognized element named: ") << elem_name;
            }
        }
    }
}