void VCFrame::addFrame(QPoint at) { VCFrame* frame = new VCFrame(this); Q_ASSERT(frame != NULL); frame->show(); if (at.isNull() == false) frame->move(at); else frame->move(m_mousePressPoint); _app->virtualConsole()->setSelectedWidget(frame); _app->doc()->setModified(); }
void VirtualConsole::slotAddButtonMatrix() { VCWidget* parent(closestParent()); if (parent == NULL) return; AddVCButtonMatrix abm(this, m_doc); if (abm.exec() == QDialog::Rejected) return; int h = abm.horizontalCount(); int v = abm.verticalCount(); int sz = abm.buttonSize(); VCFrame* frame = NULL; if (abm.frameStyle() == AddVCButtonMatrix::NormalFrame) frame = new VCFrame(parent, m_doc); else frame = new VCSoloFrame(parent, m_doc); Q_ASSERT(frame != NULL); // Resize the parent frame to fit the buttons nicely and toggle resizing off frame->resize(QSize((h * sz) + 20, (v * sz) + 20)); frame->setAllowResize(false); for (int y = 0; y < v; y++) { for (int x = 0; x < h; x++) { VCButton* button = new VCButton(frame, m_doc); Q_ASSERT(button != NULL); button->move(QPoint(10 + (x * sz), 10 + (y * sz))); button->resize(QSize(sz, sz)); button->show(); int index = (y * h) + x; if (index < abm.functions().size()) { quint32 fid = abm.functions().at(index); Function* function = m_doc->function(fid); if (function != NULL) { button->setFunction(fid); button->setCaption(function->name()); } } } } // Show the frame after adding buttons to prevent flickering frame->show(); frame->move(parent->lastClickPoint()); frame->setAllowChildren(false); // Don't allow more children clearWidgetSelection(); setWidgetSelected(frame, true); m_doc->setModified(); }
void VCFrame::slotAddFrame(QPoint p) { VCFrame* f = new VCFrame(this); assert(f); f->init(); f->show(); f->move(p); _app->doc()->setModified(true); }
void VirtualConsole::slotAddFrame() { VCWidget* parent(closestParent()); if (parent == NULL) return; VCFrame* frame = new VCFrame(parent, m_doc); Q_ASSERT(frame != NULL); frame->show(); frame->move(parent->lastClickPoint()); clearWidgetSelection(); setWidgetSelected(frame, true); m_doc->setModified(); }
void VirtualConsole::slotAddSliderMatrix() { VCWidget* parent(closestParent()); if (parent == NULL) return; AddVCSliderMatrix avsm(this); if (avsm.exec() == QDialog::Rejected) return; int width = VCSlider::defaultSize.width(); int height = avsm.height(); int count = avsm.amount(); VCFrame* frame = new VCFrame(parent, m_doc); Q_ASSERT(frame != NULL); // Resize the parent frame to fit the sliders nicely frame->resize(QSize((count * width) + 20, height + 20)); frame->setAllowResize(false); for (int i = 0; i < count; i++) { VCSlider* slider = new VCSlider(frame, m_doc); Q_ASSERT(slider != NULL); slider->move(QPoint(10 + (width * i), 10)); slider->resize(QSize(width, height)); slider->show(); } // Show the frame after adding buttons to prevent flickering frame->show(); frame->move(parent->lastClickPoint()); frame->setAllowChildren(false); // Don't allow more children clearWidgetSelection(); setWidgetSelected(frame, true); m_doc->setModified(); }