void TabView::onTabContentChanged() { if (auto pCurrentTab = qobject_cast<Tab *>(currentWidget())) { pCurrentTab->setModified(true); if (pCurrentTab->isNew()) emit tabModified(true); else { if (auto pTabSnippet = pCurrentTab->snippet()) { const auto strTitle = QString{"%1*"}.arg(pTabSnippet->name()); pCurrentTab->setTitle(pTabSnippet->name()); const auto nIndex = currentIndex(); setTabText(nIndex, strTitle); setTabToolTip(nIndex, strTitle); pTabSnippet->setModified(true); emit tabTitleChanged(pTabSnippet->name()); emit tabModified(true); emit tabContentChanged(pTabSnippet->id(), true); } } } }
void TabView::emitTabChanged(int index) { Q_UNUSED(index); if (count() == 0) { m_pLastTab = nullptr; emit tabTitleChanged(""); emit tabModified(false); emit tabChanged(nullptr, nullptr); return; } auto pCurrentTab = qobject_cast<Tab *>(currentWidget()); if (m_pLastTab != pCurrentTab) { if (pCurrentTab != nullptr) { if (m_pLastTab != nullptr) disconnectTab(m_pLastTab); connectTab(pCurrentTab); emit tabTitleChanged(pCurrentTab->title()); emit tabModified(pCurrentTab->isModified() || pCurrentTab->isNew()); emit tabChanged(m_pLastTab, pCurrentTab); } m_pLastTab = pCurrentTab; } }
void TabView::updateSnippetNameDataLanguageID(int snippetID) { if (snippetID < 1) return; const auto nTabIndex = snippetTabIndex(snippetID); if (nTabIndex >= 0 && nTabIndex < count()) { if (auto pTab = qobject_cast<Tab*>(widget(nTabIndex))) { auto pTabSnippet = pTab->snippet(); if (!pTabSnippet) return; qDebug() << Q_FUNC_INFO; const auto bIsTabModified = pTab->isModified(); auto strTitle = pTabSnippet->name(); pTab->setTitle(strTitle); emit tabTitleChanged(strTitle); if (bIsTabModified) strTitle += "*"; setTabText(nTabIndex, strTitle); setTabToolTip(nTabIndex, strTitle); emit tabModified(bIsTabModified); } } }
void TabView::onSnippetContentUpdated(int snippetID) { if (snippetID < 1) return; const auto nTabIndex = snippetTabIndex(snippetID); if (nTabIndex >= 0 && nTabIndex < count()) { if (auto pTab = qobject_cast<Tab*>(widget(nTabIndex))) { qDebug() << Q_FUNC_INFO; const auto strCurrentTitle = pTab->title(); setTabText(nTabIndex, strCurrentTitle); setTabToolTip(nTabIndex, strCurrentTitle); disconnectTab(pTab); pTab->updateContent(); connectTab(pTab); pTab->setModified(false); emit tabModified(false); } } }
void CrochetTab::setShowChartCenter(bool state) { mScene->setShowChartCenter(state); emit tabModified(true); }
LabelItemDialog::LabelItemDialog(LabelItem *item, QWidget *parent) : ViewItemDialog(item, parent), _labelItem(item) { _propertiesTab = new LabelPropertiesTab(this); DialogPage *propertiesPage = new DialogPage(this); propertiesPage->setPageTitle(tr("Properties")); propertiesPage->addDialogTab(_propertiesTab); addDialogPage(propertiesPage); selectDialogPage(propertiesPage); connect(_propertiesTab, SIGNAL(apply()), this, SLOT(propertiesChanged())); setupProperties(); _saveAsDefault->show(); _labelDimensionsTab = new LabelDimensionsTab(item, this); DialogPage *labelDimensionsPage = new DialogPage(this); labelDimensionsPage->setPageTitle(tr("Size/Position")); labelDimensionsPage->addDialogTab(_labelDimensionsTab); addDialogPage(labelDimensionsPage); selectDialogPage(labelDimensionsPage); connect(_labelDimensionsTab, SIGNAL(apply()), this, SLOT(dimensionsChanged())); setupDimensions(); connect(_labelDimensionsTab, SIGNAL(tabModified()), this, SLOT(modified())); connect(_saveAsDefault, SIGNAL(clicked()), this, SLOT(modified())); }
CircleItemDialog::CircleItemDialog(CircleItem *item, QWidget *parent) : ViewItemDialog(item, parent), _viewItem(item) { _circleDimensionsTab = new CircleDimensionsTab(item, this); DialogPage *circleDimensionsPage = new DialogPage(this); circleDimensionsPage->setPageTitle(tr("Size/Position")); circleDimensionsPage->addDialogTab(_circleDimensionsTab); addDialogPage(circleDimensionsPage); selectDialogPage(circleDimensionsPage); connect(_circleDimensionsTab, SIGNAL(apply()), this, SLOT(dimensionsChanged())); setupDimensions(); connect(_circleDimensionsTab, SIGNAL(tabModified()), this, SLOT(modified())); }
ViewItemDialog::ViewItemDialog(ViewItem *item, QWidget *parent) : Dialog(parent), _mode(Single), _item(item) { setWindowTitle(tr("Edit View Item")); // semi-hack: set the width of the list widget to 15 characters, which is enough // to say "X-Axis Markers" in english. This is better than setting it to a fixed // number of pixels, as it scales with font size or screen resolution, but // it won't necessairly survive translations, or someone adding a option like // "Do something super important", which has more than 15 characters. // We have to do it here, before the layout is set, and we don't yet know how // what is going into the listWidget. _listWidget->setMinimumWidth(_listWidget->fontMetrics().averageCharWidth()*15); QWidget *extension = extensionWidget(); QVBoxLayout *extensionLayout = new QVBoxLayout(extension); extensionLayout->setContentsMargins(0, -1, 0, -1); _editMultipleWidget = new EditMultipleWidget(); extensionLayout->addWidget(_editMultipleWidget); extension->setLayout(extensionLayout); _editMultipleBox = topCustomWidget(); QHBoxLayout *layout = new QHBoxLayout(_editMultipleBox); _tagStringLabel = new QLabel(tr("&Name:"), _editMultipleBox); _tagStringLabel->setObjectName("_tagStringLabel"); _tagString = new QLineEdit(_editMultipleBox); connect(_tagString, SIGNAL(textChanged(QString)), this, SLOT(modified())); _tagStringLabel->setBuddy(_tagString); _editMultipleButton = new QPushButton(tr("Edit Multiple >>")); _editMultipleButton->setObjectName("_editMultipleButton"); connect(_editMultipleButton, SIGNAL(clicked()), this, SLOT(slotEditMultiple())); layout->addWidget(_tagStringLabel); layout->addWidget(_tagString); layout->addWidget(_editMultipleButton); _editMultipleBox->setLayout(layout); setSupportsMultipleEdit(false); if (_item->hasBrush()) { _fillTab = new FillTab(this); connect(_fillTab, SIGNAL(apply()), this, SLOT(fillChanged())); } if (_item->hasStroke()) { _strokeTab = new StrokeTab(this); connect(_strokeTab, SIGNAL(apply()), this, SLOT(strokeChanged())); } _layoutTab = new LayoutTab(this); connect(_layoutTab, SIGNAL(apply()), this, SLOT(layoutChanged())); DialogPageTab *page = new DialogPageTab(this); page->setPageTitle(tr("Appearance")); if (_item->hasBrush()) { page->addDialogTab(_fillTab); } if (_item->hasStroke()) { page->addDialogTab(_strokeTab); } page->addDialogTab(_layoutTab); addDialogPage(page); if (!_item->customDimensionsTab()) { _dimensionsTab = new DimensionsTab(_item, this); DialogPage *dimensionsPage = new DialogPage(this); dimensionsPage->setPageTitle(tr("Size/Position")); dimensionsPage->addDialogTab(_dimensionsTab); addDialogPage(dimensionsPage); connect(_dimensionsTab, SIGNAL(apply()), this, SLOT(dimensionsChanged())); } else { _dimensionsTab = 0; } QList<DialogPage*> dialogPages = _item->dialogPages(); foreach (DialogPage *dialogPage, dialogPages) addDialogPage(dialogPage); setupFill(); setupStroke(); setupLayout(); setupDimensions(); selectDialogPage(page); if (!_item->customDimensionsTab()) { connect(_dimensionsTab, SIGNAL(tabModified()), this, SLOT(modified())); } connect(this, SIGNAL(editMultipleMode()), this, SLOT(setMultipleEdit())); connect(this, SIGNAL(editSingleMode()), this, SLOT(setSingleEdit())); connect(_item, SIGNAL(relativeSizeUpdated()), this, SLOT(setupDimensions())); connect(_saveAsDefault, SIGNAL(clicked()), this, SLOT(modified())); _saveAsDefault->show(); _tagStringLabel->setProperty("si","&Name:"); _editMultipleButton->setProperty("si","Edit Multiple >>"); }
void LineDimensionsTab::modified() { emit tabModified(); }
void RangeTab::modified() { emit tabModified(); }