void VCButton::parseWidgetMenu(int item) { switch (item) { case KVCMenuEditProperties: { VCButtonProperties* p = NULL; p = new VCButtonProperties(this); p->exec(); delete p; } break; case KVCMenuEditCopy: { VCButton* bt = NULL; bt = new VCButton(parentWidget()); bt->init(); bt->copyFrom(this); bt->show(); _app->doc()->setModified(true); } break; default: break; } }
void VirtualConsole::createWidget(QPtrList <QString> &list) { QString t; for (QString* s = list.next(); s != NULL; s = list.next()) { if (*s == QString("Entry")) { s = list.prev(); break; } else if (*s == QString("Frame")) { if (m_drawArea == NULL) { m_drawArea = new VCFrame(this); m_drawArea->init(); m_drawArea->setBottomFrame(true); m_drawArea->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_layout->addWidget(m_drawArea, 1); m_drawArea->createContents(list); m_drawArea->show(); } else { VCFrame* w = new VCFrame(m_drawArea); w->init(); w->createContents(list); } } else if (*s == QString("Label")) { VCLabel* w = new VCLabel(m_drawArea); w->init(); w->createContents(list); } else if (*s == QString("Button")) { VCButton* w = new VCButton(m_drawArea); w->init(); w->createContents(list); } else if (*s == QString("Slider")) { VCDockSlider* s = new VCDockSlider(m_drawArea); s->init(); s->createContents(list); } else { // Unknown keyword, skip list.next(); } } }
void VCFrame::slotAddButton(QPoint p) { VCButton* b = new VCButton(this); assert(b); b->init(); b->show(); if (buttonBehaviour() == VCFrame::Exclusive) { b->setExclusive(true); } else { b->setExclusive(false); } b->move(p); _app->doc()->setModified(true); }
void VirtualConsole::slotAddButton() { QWidget* parent = NULL; if (m_selectedWidget && QString(m_selectedWidget->className()) == QString("VCFrame")) { parent = m_selectedWidget; } else { parent = m_drawArea; } VCButton* b = new VCButton(parent); assert(b); b->init(); b->show(); _app->doc()->setModified(true); }