PropertiesDock::PropertiesDock(QTabWidget *tabWidget, QWidget *parent) : QDockWidget(parent), closing(false), ui(new Ui::PropertiesDock), mTabWidget(tabWidget), mScene(0) { ui->setupUi(this); setVisible(false); setFloating(true); setObjectName("propertiesDock"); ui->rows->setValue(Settings::inst()->value("rowCount").toInt()); ui->columns->setValue(Settings::inst()->value("stitchCount").toInt()); ui->cellHeight->setValue(Settings::inst()->value("cellHeight").toInt()); ui->cellWidth->setValue(Settings::inst()->value("cellWidth").toInt()); int styleIdx = ui->ind_indicatorStyle->findText(Settings::inst()->value("chartRowIndicator").toString()); ui->ind_indicatorStyle->setCurrentIndex(styleIdx); clearUi(); connect(mTabWidget, SIGNAL(currentChanged(int)), SLOT(tabChanged(int))); connect(ui->gen_angle, SIGNAL(valueChanged(double)), SLOT(cellUpdateAngle(double))); connect(ui->gen_scaleX, SIGNAL(valueChanged(double)), SLOT(cellUpdateScaleX(double))); connect(ui->gen_scaleY, SIGNAL(valueChanged(double)), SLOT(cellUpdateScaleY(double))); connect(ui->gen_xPos, SIGNAL(valueChanged(double)), SLOT(cellUpdatePositionX(double))); connect(ui->gen_yPos, SIGNAL(valueChanged(double)), SLOT(cellUpdatePositionY(double))); connect(ui->showChartCenter, SIGNAL(toggled(bool)), SLOT(chartUpdateChartCenter(bool))); connect(ui->guidelinesType, SIGNAL(currentIndexChanged(QString)), SLOT(chartUpdateGuidelines())); connect(ui->st_stitch, SIGNAL(currentIndexChanged(QString)), SLOT(cellUpdateStitch(QString))); connect(ui->gen_deleteItems, SIGNAL(clicked()), SLOT(cellDeleteItems())); connect(ui->guidelinesType, SIGNAL(currentIndexChanged(int)), SLOT(updateGuidelinesUi())); updateGuidelinesUi(); connect(ui->rows, SIGNAL(valueChanged(int)), SLOT(chartUpdateGuidelines())); connect(ui->cellWidth, SIGNAL(valueChanged(int)), SLOT(chartUpdateGuidelines())); connect(ui->columns, SIGNAL(valueChanged(int)), SLOT(chartUpdateGuidelines())); connect(ui->cellHeight, SIGNAL(valueChanged(int)), SLOT(chartUpdateGuidelines())); connect(ui->st_stBgColorBttn, SIGNAL(clicked(bool)), SLOT(cellUpdateBgColor())); connect(ui->st_stColorBttn, SIGNAL(clicked(bool)), SLOT(cellUpdateFgColor())); connect(ui->ind_indicatorStyle, SIGNAL(currentIndexChanged(int)), SLOT(indicatorUpdate())); setupStitchCombo(); ui->indX_IndicatorEditText->setVisible(false); ui->indX_indicatorTextEdit->setVisible(false); }
void PropertiesDock::tabChanged(int tabNumber) { if(tabNumber == -1) { clearUi(); return; } mScene = qobject_cast<CrochetTab*>(mTabWidget->widget(tabNumber))->scene(); connect(mScene, SIGNAL(selectionChanged()), SLOT(updateDialogUi())); updateDialogUi(); }
void MaMainWindow::newItem() { MaTreeWidget* treeWidget = curTreeWidget(); // Saving the current item: MaItem* curItem = this->curItem(); if (NULL == curItem) return; if (curItem->isTopItem() && !curItem->isParentItem()) { newChildItem(); return; } doUiDataExchange(false, curItem); MaParentItem* parItem = NULL; if (curItem->isParentItem()) parItem = qobject_cast<MaParentItem*>(curItem); else parItem = curItem->parentItem(); if (NULL != parItem) { MaItem* newItem = parItem->createNewChildItem(); QTreeWidgetItem* curTreeItem = treeWidget->currentItem(); if (NULL == curTreeItem) { Q_ASSERT(0); return; } QTreeWidgetItem* newTreeItem = new QTreeWidgetItem(QStringList("[New Item]")); newTreeItem->setData(3, Qt::EditRole, qVariantFromValue((void*) newItem)); newTreeItem->setIcon(0, mItemIcon); if (curItem->isParentItem()) curTreeItem->addChild(newTreeItem); else curTreeItem->parent()->addChild(newTreeItem); treeWidget->setCurrentItem(newTreeItem, 0); treeWidget->sortItems(0, Qt::AscendingOrder); } clearUi(); mCaptionTextEditWidget->setFocus(Qt::ShortcutFocusReason); }
void MaMainWindow::newTopItem() { MaTreeWidget* treeWidget = curTreeWidget(); // Saving the current item: MaItem* curItem = this->curItem(); if (NULL == curItem) return; doUiDataExchange(false, curItem); MaItem* newItem = _STORE->rootItem()->createNewChildItem(); QTreeWidgetItem* newTreeItem = new QTreeWidgetItem(QStringList("[New Item]")); newTreeItem->setData(3, Qt::EditRole, qVariantFromValue((void*) newItem)); newTreeItem->setIcon(0, mItemIcon); treeWidget->addTopLevelItem(newTreeItem); treeWidget->setCurrentItem(newTreeItem, 0); treeWidget->sortItems(0, Qt::AscendingOrder); clearUi(); mCaptionTextEditWidget->setFocus(Qt::ShortcutFocusReason); }
void MaMainWindow::onLeftPaneTabIndexChanged( int newIndex ) { int oldIndex = 0 == newIndex ? 1 : 0; MaItem* item = curItem(oldIndex); if (NULL != item) doUiDataExchange(false, item); doUiDataExchange(true, curItem()); if (NULL == curItem()) clearUi(); if (0 == newIndex) { onClearFindInText(); mItemTreeWidget->setFocus(Qt::OtherFocusReason); } else if (1 == newIndex) { mFindItemsLineEdit->setFocus(Qt::OtherFocusReason); mFindItemsLineEdit->selectAll(); } mRightPaneTabWidget->setTabEnabled(1, 0 == newIndex); }