void QuizGroupView::addItems (const QList<QuizNode *> &items) { QuizGroup *group = (QuizGroup *)node(); for(int i=0; i<items.count(); ++i) group->addChild(items.at(i)); fillView(); }
TaskGroupView::TaskGroupView(TaskNode *node, QWidget *parent) : TaskView(node, parent), ui(new Ui::TaskGroupView) { ui->setupUi(this); fillView(); startTimer(300); }
QuizGroupView::QuizGroupView(QuizNode *item, QWidget *parent) : QuizNodeView(item, parent), ui(new Ui::QuizGroupView) { qDebug() << "view is called"; ui->setupUi(this); qDebug() << "view is filling..."; fillView(); qDebug() << "view filled"; this->startTimer(200); }
ChooseMemoryDialog::ChooseMemoryDialog(const MemoryRegionList& memMap, const QString& title, QWidget* parent) : QDialog(parent) , m_UI(new Ui::ChooseMemoryDialog) , m_MemMap(memMap) { m_UI->setupUi(this); if (!title.isEmpty()) setWindowTitle(title); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); fillView(); m_UI->gbManual->setChecked(false); }
void QuizGroupView::on_tbtRemove_clicked() { QList<QTableWidgetItem *> items = ui->table->selectedItems(); if (items.count() > 0) { QList<int> rows; for(int i=0; i<items.count(); ++i) rows << items[i]->row(); qSort(rows); QuizGroup *group = (QuizGroup *)node(); for(int i=rows.count()-1; i>=0; --i) group->removeChildAt(rows.at(i)); ui->table->clearSelection(); fillView(); } }
void PropertyEditor::slotSorting(bool sort) { if (sort == m_sorting) return; storeExpansionState(); m_sorting = sort; collapseAll(); { UpdateBlocker ub(this); clearView(); m_treeBrowser->setRootIsDecorated(sort); fillView(); applyExpansionState(); applyFilter(); } updateActionsState(); }
void PropertyEditor::slotViewTriggered(QAction *action) { storeExpansionState(); collapseAll(); { UpdateBlocker ub(this); clearView(); int idx = 0; if (action == m_treeAction) { m_currentBrowser = m_treeBrowser; idx = m_treeIndex; } else if (action == m_buttonAction) { m_currentBrowser = m_buttonBrowser; idx = m_buttonIndex; } fillView(); m_stackedWidget->setCurrentIndex(idx); applyExpansionState(); applyFilter(); } updateActionsState(); }
void QuizGroupView::on_tbtMoveDown_clicked() { QList<QTableWidgetItem *> items = ui->table->selectedItems(); QuizGroup *group = (QuizGroup *)node(); if (items.count() > 0) { QList<int> rows; for(int i=0; i<items.count(); ++i) rows << items[i]->row(); qSort(rows); if (rows[rows.count()-1]==ui->table->rowCount()-1) return; for(int i=rows.count()-1; i>=0; --i) group->insertChildAt(rows[i]+1, group->takeChildAt(rows[i])); fillView(); ui->table->clearSelection(); for(int i=0; i<rows.count(); ++i) ui->table->item(rows[i]+1, 0)->setSelected(true); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QMenu *editMenu = menuBar()->addMenu(tr("Edit")); QMenu *newObjectMenu = editMenu->addMenu(tr("New Object")); QAction *newRectangleAction = new QAction(tr("Rectangle"), this); connect(newRectangleAction, SIGNAL(triggered(bool)), this, SLOT(newRectangle())); newObjectMenu->addAction(newRectangleAction); QAction *newLineAction = new QAction(tr("Line"), this); connect(newLineAction, SIGNAL(triggered(bool)), this, SLOT(newLine())); newObjectMenu->addAction(newLineAction); QAction *newEllipseAction = new QAction(tr("Ellipse"), this); connect(newEllipseAction, SIGNAL(triggered(bool)), this, SLOT(newEllipse())); newObjectMenu->addAction(newEllipseAction); QAction *newTextAction = new QAction(tr("Text"), this); connect(newTextAction, SIGNAL(triggered(bool)), this, SLOT(newText())); newObjectMenu->addAction(newTextAction); deleteAction = new QAction(tr("Delete Object"), this); connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteObject())); editMenu->addAction(deleteAction); QAction *clearAction = new QAction(tr("Clear All"), this); connect(clearAction, SIGNAL(triggered(bool)), this, SLOT(clearAll())); editMenu->addAction(clearAction); QAction *fillAction = new QAction(tr("Fill View"), this); connect(fillAction, SIGNAL(triggered(bool)), this, SLOT(fillView())); editMenu->addAction(fillAction); doubleManager = new QtDoublePropertyManager(this); stringManager = new QtStringPropertyManager(this); colorManager = new QtColorPropertyManager(this); fontManager = new QtFontPropertyManager(this); pointManager = new QtPointPropertyManager(this); sizeManager = new QtSizePropertyManager(this); connect(doubleManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(valueChanged(QtProperty *, double))); connect(stringManager, SIGNAL(valueChanged(QtProperty *, const QString &)), this, SLOT(valueChanged(QtProperty *, const QString &))); connect(colorManager, SIGNAL(valueChanged(QtProperty *, const QColor &)), this, SLOT(valueChanged(QtProperty *, const QColor &))); connect(fontManager, SIGNAL(valueChanged(QtProperty *, const QFont &)), this, SLOT(valueChanged(QtProperty *, const QFont &))); connect(pointManager, SIGNAL(valueChanged(QtProperty *, const QPoint &)), this, SLOT(valueChanged(QtProperty *, const QPoint &))); connect(sizeManager, SIGNAL(valueChanged(QtProperty *, const QSize &)), this, SLOT(valueChanged(QtProperty *, const QSize &))); QtDoubleSpinBoxFactory *doubleSpinBoxFactory = new QtDoubleSpinBoxFactory(this); QtCheckBoxFactory *checkBoxFactory = new QtCheckBoxFactory(this); QtSpinBoxFactory *spinBoxFactory = new QtSpinBoxFactory(this); QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this); QtEnumEditorFactory *comboBoxFactory = new QtEnumEditorFactory(this); canvas = new QtCanvas(800, 600); canvasView = new CanvasView(canvas, this); setCentralWidget(canvasView); QDockWidget *dock = new QDockWidget(this); addDockWidget(Qt::RightDockWidgetArea, dock); propertyEditor = new QtTreePropertyBrowser(dock); propertyEditor->setFactoryForManager(doubleManager, doubleSpinBoxFactory); propertyEditor->setFactoryForManager(stringManager, lineEditFactory); propertyEditor->setFactoryForManager(colorManager->subIntPropertyManager(), spinBoxFactory); propertyEditor->setFactoryForManager(fontManager->subIntPropertyManager(), spinBoxFactory); propertyEditor->setFactoryForManager(fontManager->subBoolPropertyManager(), checkBoxFactory); propertyEditor->setFactoryForManager(fontManager->subEnumPropertyManager(), comboBoxFactory); propertyEditor->setFactoryForManager(pointManager->subIntPropertyManager(), spinBoxFactory); propertyEditor->setFactoryForManager(sizeManager->subIntPropertyManager(), spinBoxFactory); dock->setWidget(propertyEditor); currentItem = 0; connect(canvasView, SIGNAL(itemClicked(QtCanvasItem *)), this, SLOT(itemClicked(QtCanvasItem *))); connect(canvasView, SIGNAL(itemMoved(QtCanvasItem *)), this, SLOT(itemMoved(QtCanvasItem *))); fillView(); itemClicked(0); }
void QuizGroupView::on_tbtAddShuffle_clicked() { dlgNewGroup dlg(false, true); if (dlg.exec()==QDialog::Accepted) ((QuizGroup *)node())->addChild(dlg.makeGroup()), fillView(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QMenu *editMenu = menuBar()->addMenu(tr("Edit")); QMenu *newObjectMenu = editMenu->addMenu(tr("New Object")); QAction *newRectangleAction = new QAction(tr("Rectangle"), this); connect(newRectangleAction, SIGNAL(triggered(bool)), this, SLOT(newRectangle())); newObjectMenu->addAction(newRectangleAction); QAction *newLineAction = new QAction(tr("Line"), this); connect(newLineAction, SIGNAL(triggered(bool)), this, SLOT(newLine())); newObjectMenu->addAction(newLineAction); QAction *newEllipseAction = new QAction(tr("Ellipse"), this); connect(newEllipseAction, SIGNAL(triggered(bool)), this, SLOT(newEllipse())); newObjectMenu->addAction(newEllipseAction); QAction *newTextAction = new QAction(tr("Text"), this); connect(newTextAction, SIGNAL(triggered(bool)), this, SLOT(newText())); newObjectMenu->addAction(newTextAction); deleteAction = new QAction(tr("Delete Object"), this); connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteObject())); editMenu->addAction(deleteAction); QAction *clearAction = new QAction(tr("Clear All"), this); connect(clearAction, SIGNAL(triggered(bool)), this, SLOT(clearAll())); editMenu->addAction(clearAction); QAction *fillAction = new QAction(tr("Fill View"), this); connect(fillAction, SIGNAL(triggered(bool)), this, SLOT(fillView())); editMenu->addAction(fillAction); variantManager = new QtVariantPropertyManager(this); connect(variantManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)), this, SLOT(valueChanged(QtProperty *, const QVariant &))); QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory(this); canvas = new QtCanvas(800, 600); canvasView = new CanvasView(canvas, this); setCentralWidget(canvasView); QDockWidget *dock = new QDockWidget(this); addDockWidget(Qt::RightDockWidgetArea, dock); propertyEditor = new QtTreePropertyBrowser(dock); propertyEditor->setFactoryForManager(variantManager, variantFactory); dock->setWidget(propertyEditor); currentItem = 0; connect(canvasView, SIGNAL(itemClicked(QtCanvasItem *)), this, SLOT(itemClicked(QtCanvasItem *))); connect(canvasView, SIGNAL(itemMoved(QtCanvasItem *)), this, SLOT(itemMoved(QtCanvasItem *))); fillView(); itemClicked(0); }