Ejemplo n.º 1
0
//Toggle to automatically expand all items when new item added
void BC_Bulletin::autoExpand()
{
    if(ui->pushButton_4->isChecked())
    {
        connect(this, SIGNAL(itemAdded()), ui->tx, SLOT(expandAll()));
        connect(this, SIGNAL(itemAdded()), ui->fsw, SLOT(expandAll()));
    }
    else
    {
        disconnect(this, SIGNAL(itemAdded()), ui->tx, SLOT(expandAll()));
        disconnect(this, SIGNAL(itemAdded()), ui->fsw, SLOT(expandAll()));
    }
}
Ejemplo n.º 2
0
void FrmFrameDetails::initTree()
{
    //if (treeView!=0) delete treeView;

    treeView = new FrameView(frame);
    gridLayout_2->addWidget(treeView, 0, 0, 1, 1);

    QObject::connect(treeView, SIGNAL(DragStarted()),
                     this, SLOT(enableVerify()));

    QObject::connect(pushExpand, SIGNAL(clicked()),
                     treeView, SLOT(expandAll ()));

    QObject::connect(pushCollapse, SIGNAL(clicked()),
                     treeView, SLOT(collapseAll ()));

    treeView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    treeView->setAnimated(true);
    treeView->setAcceptDrops(true);
    treeView->setDropIndicatorShown(true);
    treeView->setAlternatingRowColors(true);
    treeView->setRootIsDecorated(true);
    treeView->setDropIndicatorShown(true);
    treeView->setSortingEnabled(true);
}
SimulationExperimentViewInformationSolversWidget::SimulationExperimentViewInformationSolversWidget(QWidget *pParent) :
    PropertyEditorWidget(true, pParent),
    mDescriptions(QMap<Core::Property *, Descriptions>())
{
    // Remove all our properties

    removeAllProperties();

    // Add properties for our different solvers

    mOdeSolverData = addSolverProperties(Solver::Type::Ode);
    mNlaSolverData = addSolverProperties(Solver::Type::Nla);

    // Show/hide the relevant properties

    solverChanged(mOdeSolverData, mOdeSolverData->solversListProperty()->value());

    if (mNlaSolverData != nullptr) {
        solverChanged(mNlaSolverData, mNlaSolverData->solversListProperty()->value());
    }

    // Expand all our properties

    expandAll();

    // Keep track of changes to list properties

    connect(this, &SimulationExperimentViewInformationSolversWidget::propertyChanged,
            this, QOverload<Core::Property *>::of(&SimulationExperimentViewInformationSolversWidget::solverChanged));
}
Ejemplo n.º 4
0
AMDataViewWithActionButtons::AMDataViewWithActionButtons(AMDatabase* database, QWidget *parent) :
	QWidget(parent)
{
	QVBoxLayout* vl = new QVBoxLayout;
	dataView_ = new AMDataView(database);

	QFrame* actionsBarFrame = new QFrame;
	ui_ = new Ui::AMDataViewActionsBar;
	ui_->setupUi(actionsBarFrame);

	vl->setContentsMargins(0,0,0,0);
	vl->setSpacing(0);

	vl->addWidget(dataView_);
	vl->addWidget(actionsBarFrame);
	setLayout(vl);

	connect(ui_->sizeSlider, SIGNAL(valueChanged(int)), dataView_, SLOT(setItemSize(int)));
	connect(ui_->expandAllButton, SIGNAL(clicked()), dataView_, SLOT(expandAll()));
	connect(ui_->collapseAllButton, SIGNAL(clicked()), dataView_, SLOT(collapseAll()));

	connect(ui_->openSameEditorButton, SIGNAL(clicked()), this, SLOT(onCompareScansAction()));
	connect(ui_->openSeparateEditorButton, SIGNAL(clicked()), this, SLOT(onEditScansAction()));
	connect(ui_->exportButton, SIGNAL(clicked()), this, SLOT(onExportScansAction()));
	connect(ui_->scanConfigurationButton, SIGNAL(clicked()), this, SLOT(onLaunchScanConfigurationsFromDb()));

	connect(dataView_, SIGNAL(viewDoubleClicked()), this, SLOT(onDoubleClick()));
	connect(dataView_, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
	connect(dataView_, SIGNAL(editScansFromDb()), this, SLOT(onEditScansAction()));
	connect(dataView_, SIGNAL(compareScansFromDb()), this, SLOT(onCompareScansAction()));
	connect(dataView_, SIGNAL(exportScansFromDb()), this, SLOT(onExportScansAction()));
	connect(dataView_, SIGNAL(launchScanConfigurationsFromDb()), this, SLOT(onLaunchScanConfigurationsFromDb()));
	connect(dataView_, SIGNAL(fixCDF()), this, SLOT(onFixCDF()));
}
Ejemplo n.º 5
0
void RxDev::showContextMenu_availableNodes(const QPoint&point){

    QMenu contextMenu_availableNodes;
    QModelIndex index(ui->treeView_availableNodes->indexAt(point));
    //menuPoint_availableNodes = point;
    //const QModelIndex index = ui->treeView_availableNodes->selectionModel()->currentIndex();
    QModelIndex seekRoot = index;
    if(index.isValid()){

    while(seekRoot.parent() != QModelIndex())
    {
        seekRoot = seekRoot.parent();

    }
    contextMenu_availableNodes.addAction(tr("view/edit Specfile"),this, SLOT(openSpecFile()));
    contextMenu_availableNodes.addAction(tr("expand"),this, SLOT(expandNode()));
    contextMenu_availableNodes.addAction(tr("collapse"),this, SLOT(collapseNode()));
    contextMenu_availableNodes.addSeparator();
    contextMenu_availableNodes.addAction(tr("expand all"),this, SLOT(expandAll()));
    contextMenu_availableNodes.addAction(tr("collapse all"),this, SLOT(collapseAll()));



    contextMenu_availableNodes.exec(ui->treeView_availableNodes->viewport()->mapToGlobal(point));
    }
}
Ejemplo n.º 6
0
void DGameTree::RebuildTree()
{
	GameFile* currentGame = SelectedGame();

	int count = topLevelItemCount();
	for (int a = 0; a < count; a++)
		takeTopLevelItem(0);

	for (QTreeWidgetItem* i : m_path_nodes.values())
	{
		count = i->childCount();
		for (int a = 0; a < count; a++)
			i->takeChild(0);
	}

	if (m_current_style == STYLE_TREE)
	{
		for (QTreeWidgetItem* i : m_path_nodes.values())
			addTopLevelItem(i);
		for (QTreeWidgetItem* i : m_items.keys())
			m_path_nodes.value(m_items.value(i)->GetFolderName())->addChild(i);
	}
	else
	{
		for (QTreeWidgetItem* i : m_items.keys())
			addTopLevelItem(i);
	}

	expandAll();
	ResizeAllCols();
	SelectGame(currentGame);
}
Ejemplo n.º 7
0
void EventApplet::setupModel()
{
    Akonadi::Control::widgetNeedsAkonadi(m_view);

    Akonadi::Control::start();
    
    m_agentManager = Akonadi::AgentManager::self();

    m_model = new EventModel(this, m_urgency, m_birthdayUrgency, m_colors);
    m_model->setCategoryColors(m_categoryColors);
    m_model->setHeaderItems(m_headerItemsList);
    m_model->initModel();
    m_model->initMonitor();
    m_model->setSortRole(EventModel::SortRole);
    m_model->sort(0, Qt::AscendingOrder);

    m_filterModel = new EventFilterModel(this);
    m_filterModel->setPeriod(m_period);
    m_filterModel->setShowFinishedTodos(m_showFinishedTodos);
    m_filterModel->setExcludedResources(disabledResources);
    m_filterModel->setDynamicSortFilter(TRUE);
    m_filterModel->setSourceModel(m_model);

    m_view->setModel(m_filterModel);
    m_view->expandAll();
    connect(m_model, SIGNAL(modelNeedsExpanding()), m_view, SLOT(expandAll()));

    m_timer->start(2 * 60 * 1000);

    connect(Akonadi::ServerManager::self(), SIGNAL(started()), this, SLOT(akonadiStatusChanged()));
}
Ejemplo n.º 8
0
SideBarView::SideBarView ( QWidget* parent ) : QTreeView(parent), _model(NULL) {
    installEventFilter(this);

    _model = new SideBarModel(this);
    
    setModel(_model);
    setItemsExpandable(true);
    setHeaderHidden(true);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setContextMenuPolicy(Qt::CustomContextMenu);
    setItemDelegate(new SideBarDelegate(this));
    expandAll();
    
    connect(ArenaWidgetManager::getInstance(), SIGNAL(activated(ArenaWidget*)), this,   SLOT(activated(ArenaWidget*)));
    connect(ArenaWidgetManager::getInstance(), SIGNAL(added(ArenaWidget*)),     this,   SLOT(added(ArenaWidget*)));
    connect(ArenaWidgetManager::getInstance(), SIGNAL(removed(ArenaWidget*)),   this,   SLOT(removed(ArenaWidget*)));
    connect(ArenaWidgetManager::getInstance(), SIGNAL(activated(ArenaWidget*)), _model, SLOT(mapped(ArenaWidget*)));
    connect(ArenaWidgetManager::getInstance(), SIGNAL(toggled(ArenaWidget*)),   _model, SLOT(toggled(ArenaWidget*)));
    connect(ArenaWidgetManager::getInstance(), SIGNAL(updated(ArenaWidget*)),   _model, SLOT(updated(ArenaWidget*)));
    
    connect(this, SIGNAL(doubleClicked(QModelIndex)),           this,   SLOT(slotSideBarDblClicked(QModelIndex)));
    connect(this, SIGNAL(customContextMenuRequested(QPoint)),   this,   SLOT(slotSidebarContextMenu()));
    connect(this, SIGNAL(clicked(QModelIndex)),                 this,   SLOT(slotSidebarHook(QModelIndex)));
    connect(this, SIGNAL(clicked(QModelIndex)),                 _model, SLOT(slotIndexClicked(QModelIndex)));
   
    
    connect(GlobalTimer::getInstance(), SIGNAL(second()), _model, SLOT(redraw()));
    
    connect(_model,    SIGNAL(mapWidget(ArenaWidget*)),     ArenaWidgetManager::getInstance(),  SLOT(activate(ArenaWidget*)));
    connect(_model,    SIGNAL(selectIndex(QModelIndex)),    this,                               SLOT(slotWidgetActivated(QModelIndex)));
}
Ejemplo n.º 9
0
QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget messageTarget, QWidget* parent) : QTreeView(parent),  eventStream_(eventStream), settings_(settings), messageTarget_(messageTarget) {
    model_ = new RosterModel(this, settings_->getSetting(QtUISettingConstants::USE_SCREENREADER));
    setModel(model_);
    delegate_ = new RosterDelegate(this, settings_->getSetting(QtUISettingConstants::COMPACT_ROSTER));
    setItemDelegate(delegate_);
    setHeaderHidden(true);
#ifdef SWIFT_PLATFORM_MACOSX
    setAlternatingRowColors(true);
#endif
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    expandAll();
    setAnimated(true);
    setIndentation(0);
#ifdef SWIFT_EXPERIMENTAL_FT
    setAcceptDrops(true);
#endif
    setDragEnabled(true);
    setRootIsDecorated(true);
    connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&)));
    connect(model_, SIGNAL(itemExpanded(const QModelIndex&, bool)), this, SLOT(handleModelItemExpanded(const QModelIndex&, bool)));
    connect(this, SIGNAL(expanded(const QModelIndex&)), this, SLOT(handleExpanded(const QModelIndex&)));
    connect(this, SIGNAL(collapsed(const QModelIndex&)), this, SLOT(handleCollapsed(const QModelIndex&)));
    connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(handleClicked(const QModelIndex&)));

    settings_->onSettingChanged.connect(boost::bind(&QtTreeWidget::handleSettingChanged, this, _1));

    QFont lato = font();
    lato.setFamily("Lato");
    setFont(lato);
}
Ejemplo n.º 10
0
void MainWindow::initialActions()
{
  initialActionsIcons();
  initialActionsShortcuts();

  connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openDocumentAction()));
  connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveDocumentAction()));
  connect(ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(saveAsDocumentAction()));
  connect(ui->actionProperties, SIGNAL(triggered()), this, SLOT(propertiesAction()));
  connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeDocumentAction()));
  connect(ui->actionExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

  connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copyNodeAction()));
  connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(findAction()));
  connect(ui->actionFindNext, SIGNAL(triggered()), findWidget, SLOT(FindNext()));
  connect(ui->actionFindPrevious, SIGNAL(triggered()), findWidget, SLOT(FindPrevious()));

  // bookmarks
  connect(ui->actionBookmark, SIGNAL(triggered()), this, SLOT(bookmarkToggled()));
  connect(ui->actionBookmarkGotoNext, SIGNAL(triggered()), model, SLOT(bookmarkNext()));
  connect(ui->actionBookmarkGotoPrevious, SIGNAL(triggered()), model, SLOT(bookmarkPrev()));

  // view
  connect( ui->actionCollapseAll, SIGNAL(triggered()), this, SLOT(collapseAll()) );
  connect( ui->actionExpandAll, SIGNAL(triggered()), this, SLOT(expandAll()) );

  // FIXME: it's a temporary
  ui->actionNew->setVisible( false );
}
Ejemplo n.º 11
0
void DiveListView::setupUi(){
	QSettings settings;
	static bool firstRun = true;
	if(firstRun)
		backupExpandedRows();
	settings.beginGroup("ListWidget");
	/* if no width are set, use the calculated width for each column;
	 * for that to work we need to temporarily expand all rows */
	expandAll();
	for (int i = DiveTripModel::NR; i < DiveTripModel::COLUMNS; i++) {
		if(isColumnHidden(i))
			continue;
		QVariant width = settings.value(QString("colwidth%1").arg(i));
		if (width.isValid())
			setColumnWidth(i, width.toInt());
		else
			setColumnWidth(i, 100);
	}
	settings.endGroup();
	if(firstRun)
		restoreExpandedRows();
	else
		collapseAll();
	firstRun = false;
}
Ejemplo n.º 12
0
void ModelDescriptorListWidget::setModel(QAbstractItemModel *model)
{
    QSortFilterProxyModel *proxyModel = qobject_cast<QSortFilterProxyModel *>(QTreeView::model());
    proxyModel->setSourceModel(model);
    proxyModel->setDynamicSortFilter(true);
    expandAll();
}
Ejemplo n.º 13
0
void QMailTreeView::init()
{

    QMailSortFilterProxyModel::instance()->setSourceModel(QMailTreeModel::instance());
    setModel(QMailSortFilterProxyModel::instance());
    setSortingEnabled(true);
    sortByColumn(MLMCE_Date, Qt::DescendingOrder);
    m_pMailTreeViewHeader = new QMailTreeViewHeader(this);
    setHeader(m_pMailTreeViewHeader);
    connect(m_pMailTreeViewHeader, SIGNAL(refreshAccountsMailList()), this, SLOT(onRefreshAccountMails()));
    
    setItemDelegate(new QMailItemDelegate(this));
    for (int column = 0; column < QMailTreeModel::instance()->columnCount(); ++column)
        resizeColumnToContents(column);
    setColumnHidden(MLMCE_Priority, true);

    //右键菜单设置
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotCustomContextMenu(const QPoint &)));
    //支持多选 支持shift, ctrl, 鼠标框框等方式
    setSelectionMode(ExtendedSelection);
    connect(this, SIGNAL(entered(const QModelIndex &)), this, SLOT(slotEntered(const QModelIndex &)));
    //用于显示ToolTip
    setMouseTracking(true);
    expandAll();
}
Ejemplo n.º 14
0
void PerformanceCounterSelection::counterTree_contextMenu(const QPoint &pos)
{
  RDTreeWidgetItem *item = ui->counterTree->itemAt(pos);

  QMenu contextMenu(this);

  QAction expandAll(tr("&Expand All"), this);
  QAction collapseAll(tr("&Collapse All"), this);

  contextMenu.addAction(&expandAll);
  contextMenu.addAction(&collapseAll);

  expandAll.setIcon(Icons::arrow_out());
  collapseAll.setIcon(Icons::arrow_in());

  expandAll.setEnabled(item && item->childCount() > 0);
  collapseAll.setEnabled(item && item->childCount() > 0);

  QObject::connect(&expandAll, &QAction::triggered,
                   [this, item]() { ui->counterTree->expandAllItems(item); });

  QObject::connect(&collapseAll, &QAction::triggered,
                   [this, item]() { ui->counterTree->collapseAllItems(item); });

  RDDialog::show(&contextMenu, ui->counterTree->viewport()->mapToGlobal(pos));
}
Ejemplo n.º 15
0
HelpBrowser::HelpBrowser()
{
	m_engine = new QHelpEngine(DATA_LOCATION "/doc/fatrat.qhc", this);
	if(!m_engine->setupData())
	{
		QMessageBox::critical(this, tr("Help"), tr("Failed to load the documentation."));
		deleteLater();
		return;
	}
	
	setupUi(this);
	
	QHelpContentWidget* content = m_engine->contentWidget();
	splitter->insertWidget(0, content);
	splitter->setSizes(QList<int>() << 80 << 400);
	content->setRootIsDecorated(false);
	
	textBrowser->setEngine(m_engine);
	
	connect(content, SIGNAL(linkActivated(const QUrl&)), this, SLOT(openPage(const QUrl&)));
	connect(content, SIGNAL(clicked(const QModelIndex&)), this, SLOT(itemClicked(const QModelIndex&)));
	connect(textBrowser, SIGNAL(sourceChanged(const QUrl&)), this, SLOT(sourceChanged()));
	
	openPage( QUrl(INDEX_URL) );
	
	QTimer::singleShot(100, content, SLOT(expandAll()));
	QTimer::singleShot(100, this, SLOT(sourceChanged()));
}
Ejemplo n.º 16
0
/*!
 * \brief SimulationOutputTree::SimulationOutputTree
 * \param pSimulationOutputWidget
 */
SimulationOutputTree::SimulationOutputTree(SimulationOutputWidget *pSimulationOutputWidget)
  : QTreeView(pSimulationOutputWidget), mpSimulationOutputWidget(pSimulationOutputWidget)
{
  setItemDelegate(new ItemDelegate(this, true));
  setTextElideMode(Qt::ElideNone);
  setIndentation(Helper::treeIndentation);
  setExpandsOnDoubleClick(false);
  setHeaderHidden(true);
  setMouseTracking(true); /* important for Debug more links. */
  setSelectionMode(QAbstractItemView::ExtendedSelection);
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
  connect(header(), SIGNAL(sectionResized(int,int,int)), SLOT(callLayoutChanged(int,int,int)));
  // create actions
  mpSelectAllAction = new QAction(tr("Select All"), this);
  mpSelectAllAction->setShortcut(QKeySequence("Ctrl+a"));
  mpSelectAllAction->setStatusTip(tr("Selects all the Messages"));
  connect(mpSelectAllAction, SIGNAL(triggered()), SLOT(selectAllMessages()));
  mpCopyAction = new QAction(QIcon(":/Resources/icons/copy.svg"), Helper::copy, this);
  mpCopyAction->setShortcut(QKeySequence("Ctrl+c"));
  mpCopyAction->setStatusTip(tr("Copy the Message"));
  connect(mpCopyAction, SIGNAL(triggered()), SLOT(copyMessages()));
  mpExpandAllAction = new QAction(Helper::expandAll, this);
  mpExpandAllAction->setStatusTip(tr("Copy the Message"));
  connect(mpExpandAllAction, SIGNAL(triggered()), SLOT(expandAll()));
  mpCollapseAllAction = new QAction(Helper::collapseAll, this);
  mpCollapseAllAction->setStatusTip(tr("Copy the Message"));
  connect(mpCollapseAllAction, SIGNAL(triggered()), SLOT(collapseAll()));
}
/*!
    显示参数
    @para[in]  const STUPatient* patientPtr  
    @return  void
*/
void QPatientInfoWidget::FillPatient(const STUPatient* patientPtr)
{
	//清空内容
	clear();

	if (NULL != patientPtr)
	{
		//demographics
		AddDemographics(patientPtr->m_demographics);

		//assignedLocation
		AddAssignedLocation(patientPtr->m_assignedLocation);

		//doctor
		AddDoctor(patientPtr->m_doctor);

		//technician
		AddTechnician(patientPtr->m_technician);

		//PACE
		AddChildItem(this, TAGNAME_PACED, patientPtr->m_paced);

		//medications
		AddMedications(patientPtr->m_medications);

		//clinicalClassifications
		AddClinicalClassifications(patientPtr->m_clinicalClassfications);
	}

	//全部展开
	expandAll();
}
SystemsSettingsEditor::SystemsSettingsEditor( QWidget* parent)
		:QtPropertyEditor(parent)
{
	sceneEditor = QtMainWindow::Instance()->GetCurrentScene();
	InitializeProperties();
	expandAll();
	resizeColumnToContents(0);
}
Ejemplo n.º 19
0
/*================================================================
*  函 数 名: LinkTreeWidget::moveComputerItem
*
*  功能描述: 列表移动一个连接计算机信息
*
*  参    数: QString &strTitle —— 要添加的计算机命名
*			  QString strNewGroup —— 要移动的组名
*			  bool isOnline —— 该计算机是否连接上服务端
*  返 回 值: bool —— 成功或失败
*
*  作    者:刘欢 2013/8
================================================================*/
bool LinkTreeWidget::moveComputerItem(QString strTitle, QString strNewGroup)
{
	removeComputerItem(strTitle);
	addComputerItem(strNewGroup, strTitle, true);
	expandAll();

	return true;
}
Ejemplo n.º 20
0
void BranchesTree::update()
{
    clear();
    addNode(BranchesTree::HeaderBranches, Reference::BRANCH);
    addRemotesNodes();
    addNode(BranchesTree::HeaderTags, Reference::TAG);
    expandAll();
}
Ejemplo n.º 21
0
void SceneGraphWidget::slotModelReset()
{
    expandAll();
    if(selectedIndex_.isValid() && SceneGraphItemModel_->hasIndex(selectedIndex_.row(),selectedIndex_.column(),selectedIndex_.parent()))
    {
        setCurrentIndex(SceneGraphItemModel_->index(selectedIndex_.row(),selectedIndex_.column(),selectedIndex_.parent()));
    }
}
Ejemplo n.º 22
0
void FolderTreeWidget::loadFolders(IMAPClient* client) {
    m_client = client;
    FolderTreeItem* folder = new FolderTreeItem(NULL);
    folder->setText(0, m_client->getUser().getUsername());
    addTopLevelItem(folder);
    QList<IMAPFolder*> folders = m_client->getFolders();
    addFolderChildren(folder, folders);
    expandAll();
}
Ejemplo n.º 23
0
void TabDeckEditor::createFiltersDock()
{
    filterModel = new FilterTreeModel();
    filterModel->setObjectName("filterModel");
    databaseDisplayModel->setFilterTree(filterModel->filterTree());
    databaseDisplayModel->setObjectName("databaseDisplayModel");
    filterView = new QTreeView;
    filterView->setObjectName("filterView");
    filterView->setModel(filterModel);
    filterView->setUniformRowHeights(true);
    filterView->setHeaderHidden(true);
    filterView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(filterModel, SIGNAL(layoutChanged()), filterView, SLOT(expandAll()));
    connect(filterView, SIGNAL(customContextMenuRequested(const QPoint &)),this, SLOT(filterViewCustomContextMenu(const QPoint &)));

    FilterBuilder *filterBuilder = new FilterBuilder;
    filterBuilder->setObjectName("filterBuilder");
    connect(filterBuilder, SIGNAL(add(const CardFilter *)), filterModel, SLOT(addFilter(const CardFilter *)));

    QToolButton *filterDelOne = new QToolButton();
    filterDelOne->setObjectName("filterDelOne");
    filterDelOne->setDefaultAction(aClearFilterOne);
    filterDelOne->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

    QToolButton *filterDelAll = new QToolButton();
    filterDelAll->setObjectName("filterDelAll");
    filterDelAll->setDefaultAction(aClearFilterAll);
    filterDelAll->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

    QGridLayout *filterLayout = new QGridLayout;
    filterLayout->setObjectName("filterLayout");
    filterLayout->setContentsMargins(0,0,0,0);
    filterLayout->addWidget(filterBuilder, 0, 0, 1, 3);
    filterLayout->addWidget(filterView, 1, 0, 1, 3);
    filterLayout->addWidget(filterDelOne, 2, 0, 1, 1);
    filterLayout->addWidget(filterDelAll, 2, 2, 1, 1);

    filterBox = new QWidget();
    filterBox->setObjectName("filterBox");
    filterBox->setLayout(filterLayout);

    QVBoxLayout *filterFrame = new QVBoxLayout;
    filterFrame->setObjectName("filterFrame");
    filterFrame->addWidget(filterBox);

    filterDock = new QDockWidget(MainWindow);
    filterDock->setObjectName("filterDock");

    filterDock->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *filterDockContents = new QWidget(MainWindow);
    filterDockContents->setObjectName("filterDockContents");
    filterDockContents->setLayout(filterFrame);
    filterDock->setWidget(filterDockContents);    

    connect(btnFilter,SIGNAL(toggled(bool)),filterDock,SLOT(setVisible(bool)));
    filterDock->installEventFilter(this);
}
Ejemplo n.º 24
0
// read an xml file and check for errors
bool UserMenuTree::readXml(const QString &filename)
{
	KILE_DEBUG() << "read xml file " << filename;

	QDomDocument doc("UserMenu");
	QFile file(filename);
	if ( !file.open(QFile::ReadOnly | QFile::Text) ) {
		KMessageBox::error(this, i18n("File '%1' does not exist.", filename));
		return false;
	}
	if ( !doc.setContent( &file ) ) {
		file.close();
		return false;
	}
	file.close();

	KILE_DEBUG() << "parse xml ...";
	blockSignals(true);

	// clear menutree
	clear();

	// read toplevelitems
	QDomElement root = doc.documentElement();
	QDomElement e = root.firstChildElement();
	while ( !e.isNull()) {
		QString tag = e.tagName();

		UserMenuItem *item = NULL;
		if ( tag == "submenu" ) {
			item = readXmlSubmenu(e);
		}
		else if ( tag == "separator" ) {
			item = readXmlSeparator();
		}
		else /* if ( tag == "menu" ) */ {
			item = readXmlMenuentry(e);
		}

		if ( item ) {
			addTopLevelItem(item);
		}
		e = e.nextSiblingElement();
	}

	// the xml menu is built, now check for errors
	setErrorCodes();

	// polish menutree
	expandAll();
	if ( topLevelItemCount() > 0 ) {
		setCurrentItem( topLevelItem(0) );
	}
	blockSignals(false);

	return true;
}
Ejemplo n.º 25
0
void HelpWindow::setHelpEngine(QHelpEngine* engine)
{
  mpHelpEngine = engine;
  mpSearchEngine = engine->searchEngine();

  ui->textBrowser->setHelpEngine(engine);

  QTabWidget* tWidget = new QTabWidget;
  tWidget->setMaximumWidth(200);


  QWidget *widget = new QWidget(this);
  QVBoxLayout *vLayout = new QVBoxLayout(widget);

  QHelpSearchQueryWidget* queryWidget = mpSearchEngine->queryWidget();
  QHelpSearchResultWidget* resultWidget = mpSearchEngine->resultWidget();
  QHelpContentWidget * contentWidget = engine->contentWidget();

  vLayout->addWidget(queryWidget);
  vLayout->addWidget(resultWidget);

  widget->setLayout(vLayout);
  widget->setFocusProxy(queryWidget);

  mpSearchEngine->reindexDocumentation();

  tWidget->addTab(contentWidget, "Contents");
  tWidget->addTab(widget, "Search");

  // no use in displaying the index for now as we don't
  // have one specified yet
  //tWidget->addTab(engine->indexWidget(), "Index");

  ui->dockWidget->setWidget(tWidget);

  connect(queryWidget, SIGNAL(search()), this, SLOT(search()));
  connect(resultWidget, SIGNAL(requestShowLink(QUrl)), ui->textBrowser, SLOT(setSource(QUrl)));

  connect(contentWidget,
          SIGNAL(linkActivated(QUrl)),
          ui->textBrowser, SLOT(setSource(QUrl)));
  connect(engine->indexWidget(),
          SIGNAL(linkActivated(QUrl, QString)),
          ui->textBrowser, SLOT(setSource(QUrl)));


  contentWidget->setItemsExpandable(true);


  ui->textBrowser->setSource(QUrl("qthelp://org.sphinx.deviser.1.0/doc/deviser.html"));


  // expanding the content for whatever reason does not work
  // right away, so we delay it for a bit.
  QTimer::singleShot(100, contentWidget, SLOT(expandAll()));

}
Ejemplo n.º 26
0
EngineExplorer::EngineExplorer(QWidget* parent)
    : QDialog(parent),
      m_engine(0),
      m_sourceCount(0),
      m_requestingSource(false),
      m_expandButton(new QPushButton(i18n("Expand All"), this)),
      m_collapseButton(new QPushButton(i18n("Collapse All"), this))
{
#ifdef FOUND_SOPRANO
    (void) qRegisterMetaType<Soprano::Node>();
#endif
    setWindowTitle(i18n("Plasma Engine Explorer"));
    QWidget* mainWidget = new QWidget(this);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
    buttonBox->addButton(m_expandButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(m_collapseButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(QDialogButtonBox::Close);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(mainWidget);
    layout->addWidget(buttonBox);
    setLayout(layout);

    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    setupUi(mainWidget);

    m_engineManager = Plasma::PluginLoader::self();
    m_dataModel = new QStandardItemModel(this);
    const QIcon pix = QIcon::fromTheme("plasma");
    const int size = IconSize(KIconLoader::Dialog);
    m_title->setPixmap(pix.pixmap(size, size));
    connect(m_engines, SIGNAL(activated(QString)), this, SLOT(showEngine(QString)));
    connect(m_sourceRequesterButton, SIGNAL(clicked(bool)), this, SLOT(requestSource()));
    connect(m_serviceRequesterButton, SIGNAL(clicked(bool)), this, SLOT(requestServiceForSource()));
    m_data->setModel(m_dataModel);
    m_data->setWordWrap(true);

    m_searchLine->setTreeView(m_data);
    m_searchLine->setPlaceholderText(i18n("Search"));

    listEngines();
    m_engines->setFocus();

    connect(m_collapseButton, SIGNAL(clicked()), m_data, SLOT(collapseAll()));
    connect(m_expandButton, SIGNAL(clicked()), m_data, SLOT(expandAll()));
    enableButtons(false);

    addAction(KStandardAction::quit(qApp, SLOT(quit()), this));

    connect(m_data, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showDataContextMenu(QPoint)));
    m_data->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanUp()));
}
Ejemplo n.º 27
0
void TOutlineViewer::expandAll(TNode *node) {
   int i, n;

   if (hasChildren(node)) {
      adjust(node, True);
      n = getNumChildren(node) - 1;
      for (i = 0; i <= n; i++)
         expandAll(getChild(node, i));
   }
}
Ejemplo n.º 28
0
void NickView::unanimatedExpandAll()
{
    // since of Qt Version 4.8.0 the default expandAll will not properly work if
    // animations are enabled. Therefore we perform an unanimated expand when a
    // model is set or a toplevel node is inserted.
    bool wasAnimated = isAnimated();
    setAnimated(false);
    expandAll();
    setAnimated(wasAnimated);
}
Ejemplo n.º 29
0
TextureDirWidget::TextureDirWidget(QWidget *parent) :
    QWidget(parent),
    m_toolBar(new Manhattan::StyledBar),
    m_view(new QTreeView),
    m_model(new QFileSystemModel)
{
//    QAction *small = m_toolBar->addAction(tr("Small icon size"));
//    small->setCheckable(true);
//    connect(small, SIGNAL(triggered()), this, SLOT(setSmallIconSize()));

//    QAction *medium = m_toolBar->addAction(tr("Medium icon size"));
//    medium->setCheckable(true);
//    connect(medium, SIGNAL(triggered()), this, SLOT(setMediumIconSize()));

//    QAction *big = m_toolBar->addAction(tr("Big icon size"));
//    big->setCheckable(true);
//    connect(big, SIGNAL(triggered()), this, SLOT(setBigIconSize()));

//    QActionGroup *group = new QActionGroup(m_toolBar);
//    group->addAction(small);
//    group->addAction(medium);
//    group->addAction(big);

//    m_toolBar->setSingleRow(false);
    {
        QHBoxLayout *layout = new QHBoxLayout(m_toolBar);
        layout->setMargin(0);
        layout->setSpacing(4);
        layout->setContentsMargins(5, 0, 0, 0);
        layout->addWidget(new QLabel(tr(LabelText)));
    }

    connect(m_model, SIGNAL(directoryLoaded(QString)), m_view, SLOT(expandAll()));
    m_model->setRootPath(QDir::currentPath());
    m_model->setNameFilterDisables(false);
    m_model->setNameFilters(nameFilters());
    m_model->setIconProvider(new TextureIconProvider);

    m_view->setDragEnabled(true);
    m_view->setDragDropMode(QAbstractItemView::DragOnly);
    m_view->setHeaderHidden(true);
    m_view->setIconSize(IconSize);
    m_view->setModel(m_model);
    m_view->setRootIndex(m_model->index(QDir::currentPath()));
    for(int i = 1; i < m_model->columnCount(); ++i) {
        m_view->setColumnHidden(i, true);
    }
    m_view->setStyleSheet("QTreeView { border: 0; }");

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->addWidget(m_toolBar);
    layout->addWidget(m_view);
}
Ejemplo n.º 30
0
void TestLevelTreeView::setModel(TestLevelModel* model) {
  QTreeView::setModel(model);
  _model = model;

  setColumnWidth(0, 120);
  for (int k = 1; k < 4; k++)
    setColumnWidth(k, 70);

  expandAll();

//  connect(_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(debugDataChanged(QModelIndex,QModelIndex)));
}