void MergedProxyModel::setSourceModel(QAbstractItemModel* source_model) { if (sourceModel()) { disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(SourceModelReset())); disconnect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(RowsAboutToBeInserted(QModelIndex,int,int))); disconnect(sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(RowsAboutToBeRemoved(QModelIndex,int,int))); disconnect(sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(RowsInserted(QModelIndex,int,int))); disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(RowsRemoved(QModelIndex,int,int))); disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(DataChanged(QModelIndex,QModelIndex))); disconnect(sourceModel(), SIGNAL(layoutAboutToBeChanged()), this, SLOT(LayoutAboutToBeChanged())); disconnect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(LayoutChanged())); } QAbstractProxyModel::setSourceModel(source_model); connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(SourceModelReset())); connect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(RowsAboutToBeInserted(QModelIndex,int,int))); connect(sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(RowsAboutToBeRemoved(QModelIndex,int,int))); connect(sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(RowsInserted(QModelIndex,int,int))); connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(RowsRemoved(QModelIndex,int,int))); connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(DataChanged(QModelIndex,QModelIndex))); connect(sourceModel(), SIGNAL(layoutAboutToBeChanged()), this, SLOT(LayoutAboutToBeChanged())); connect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(LayoutChanged())); }
Bool MainDialog::Command(Int32 id, const BaseContainer& msg) { switch (id) { case GADGET_SUB1: if (!lastdlg || !lastdlg->CheckClose()) { AttachSubDialog(&subdialog1, GADGET_SUBDIALOG); LayoutChanged(GADGET_SUBDIALOG); lastdlg = &subdialog1; } break; case GADGET_SUB2: if (!lastdlg || !lastdlg->CheckClose()) { AttachSubDialog(&subdialog2, GADGET_SUBDIALOG); LayoutChanged(GADGET_SUBDIALOG); lastdlg = &subdialog2; } break; } return true; }
/*********************************************************************\ Function name : CDialogPreview::Update Description : Created at : 11.08.01, @ 15:09:59 Created by : Thomas Kunert Modified by : \*********************************************************************/ void CDialogPreview::Update() { CDialogTemplate* pTempl = m_pDocument->GetDialog(); if (!pTempl) return; m_wndSubDlg.SetDialog(this, pTempl); AttachSubDialog(&m_wndSubDlg, IDC_PREVIEW_SUB_DLG); LayoutChanged(IDC_PREVIEW_SUB_DLG); String strFile = m_pDocument->UpdateDialogCaptions(); String strCaption = pTempl->m_strName; strCaption += " ["; strCaption += GeLoadString(IDS_RES_EDIT_PREVIEW_CAPT) + " - " + strFile; strCaption += "]"; SetTitle(strCaption); }
void UpdateGadgets(Bool relevants=false) { Int32 mode; Bool add_dynamics; GetBool(CHK_ADDDYNAMICS, add_dynamics); GetInt32(CMB_MODE, mode); BaseDocument* doc = GetActiveDocument(); BaseObject* op = doc ? doc->GetActiveObject() : nullptr; Enable(EDT_MAXCONN, mode != CMB_MODE_CHAIN); Enable(EDT_RADIUS, mode != CMB_MODE_CHAIN); Enable(CHK_CLOSED, mode == CMB_MODE_CHAIN); Enable(CHK_COMPOUND, add_dynamics); // Need at least two child objects on the active object. Bool execEnabled = op != nullptr && op->GetDown() != nullptr && op->GetDown()->GetNext() != nullptr; Enable(BTN_EXECUTE, execEnabled); if (relevants) { FreeChildren(CMB_TYPE); Int32 pluginid; GetInt32(CMB_FORCE, pluginid); do { BaseObject* op = BaseObject::Alloc(pluginid); if (!op) break; AutoFree<BaseObject> free(op); AutoAlloc<Description> desc; if (!op->GetDescription(desc, DESCFLAGS_DESC_0)) break; BaseContainer temp; AutoAlloc<AtomArray> arr; const BaseContainer* param = desc->GetParameter(FORCE_TYPE, temp, arr); if (!param) break; const BaseContainer* cycle = param->GetContainerInstance(DESC_CYCLE); if (!cycle) break; const BaseContainer* icons = param->GetContainerInstance(DESC_CYCLEICONS); Int32 i = 0; Int32 last_id = -1; while (true) { Int32 id = cycle->GetIndexId(i++); if (id == NOTOK) break; Int32 icon = icons ? icons->GetInt32(id) : -1; String name = cycle->GetString(id); if (name.Content()) { if (icon > 0) name += "&i" + String::IntToString(icon); if (last_id < 0) last_id = id; AddChild(CMB_TYPE, id, name); } } SetInt32(CMB_TYPE, last_id); } while (0); LayoutChanged(CMB_TYPE); } }
void PaletteSubDialog::PaletteLayout() { if(m_rowArea != NULL){ GetInt32(m_rowArea, m_rows); } if(m_layoutArea != NULL){ GetInt32(m_layoutArea, m_layout); } if(m_labelCheckArea != NULL){ GetBool(m_labelCheckArea,m_showLabel); } if(m_searchText != NULL){ GetString(m_searchText, m_searchString); } if(m_showControls && !m_controlsShown){ LayoutFlushGroup(1); GroupBegin(51, BFV_SCALEFIT, 1, 0, String(), 0); m_nameArea = AddEditText(IDC_NAME, BFH_SCALEFIT); SetString(IDC_NAME, m_palette.m_name); GroupBegin(123,BFH_SCALEFIT,0,1,String(),0); String rowText("Rows"); if(m_layout == 1){ rowText = String("Columns"); } AddStaticText(9, BFH_LEFT, 0, 0, rowText, 0); m_rowArea = AddEditNumberArrows(IDC_ROWS, BFH_RIGHT); GroupEnd(); SetInt32(m_rowArea, m_rows,1,99); m_layoutArea = AddComboBox(IDC_LAYOUT_DIRECTION,BFH_LEFT); AddChild(m_layoutArea, 0, String("Horizontal")); AddChild(m_layoutArea, 1, String("Vertical")); SetInt32(m_layoutArea, m_layout); m_labelCheckArea = AddCheckbox(IDC_LABELCHECKBOX,BFH_LEFT,0,0,String("Show Labels")); SetBool(m_labelCheckArea, m_showLabel); AddStaticText(IDC_FILTERLABEL, BFH_CENTER, 0, 0, String("Filter:"), 0); m_searchText = AddEditText(IDC_SEARCHTEXT, BFH_SCALEFIT); SetString(m_searchText, m_searchString); m_controlsShown = TRUE; GroupBegin(142,BFV_SCALEFIT,1,0,String(),0); GroupBorderNoTitle(BORDER_THIN_IN); AddButton(IDC_CREATEMATERIAL, BFH_CENTER, 0, 0, String("Create Materials")); m_linkColor = AddCheckbox(IDC_LINKMATERIALS,BFH_LEFT,0,0,String("Link colors")); GroupEnd(); AddButton(IDC_HIDE, BFH_CENTER, 0, 0, String("Hide Controls")); GroupEnd(); GroupBegin(3,BFV_SCALEFIT,1,0,String(),0); m_actionPopup = AddPopupButton(3,BFH_LEFT); m_trashArea = AddUserArea(4, BFH_CENTER); AttachUserArea(m_trash, m_trashArea); GroupEnd(); LayoutChanged(1); } if(!m_showControls && m_controlsShown){ LayoutFlushGroup(1); GroupBegin(3,BFV_SCALEFIT,1,0,String(),0); m_actionPopup = AddPopupButton(3,BFH_LEFT); m_trashArea = AddUserArea(4, BFH_CENTER); AttachUserArea(m_trash, m_trashArea); GroupEnd(); LayoutChanged(1); m_rowArea = NULL; m_layoutArea = NULL; m_labelCheckArea = NULL; m_searchText = NULL; m_controlsShown = FALSE; } LayoutFlushGroup(6); LayoutPalette(); LayoutChanged(6); }