void TierWindow::openCategoryEdit(TierCategory *c) { helper = new ConfigForm("Delete Category", "Apply", this); currentEdit = c->name(); currentType = CategoryT; currentTierCat = c; helper->addConfigHelper(new ConfigLine("Name", currentEdit)); { QStringList parents; parents << ""; QList<TierCategory *> cats = dataTree->gatherCategories(); foreach(TierCategory *c, cats) { parents << c->name(); } parent = dataTree->getParentCategory(c)->name(); helper->addConfigHelper(new ConfigCombo<QString>("Parent Category", parent, parents, parents)); } helper->addConfigHelper(new ConfigSpin("Category display order", c->displayOrder, -100, 100)); internalWidget = helper->generateConfigWidget(); updateInternalWidget(); connect(helper, SIGNAL(button1()), SLOT(deleteCurrent())); connect(helper, SIGNAL(button2()), SLOT(updateCategory())); }
/*! \internal Reads the configuration out from a io device. */ void dtkLoggingPrivate::readSettings(QIODevice &device) { QMutexLocker locker(&_mutexRegisteredCategory); { _logConfigItemList.clear(); if (device.open(QIODevice::ReadOnly)) { QByteArray truearray("true"); QByteArray line; while (!device.atEnd()) { line = device.readLine().replace(" ", ""); line = line.simplified(); const QList<QByteArray> pair = line.split('='); if (pair.count() == 2) _logConfigItemList.append(dtkLogConfigFilterItem(QString::fromLatin1(pair.at(0)) , (pair.at(1).toLower() == truearray))); } } foreach (dtkLoggingCategory *category, _registeredCategories) { updateCategory(category); } _registerCategories = true; }
void PackagePropertiesDialog::onDataChanged(TransferItem *package, int role) { switch (role) { case TransferItem::CategoryRole: updateCategory(package); break; case TransferItem::CreateSubfolderRole: updateCreateSubfolder(package); break; case TransferItem::NameRole: updateName(package); break; case TransferItem::PriorityRole: updatePriority(package); break; case TransferItem::ProgressRole: case TransferItem::RowCountRole: updateProgress(package); break; case TransferItem::StatusRole: updateStatus(package); break; default: break; } }
void MainWindow::on_pushButton_clicked() { QString str; if(currentPos == 2){ CompanyDialog comDiag(this); comDiag.add(); if (comDiag.exec() == 1) { sql->addCompany(comDiag.comData(), subName); updateCompany(); } } else { Dialog diag(this); if(currentPos == 0) diag.setWindowTitle(tr("Category")); else if(currentPos == 1) diag.setWindowTitle(tr("Subcategory")); if (diag.exec() == 1) { str = diag.text(); if(currentPos == 0){ sql->addCategory(str); updateCategory(); } else if(currentPos == 1){ sql->addSubcategory(str, name); updateSubcategory(); } } } }
void MainWindow::editData() { QString str; name = listView->currentIndex().data().toString(); if(currentPos == 2){ CompanyDialog comDiag(this); comDiag.edit(); comDiag.editFlag = true; comDiag.setComData(sql->companyDataByName(name)); if (comDiag.exec() == 1) { sql->updateCompany(comDiag.comData()); updateCompany(); } } else { Dialog diag(this); if(currentPos == 0) diag.setWindowTitle(tr("Category")); else if(currentPos == 1) diag.setWindowTitle(tr("Subcategory")); diag.setText(name); if (diag.exec() == 1) { str = diag.text(); if(currentPos == 0){ sql->updateCategory(str, name); updateCategory(); } else if(currentPos == 1){ sql->updateSubcategory(str, name); updateSubcategory(); } } } }
VRShopEditorDlg::VRShopEditorDlg(QMainWindow *parent) : QMainWindow(parent) { setupUi(this); m_SceneEditor.setQVTKWidgets(m_pQVTKWidgetSceneEditorPose); m_ObjectEditor.setQVTKWidgets(m_pQVTKWidgetSceneEditorObject); setWindowTitle(tr("VR Shop Editor Dialog")); connect(actionLoadScene, SIGNAL(triggered()), this, SLOT(slotLoadScene())); connect(actionSaveScene, SIGNAL(triggered()), this, SLOT(slotSaveScene())); //Exit application connect(actionExit,SIGNAL(triggered()), this, SLOT(close())); //Calling functions updateCategory(); connect(m_pComboBoxCategoryPose, SIGNAL(highlighted(const QString &)), this, SLOT(updateProduct(const QString &))); connect(m_pComboBoxProductPose, SIGNAL(highlighted(const QString &)), this, SLOT(updateProductID(const QString &))); connect(m_pComboBoxProductCodePose, SIGNAL(highlighted(const QString &)), this, SLOT(addImage2Widget(const QString &))); updateTexture(); connect(m_pComboBoxTextureMapsName, SIGNAL(highlighted(const QString &)), this, SLOT(addTexture2Widget(const QString &))); updatePrimitive(); }
void MainWindow::posChanged() { if(currentPos == 0){ updateCategory(); } else if(currentPos == 1){ updateSubcategory(); } else if(currentPos == 2){ updateCompany(); } }
PackagePropertiesDialog::PackagePropertiesDialog(TransferItem *package, QWidget *parent) : QDialog(parent), m_package(package), m_categoryModel(new CategorySelectionModel(this)), m_priorityModel(new TransferItemPriorityModel(this)), m_scrollArea(new QScrollArea(this)), m_container(new QWidget(m_scrollArea)), m_nameLabel(new QLabel(m_container)), m_statusLabel(new QLabel(m_container)), m_subfolderCheckBox(new QCheckBox(tr("Create subfolder"), m_container)), m_categorySelector(new ValueSelector(tr("Category"), m_container)), m_prioritySelector(new ValueSelector(tr("Priority"), m_container)), m_progressBar(new QProgressBar(m_container)), m_vbox(new QVBoxLayout(m_container)), m_layout(new QHBoxLayout(this)) { setWindowTitle(tr("Package properties")); setMinimumHeight(360); m_scrollArea->setWidget(m_container); m_scrollArea->setWidgetResizable(true); m_nameLabel->setWordWrap(true); m_statusLabel->setWordWrap(true); m_categorySelector->setModel(m_categoryModel); m_prioritySelector->setModel(m_priorityModel); m_progressBar->setRange(0, 100); updateCategory(package); updateCreateSubfolder(package); updateName(package); updatePriority(package); updateProgress(package); updateStatus(package); m_vbox->addWidget(m_nameLabel); m_vbox->addWidget(m_subfolderCheckBox); m_vbox->addWidget(m_categorySelector); m_vbox->addWidget(m_prioritySelector); m_vbox->addWidget(m_progressBar); m_vbox->addWidget(m_statusLabel); m_vbox->setContentsMargins(0, 0, 0, 0); m_layout->addWidget(m_scrollArea); connect(package, SIGNAL(dataChanged(TransferItem*, int)), this, SLOT(onDataChanged(TransferItem*, int))); connect(m_subfolderCheckBox, SIGNAL(clicked(bool)), this, SLOT(setCreateSubfolder(bool))); connect(m_categorySelector, SIGNAL(valueChanged(QVariant)), this, SLOT(setCategory(QVariant))); connect(m_prioritySelector, SIGNAL(valueChanged(QVariant)), this, SLOT(setPriority(QVariant))); }
void MainWindow::search(QString text) { searchText = text; if(currentPos == 0){ updateCategory(); } else if(currentPos == 1){ updateSubcategory(); } else if(currentPos == 2){ updateCompany(); } }
void MainWindow::on_toolButton_clicked() { if (currentPos > 0){ currentPos--; searchClear(); } if (currentPos < 3) ui->catTab->layout()->addWidget(listView); if(currentPos == 0){ ui->toolButton->setHidden(true); updateCategory(); } else if (currentPos == 1){ updateSubcategory(); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setWindowTitle(tr("Title")); setWindowIcon(QIcon(":/icons/icon.png")); ui->lineEdit->setPlaceholderText(tr("Search")); ui->label->setPixmap(QPixmap(":/icons/about.jpg")); ui->label_2->setTextFormat(Qt::RichText); ui->label_2->setText("<h3>Зроблена Яремчуком Олександром</h3>"); ui->toolButton->setIcon(QPixmap(":/icons/back.png")); ui->pushButton->setIcon(QPixmap(":/icons/add.png")); ui->toolButton->setHidden(true); ui->pushButton_2->setToolTip("Відкрити файл довідки"); ui->pushButton_2->setText("Довідка"); ui->pushButton->setToolTip("Натисніть, щоб додати новий елемент"); ui->lineEdit->setToolTip("Починайте вводити слово для пошуку потрібного елемента."); QShortcut *helpShortcut = new QShortcut(QKeySequence("F1"), this); QObject::connect(helpShortcut, SIGNAL(activated()), ui->pushButton_2, SLOT(animateClick())); QShortcut *addShortcut = new QShortcut(QKeySequence("Ctrl+a"), this); QObject::connect(addShortcut, SIGNAL(activated()), ui->pushButton, SLOT(animateClick())); listView = new QListView(this); ui->catTab->layout()->addWidget(listView); listView->setContextMenuPolicy(Qt::ActionsContextMenu); connect(listView, SIGNAL(doubleClicked(QModelIndex)),this, SLOT(catalogCliked(QModelIndex))); connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(search(QString))); ui->tabWidget->setTabText(0,tr("Catalog")); ui->tabWidget->setTabText(1,tr("About")); listView->setEditTriggers(QAbstractItemView::NoEditTriggers); QAction *delAct = new QAction(tr("Delete"), this); delAct->setIcon(QIcon(":/icons/remove.svgz")); QAction *editAct = new QAction(tr("Edit"), this); editAct->setIcon(QIcon(":/icons/edit.svgz")); connect(delAct, SIGNAL(triggered()), this, SLOT(delData())); connect(editAct, SIGNAL(triggered()), this, SLOT(editData())); QShortcut *delShortcut = new QShortcut(QKeySequence("Ctrl+d"), this); QObject::connect(delShortcut, SIGNAL(activated()), this, SLOT(delData())); QShortcut *editShortcut = new QShortcut(QKeySequence("Ctrl+e"), this); QObject::connect(editShortcut, SIGNAL(activated()), this, SLOT(editData())); listView->addAction(delAct); listView->addAction(editAct); model = new QStringListModel(this); catModel = new QStringListModel(this); subModel = new QStringListModel(this); comModel = new QStringListModel(this); sql = new BaseManager(); sql->createBase(); currentPos = 0; updateCategory(); }