void tst_Q3ActionGroup::dropDownDeleted() { Q3MainWindow mw; Q3ToolBar *tb = new Q3ToolBar(&mw); Q3ActionGroup *actGroup = new Q3ActionGroup(&mw); actGroup->setUsesDropDown(TRUE); Q3Action *actOne = new Q3Action(actGroup); actOne->setText("test one"); Q3Action *actTwo = new Q3Action(actGroup); actTwo->setText("test two"); Q3Action *actThree= new Q3Action(actGroup); actThree->setText("test three"); actGroup->addTo(tb); QObjectList comboList = tb->queryList("QComboBox"); QCOMPARE(comboList.count(), 1); QCOMPARE((int)((QComboBox*)comboList[0])->count(), 3); delete actOne; QCOMPARE((int)((QComboBox*)comboList[0])->count(), 2); delete actTwo; QCOMPARE((int)((QComboBox*)comboList[0])->count(), 1); delete actThree; QCOMPARE((int)((QComboBox*)comboList[0])->count(), 0); delete actGroup; }
// id is an old ident in case of an import SeqDiagramWindow::SeqDiagramWindow(const QString & s, BrowserSeqDiagram * b, int id) : DiagramWindow(b, s), view(0) { Q3ToolBar * toolbar = new Q3ToolBar(this, "sequence diagram operations"); addToolBar(toolbar, TR("Toolbar"), Qt::DockTop, TRUE); add_edit_button(toolbar); select = new QToolButton(*selectButton, TR("Select"), QString(), this, SLOT(hit_select()), toolbar, "select"); select->setToggleButton(TRUE); select->setOn(TRUE); current_button = UmlSelect; addFragment = new QToolButton(*fragmentButton, TR("Add Fragment"), QString(), this, SLOT(hit_fragment()), toolbar, "add fragment"); addFragment->setToggleButton(TRUE); Q3WhatsThis::add(addFragment, addfragmentText()); addClassInstance = new QToolButton(*classinstanceButton, TR("Add modeled Class instance"), QString(), this, SLOT(hit_classinstance()), toolbar, "add modeled class instance"); addClassInstance->setToggleButton(TRUE); Q3WhatsThis::add(addClassInstance, addmodeledclassinstanceText()); addClass = new QToolButton(*classButton, TR("Add Class instance"), QString(), this, SLOT(hit_class()), toolbar, "add class"); addClass->setToggleButton(TRUE); Q3WhatsThis::add(addClass, addclassinstanceText()); addContinuation = new QToolButton(*continuationButton, TR("Add Continuation"), QString(), this, SLOT(hit_continuation()), toolbar, "add continuation"); addContinuation->setToggleButton(TRUE); Q3WhatsThis::add(addContinuation, addcontinuationText()); syncMsg = new QToolButton(*syncmsgButton, TR("Synchronous message"), QString(), this, SLOT(hit_syncmsg()), toolbar, "synchronous message"); syncMsg->setToggleButton(TRUE); Q3WhatsThis::add(syncMsg, syncmsgText()); asyncMsg = new QToolButton(*directionalAssociationButton, TR("Asynchronous message"), QString(), this, SLOT(hit_asyncmsg()), toolbar, "asynchronous message"); asyncMsg->setToggleButton(TRUE); Q3WhatsThis::add(asyncMsg, asyncmsgText()); syncSelfMsg = new QToolButton(*syncselfmsgButton, TR("Synchronous Reflexive message"), QString(), this, SLOT(hit_syncselfmsg()), toolbar, "synchronous reflexive message"); syncSelfMsg->setToggleButton(TRUE); Q3WhatsThis::add(syncSelfMsg, syncselfmsgText()); asyncSelfMsg = new QToolButton(*asyncselfmsgButton, TR("Asynchronous Reflexive message"), QString(), this, SLOT(hit_asyncselfmsg()), toolbar, "asynchronous reflexive message"); asyncSelfMsg->setToggleButton(TRUE); Q3WhatsThis::add(asyncSelfMsg, asyncselfmsgText()); foundsyncMsg = new QToolButton(*foundsyncmsgButton, TR("Synchronous found message"), QString(), this, SLOT(hit_foundsyncmsg()), toolbar, "synchronous found message"); foundsyncMsg->setToggleButton(TRUE); Q3WhatsThis::add(foundsyncMsg, foundsyncmsgText()); foundasyncMsg = new QToolButton(*foundasyncmsgButton, TR("Asynchronous found message"), QString(), this, SLOT(hit_foundasyncmsg()), toolbar, "asynchronous found message"); foundasyncMsg->setToggleButton(TRUE); Q3WhatsThis::add(foundasyncMsg, foundasyncmsgText()); lostsyncMsg = new QToolButton(*lostsyncmsgButton, TR("Synchronous lost message"), QString(), this, SLOT(hit_lostsyncmsg()), toolbar, "synchronous lost message"); lostsyncMsg->setToggleButton(TRUE); Q3WhatsThis::add(lostsyncMsg, lostsyncmsgText()); lostasyncMsg = new QToolButton(*lostasyncmsgButton, TR("Asynchronous lost message"), QString(), this, SLOT(hit_lostasyncmsg()), toolbar, "asynchronous lost message"); lostasyncMsg->setToggleButton(TRUE); Q3WhatsThis::add(lostasyncMsg, lostasyncmsgText()); returnMsg = new QToolButton(*returnmsgButton, TR("Explicit return"), QString(), this, SLOT(hit_returnmsg()), toolbar, "explicit return"); returnMsg->setToggleButton(TRUE); Q3WhatsThis::add(returnMsg, returnmsgText()); selfreturnMsg = new QToolButton(*selfreturnmsgButton, TR("Explicit reflexive return"), QString(), this, SLOT(hit_selfreturnmsg()), toolbar, "explicit reflexive return"); selfreturnMsg->setToggleButton(TRUE); Q3WhatsThis::add(selfreturnMsg, selfreturnmsgText()); note = new QToolButton(*noteButton, TR("Note"), QString(), this, SLOT(hit_note()), toolbar, "note"); note->setToggleButton(TRUE); Q3WhatsThis::add(note, noteText()); anchor = new QToolButton(*anchorButton, TR("Anchor"), QString(), this, SLOT(hit_anchor()), toolbar, "anchor"); anchor->setToggleButton(TRUE); Q3WhatsThis::add(anchor, anchorText()); text = new QToolButton(*textButton, TR("Text"), QString(), this, SLOT(hit_text()), toolbar, "text"); text->setToggleButton(TRUE); Q3WhatsThis::add(text, textText()); image = new QToolButton(*imageButton, TR("Image"), QString(), this, SLOT(hit_image()), toolbar, "image"); image->setToggleButton(TRUE); Q3WhatsThis::add(image, imageText()); toolbar->addSeparator(); add_scale_cmd(toolbar); // view = new SeqDiagramView(this, canvas, (id != -1) ? id : b->get_ident()); setFocusProxy(view); setCentralWidget(view); //qApp->setMainWidget(this); QWorkspace * w = UmlWindow::get_workspace(); resize((w->width() * 4) / 5, (w->height() * 4) / 5); /*if (w->windowList().isEmpty()) showMaximized(); else*/ show(); view->preferred_size_zoom(); //qApp->setMainWidget(0); }
// id is an old ident in case of an import ClassDiagramWindow::ClassDiagramWindow(const QString & s, BrowserClassDiagram * b, int id) : DiagramWindow(b, s), view(0) { Q3ToolBar * toolbar = new Q3ToolBar(this, "class diagram operations"); addToolBar(toolbar, TR("Toolbar"), Qt::DockTop, TRUE); add_edit_button(toolbar); toolbar->addSeparator(); select = new QToolButton(*selectButton, TR("Select"), QString::null, this, SLOT(hit_select()), toolbar, "select"); select->setToggleButton(TRUE); select->setOn(TRUE); current_button = UmlSelect; addClass = new QToolButton(*classButton, TR("Add Class"), QString::null, this, SLOT(hit_class()), toolbar, "add class"); addClass->setToggleButton(TRUE); Q3WhatsThis::add(addClass, addclassText()); addPackage = new QToolButton(*packageButton, TR("Add Package"), QString::null, this, SLOT(hit_package()), toolbar, "add package"); addPackage->setToggleButton(TRUE); Q3WhatsThis::add(addPackage, addpackageText()); addFragment = new QToolButton(*fragmentButton, TR("Add Fragment"), QString::null, this, SLOT(hit_fragment()), toolbar, "add fragment"); addFragment->setToggleButton(TRUE); Q3WhatsThis::add(addFragment, addfragmentText()); inherit = new QToolButton(*generalisationButton, TR("Generalisation"), QString::null, this, SLOT(hit_inherit()), toolbar, "generalisation"); inherit->setToggleButton(TRUE); Q3WhatsThis::add(inherit, inheritText()); realize = new QToolButton(*realizeButton, TR("Realize"), QString::null, this, SLOT(hit_realize()), toolbar, "realize"); realize->setToggleButton(TRUE); Q3WhatsThis::add(realize, realizeText()); dependency = new QToolButton(*dependencyButton, TR("Dependency"), QString::null, this, SLOT(hit_dependency()), toolbar, "dependency"); dependency->setToggleButton(TRUE); Q3WhatsThis::add(dependency, dependencyText()); association = new QToolButton(*associationButton, TR("Association"), QString::null, this, SLOT(hit_association()), toolbar, "association"); association->setToggleButton(TRUE); Q3WhatsThis::add(association, associationText()); directionalassociation = new QToolButton(*directionalAssociationExtensionButton, TR("Directional Association / Extension"), QString::null, this, SLOT(hit_directionalassociation()), toolbar, "directional association"); directionalassociation->setToggleButton(TRUE); Q3WhatsThis::add(directionalassociation, directionalassociationextensionText()); aggregation = new QToolButton(*aggregationButton, TR("Aggregation"), QString::null, this, SLOT(hit_aggregation()), toolbar, "aggregation"); aggregation->setToggleButton(TRUE); Q3WhatsThis::add(aggregation, aggregationText()); aggregationbyvalue = new QToolButton(*aggregationByValueButton, TR("Composition"), QString::null, this, SLOT(hit_aggregationbyvalue()), toolbar, "composition"); aggregationbyvalue->setToggleButton(TRUE); Q3WhatsThis::add(aggregationbyvalue, aggregationbyvalueText()); directionalaggregation = new QToolButton(*directionalAggregationButton, TR("Directional Aggregation"), QString::null, this, SLOT(hit_directionalaggregation()), toolbar, "directional aggregation"); directionalaggregation->setToggleButton(TRUE); Q3WhatsThis::add(directionalaggregation, directionalaggregationText()); directionalaggregationbyvalue = new QToolButton(*directionalAggregationByValueButton, TR("Directional Composition"), QString::null, this, SLOT(hit_directionalaggregationbyvalue()), toolbar, "directional composition"); directionalaggregationbyvalue->setToggleButton(TRUE); Q3WhatsThis::add(directionalaggregationbyvalue, directionalaggregationbyvalueText()); note = new QToolButton(*noteButton, TR("Note"), QString::null, this, SLOT(hit_note()), toolbar, "note"); note->setToggleButton(TRUE); Q3WhatsThis::add(note, noteText()); anchor = new QToolButton(*anchorButton, TR("Anchor / Class association"), QString::null, this, SLOT(hit_anchor()), toolbar, "anchor"); anchor->setToggleButton(TRUE); Q3WhatsThis::add(anchor, anchorText()); text = new QToolButton(*textButton, TR("Text"), QString::null, this, SLOT(hit_text()), toolbar, "text"); text->setToggleButton(TRUE); Q3WhatsThis::add(text, textText()); image = new QToolButton(*imageButton, TR("Image"), QString::null, this, SLOT(hit_image()), toolbar, "image"); image->setToggleButton(TRUE); Q3WhatsThis::add(image, imageText()); toolbar->addSeparator(); add_grid_cmd(toolbar); toolbar->addSeparator(); add_scale_cmd(toolbar); // view = new ClassDiagramView(this, canvas, (id != -1) ? id : b->get_ident()); setFocusProxy(view); setCentralWidget(view); //qApp->setMainWidget(this); QWorkspace * w = UmlWindow::get_workspace(); resize((w->width() * 4)/5, (w->height() * 4)/5); /*if (w->windowList().isEmpty()) showMaximized(); else*/ show(); view->preferred_size_zoom(); //qApp->setMainWidget(0); }
// id is an old ident in case of an import DeploymentDiagramWindow::DeploymentDiagramWindow(const QString & s, BrowserDeploymentDiagram * b, int id) : DiagramWindow(b, s), view(0) { Q3ToolBar * toolbar = new Q3ToolBar(this, "deployment operations"); addToolBar(toolbar, TR("Toolbar"), Qt::DockTop, TRUE); add_edit_button(toolbar); toolbar->addSeparator(); select = new QToolButton(*selectButton, TR("Select"), QString::null, this, SLOT(hit_select()), toolbar, "select"); select->setToggleButton(TRUE); select->setOn(TRUE); current_button = UmlSelect; addPackage = new QToolButton(*packageButton, TR("Add Package"), QString::null, this, SLOT(hit_package()), toolbar, "add package"); addPackage->setToggleButton(TRUE); Q3WhatsThis::add(addPackage, addpackageText()); addFragment = new QToolButton(*fragmentButton, TR("Add Fragment"), QString::null, this, SLOT(hit_fragment()), toolbar, "add fragment"); addFragment->setToggleButton(TRUE); Q3WhatsThis::add(addFragment, addfragmentText()); addDeploymentNode = new QToolButton(*deploymentNodeButton, TR("Add Deployment Node"), QString::null, this, SLOT(hit_deploymentnode()), toolbar, "add deployment node"); addDeploymentNode->setToggleButton(TRUE); Q3WhatsThis::add(addDeploymentNode, adddeploymentnodeText()); addArtifact = new QToolButton(*artifactButton, TR("Add Artifact"), QString::null, this, SLOT(hit_artifact()), toolbar, "add artifact"); addArtifact->setToggleButton(TRUE); Q3WhatsThis::add(addArtifact, addartifactText()); addComponent = new QToolButton(*componentButton, TR("Add Component"), QString::null, this, SLOT(hit_component()), toolbar, "add component"); addComponent->setToggleButton(TRUE); Q3WhatsThis::add(addComponent, addcomponentText()); hub = new QToolButton(*hubButton, TR("Network connexion/ending"), QString::null, this, SLOT(hit_hub()), toolbar, "network connexion/ending"); hub->setToggleButton(TRUE); Q3WhatsThis::add(hub, hubText()); network = new QToolButton(*associationButton, TR("Network"), QString::null, this, SLOT(hit_network()), toolbar, "network"); network->setToggleButton(TRUE); Q3WhatsThis::add(network, networkText()); inherit = new QToolButton(*generalisationButton, TR("Inheritance"), QString::null, this, SLOT(hit_inherit()), toolbar, "inheritance"); inherit->setToggleButton(TRUE); Q3WhatsThis::add(inherit, inheritText()); association = new QToolButton(*directionalAssociationButton, TR("Association"), QString::null, this, SLOT(hit_association()), toolbar, "association"); association->setToggleButton(TRUE); Q3WhatsThis::add(association, associationText()); dependency = new QToolButton(*dependencyButton, TR("Dependency"), QString::null, this, SLOT(hit_dependency()), toolbar, "dependency"); dependency->setToggleButton(TRUE); Q3WhatsThis::add(dependency, dependencyText()); note = new QToolButton(*noteButton, TR("Note"), QString::null, this, SLOT(hit_note()), toolbar, "note"); note->setToggleButton(TRUE); Q3WhatsThis::add(note, noteText()); anchor = new QToolButton(*anchorButton, TR("Anchor"), QString::null, this, SLOT(hit_anchor()), toolbar, "anchor"); anchor->setToggleButton(TRUE); Q3WhatsThis::add(anchor, anchorText()); text = new QToolButton(*textButton, TR("Text"), QString::null, this, SLOT(hit_text()), toolbar, "text"); text->setToggleButton(TRUE); Q3WhatsThis::add(text, textText()); image = new QToolButton(*imageButton, TR("Image"), QString::null, this, SLOT(hit_image()), toolbar, "image"); image->setToggleButton(TRUE); Q3WhatsThis::add(image, imageText()); toolbar->addSeparator(); add_grid_cmd(toolbar); toolbar->addSeparator(); add_scale_cmd(toolbar); // view = new DeploymentDiagramView(this, canvas, (id != -1) ? id : b->get_ident()); setFocusProxy(view); setCentralWidget(view); //qApp->setMainWidget(this); QWorkspace * w = UmlWindow::get_workspace(); resize((w->width() * 4)/5, (w->height() * 4)/5); /*if (w->windowList().isEmpty()) showMaximized(); else*/ show(); view->preferred_size_zoom(); //qApp->setMainWidget(0); }
// id is an old ident in case of an import StateDiagramWindow::StateDiagramWindow(const QString & s, BrowserStateDiagram * b, int id) : DiagramWindow(b, s), view(0) { Q3ToolBar * toolbar = new Q3ToolBar(this, "state operations"); addToolBar(toolbar, TR("Toolbar"), Qt::DockTop, TRUE); add_edit_button(toolbar); toolbar->addSeparator(); select = new QToolButton(*selectButton, TR("Select"), QString::null, this, SLOT(hit_select()), toolbar, "select"); select->setToggleButton(TRUE); select->setOn(TRUE); current_button = UmlSelect; addPackage = new QToolButton(*packageButton, TR("Add Package"), QString::null, this, SLOT(hit_package()), toolbar, "add package"); addPackage->setToggleButton(TRUE); Q3WhatsThis::add(addPackage, addpackageText()); addFragment = new QToolButton(*fragmentButton, TR("Add Fragment"), QString::null, this, SLOT(hit_fragment()), toolbar, "add fragment"); addFragment->setToggleButton(TRUE); Q3WhatsThis::add(addFragment, addfragmentText()); addState = new QToolButton(*stateButton, TR("Add State"), QString::null, this, SLOT(hit_state()), toolbar, "add state"); addState->setToggleButton(TRUE); Q3WhatsThis::add(addState, addstateText()); addRegion = new QToolButton(*regionButton, TR("Add Region"), QString::null, this, SLOT(hit_region()), toolbar, "add region"); addRegion->setToggleButton(TRUE); Q3WhatsThis::add(addRegion, addregionText()); addInitial = new QToolButton(*initialButton, TR("Add Initial pseudo state"), QString::null, this, SLOT(hit_initial()), toolbar, "add initial"); addInitial->setToggleButton(TRUE); Q3WhatsThis::add(addInitial, addinitialText()); addEntryPoint = new QToolButton(*entrypointButton, TR("Add Entry Point"), QString::null, this, SLOT(hit_entryPoint()), toolbar, "add entry point"); addEntryPoint->setToggleButton(TRUE); Q3WhatsThis::add(addEntryPoint, addentrypointText()); addFinal = new QToolButton(*finalButton, TR("Add Final state"), QString::null, this, SLOT(hit_final()), toolbar, "add final"); addFinal->setToggleButton(TRUE); Q3WhatsThis::add(addFinal, addfinalText()); addExitPoint = new QToolButton(*exitpointButton, TR("Add Exit Point"), QString::null, this, SLOT(hit_exitPoint()), toolbar, "add exit point"); addExitPoint->setToggleButton(TRUE); Q3WhatsThis::add(addExitPoint, addexitpointText()); addTerminate = new QToolButton(*terminateButton, TR("Add Terminate node"), QString::null, this, SLOT(hit_terminate()), toolbar, "add terminate"); addTerminate->setToggleButton(TRUE); Q3WhatsThis::add(addTerminate, addterminateText()); addDeepHistory = new QToolButton(*deephistoryButton, TR("Add Deep History"), QString::null, this, SLOT(hit_deepHistory()), toolbar, "add deep history"); addDeepHistory->setToggleButton(TRUE); Q3WhatsThis::add(addDeepHistory, adddeephistoryText()); addShallowHistory = new QToolButton(*shallowhistoryButton, TR("Add Shallow History"), QString::null, this, SLOT(hit_shallowHistory()), toolbar, "add shallow history"); addShallowHistory->setToggleButton(TRUE); Q3WhatsThis::add(addShallowHistory, addshallowhistoryText()); addJunction = new QToolButton(*junctionButton, TR("Add Junction"), QString::null, this, SLOT(hit_junction()), toolbar, "add junction"); addJunction->setToggleButton(TRUE); Q3WhatsThis::add(addJunction, addjunctionText()); addChoice = new QToolButton(*choiceButton, TR("Add Choice"), QString::null, this, SLOT(hit_choice()), toolbar, "add choice"); addChoice->setToggleButton(TRUE); Q3WhatsThis::add(addChoice, addchoiceText()); addFork = new QToolButton(*forkButton, TR("Add Fork"), QString::null, this, SLOT(hit_fork()), toolbar, "add fork"); addFork->setToggleButton(TRUE); Q3WhatsThis::add(addFork, addforkText()); addJoin = new QToolButton(*joinButton, TR("Add Join"), QString::null, this, SLOT(hit_join()), toolbar, "add join"); addJoin->setToggleButton(TRUE); Q3WhatsThis::add(addJoin, addjoinText()); addAction = new QToolButton(*actionButton, TR("Add Action"), QString::null, this, SLOT(hit_action()), toolbar, "add action"); addAction->setToggleButton(TRUE); Q3WhatsThis::add(addAction, addactionText()); addSignalIn = new QToolButton(*signalinButton, TR("Add receive signal action"), QString::null, this, SLOT(hit_signalin()), toolbar, "add receive signal action"); addSignalIn->setToggleButton(TRUE); Q3WhatsThis::add(addSignalIn, addsignalinText()); addSignalOut = new QToolButton(*signaloutButton, TR("Add send signal action"), QString::null, this, SLOT(hit_signalout()), toolbar, "add send signal action"); addSignalOut->setToggleButton(TRUE); Q3WhatsThis::add(addSignalOut, addsignaloutText()); addTransition = new QToolButton(*directionalAssociationButton, TR("Add Transition"), QString::null, this, SLOT(hit_transition()), toolbar, "add transition"); addTransition->setToggleButton(TRUE); Q3WhatsThis::add(addTransition, addtransitionText()); /* dependency = new QToolButton(*dependencyButton, "Dependency", QString::null, this, SLOT(hit_dependency()), toolbar, "dependency"); dependency->setToggleButton(TRUE); QWhatsThis::add(dependency, dependencyText()); */ note = new QToolButton(*noteButton, TR("Note"), QString::null, this, SLOT(hit_note()), toolbar, "note"); note->setToggleButton(TRUE); Q3WhatsThis::add(note, noteText()); anchor = new QToolButton(*anchorButton, TR("Anchor"), QString::null, this, SLOT(hit_anchor()), toolbar, "anchor"); anchor->setToggleButton(TRUE); Q3WhatsThis::add(anchor, anchorText()); text = new QToolButton(*textButton, TR("Text"), QString::null, this, SLOT(hit_text()), toolbar, "text"); text->setToggleButton(TRUE); Q3WhatsThis::add(text, textText()); image = new QToolButton(*imageButton, TR("Image"), QString::null, this, SLOT(hit_image()), toolbar, "image"); image->setToggleButton(TRUE); Q3WhatsThis::add(image, imageText()); toolbar->addSeparator(); add_grid_cmd(toolbar); toolbar->addSeparator(); add_scale_cmd(toolbar); // view = new StateDiagramView(this, canvas, (id != -1) ? id : b->get_ident()); setFocusProxy(view); setCentralWidget(view); //qApp->setMainWidget(this); QWorkspace * w = UmlWindow::get_workspace(); resize((w->width() * 4)/5, (w->height() * 4)/5); /*if (w->windowList().isEmpty()) showMaximized(); else*/ show(); view->preferred_size_zoom(); //qApp->setMainWidget(0); }
ApplicationWindow::ApplicationWindow() : Q3MainWindow( 0, "example application main window", Qt::WDestructiveClose ) { // create a printer printer = new QPrinter; // create user interface actions Q3Action *fileNewAction = new Q3Action( "New", "&New", Qt::CTRL+Qt::Key_N, this, "new" ); connect( fileNewAction, SIGNAL( activated() ) , this, SLOT( newDoc() ) ); Q3Action *fileOpenAction = new Q3Action( "Open File", QPixmap( fileopen ), "&Open", Qt::CTRL+Qt::Key_O, this, "open" ); connect( fileOpenAction, SIGNAL( activated() ) , this, SLOT( load() ) ); Q3MimeSourceFactory::defaultFactory()->setPixmap( "fileopen", QPixmap( fileopen ) ); fileOpenAction->setWhatsThis( fileOpenText ); Q3Action *fileSaveAction = new Q3Action( "Save File", QPixmap( filesave ), "&Save", Qt::CTRL+Qt::Key_S, this, "save" ); connect( fileSaveAction, SIGNAL( activated() ) , this, SLOT( save() ) ); fileSaveAction->setWhatsThis( fileSaveText ); Q3Action *fileSaveAsAction = new Q3Action( "Save File As", "Save &as", 0, this, "save as" ); connect( fileSaveAsAction, SIGNAL( activated() ) , this, SLOT( saveAs() ) ); fileSaveAsAction->setWhatsThis( fileSaveText ); Q3Action *filePrintAction = new Q3Action( "Print File", QPixmap( fileprint ), "&Print", Qt::CTRL+Qt::Key_P, this, "print" ); connect( filePrintAction, SIGNAL( activated() ) , this, SLOT( print() ) ); filePrintAction->setWhatsThis( filePrintText ); Q3Action *fileCloseAction = new Q3Action( "Close", "&Close", Qt::CTRL+Qt::Key_W, this, "close" ); connect( fileCloseAction, SIGNAL( activated() ) , this, SLOT( close() ) ); Q3Action *fileQuitAction = new Q3Action( "Quit", "&Quit", Qt::CTRL+Qt::Key_Q, this, "quit" ); connect( fileQuitAction, SIGNAL( activated() ) , qApp, SLOT( quit() ) ); // create button for histo handling Q3Action *Update_histo = new Q3Action("Update Histo",QPixmap("qtbuttonsupdate.xpm"),"&Update", Qt::CTRL+Qt::Key_0, this, "update"); connect( Update_histo, SIGNAL( activated() ) , this, SLOT( execute() ) ); Q3MimeSourceFactory::defaultFactory()->setPixmap( "update", QPixmap("qtbuttonsupdate.xpm" ) ); Update_histo->setWhatsThis( updateHisto ); Q3Action *clear_histo = new Q3Action("Clear Histo",QPixmap("qtbuttonsclear.xpm"),"&Clear", Qt::CTRL+Qt::Key_0, this, "clear"); connect( clear_histo, SIGNAL( activated() ) , this, SLOT( clear_histo() ) ); Q3MimeSourceFactory::defaultFactory()->setPixmap( "clear", QPixmap("qtbuttonsclear.xpm" ) ); clear_histo->setWhatsThis( clearHisto ); // populate a tool bar with some actions Q3ToolBar* fileTools = new Q3ToolBar( this, "file operations" ); fileTools->setLabel( tr( "File Operations" ) ); fileOpenAction->addTo( fileTools ); fileSaveAction->addTo( fileTools ); filePrintAction->addTo( fileTools ); Update_histo->addTo ( fileTools ); clear_histo->addTo ( fileTools ); (void)Q3WhatsThis::whatsThisButton( fileTools ); // popuplate a menu with all actions Q3PopupMenu * file = new Q3PopupMenu( this ); menuBar()->insertItem( "&File", file ); fileNewAction->addTo( file ); fileOpenAction->addTo( file ); fileSaveAction->addTo( file ); fileSaveAsAction->addTo( file ); file->insertSeparator(); filePrintAction->addTo( file ); file->insertSeparator(); fileCloseAction->addTo( file ); fileQuitAction->addTo( file ); // add a help menu Q3PopupMenu * help = new Q3PopupMenu( this ); menuBar()->insertSeparator(); menuBar()->insertItem( "&Help", help ); help->insertItem( "&About", this, SLOT(about()), Qt::Key_F1 ); help->insertItem( "About &Qt", this, SLOT(aboutQt()) ); help->insertSeparator(); help->insertItem( "What's &This", this, SLOT(whatsThis()), Qt::SHIFT+Qt::Key_F1 ); // create and define the ROOT Canvas central widget tab = new QTabWidget(this); tab->show(); setCentralWidget( tab ); Q3MainWindow *win1 = new Q3MainWindow( 0, "tab1 main window", Qt::WDestructiveClose ); Q3MainWindow *win2 = new Q3MainWindow( 0, "tab2 main window", Qt::WDestructiveClose ); aCanvas = new TQRootCanvas(this, win1,"Qt&Root"); aCanvas2 = new TQRootCanvas(this, win2,"Qt&Root"); win1->setCentralWidget(aCanvas); win2->setCentralWidget(aCanvas2); tab->addTab(win1,"page1"); tab->addTab(win2,"page2"); win1->show(); win2->show(); // with no QTabWidget // aCanvas = new TQRootCanvas(this,"Qt&Root"); // setCentralWidget( aCanvas ); resize( 450, 500 ); // put here some ROOT Specifics ... if (aCanvas->GetCanvas()) { aCanvas->GetCanvas()->Resize(); aCanvas->GetCanvas()->SetFillColor(40); aCanvas->GetCanvas()->cd(); pad1 = new TPad("pad1","The pad with the function",0.05,0.50,0.95,0.95,21); pad1->Draw(); pad1->cd(); pad1->SetGridx(); pad1->SetGridy(); pad1->GetFrame()->SetFillColor(42); pad1->GetFrame()->SetBorderMode(-1); pad1->GetFrame()->SetBorderSize(5); histo= new TH1F("hppx","Gaussian distribution",100,-4,4); histo->SetFillColor(0); histo->Draw(); aCanvas->GetCanvas()->cd(); pad2 = new TPad("pad2","The pad with the histogram",0.05,0.05,0.95,0.45,21); pad2->Draw(); pad2->cd(); form1 = new TFormula("form1","abs(sin(x)/x)"); sqroot = new TF1("sqroot","x*gaus(0) + [3]*form1",0,10); sqroot->SetParameters(10,4,1,20); sqroot->SetLineColor(4); sqroot->SetLineWidth(6); sqroot->Draw(); } // ! aCAnvas if (aCanvas2) { TCanvas *c1 = aCanvas2->GetCanvas(); c1->Resize(); c1->SetFillColor(42); c1->GetFrame()->SetFillColor(21); c1->GetFrame()->SetBorderSize(12); c1->cd(); //graph example const Int_t n = 20; Double_t x[n], y[n]; for (Int_t i=0;i<n;i++) { x[i] = i*0.1; y[i] = 10*TMath::Sin(x[i]+0.2); // printf(" i %i %f %f \n",i,x[i],y[i]); } TGraph* gr = new TGraph(n,x,y); gr->SetLineColor(2); gr->SetLineWidth(4); gr->SetMarkerColor(4); gr->SetMarkerStyle(21); gr->SetTitle("a simple graph"); gr->Draw("ACP"); gr->GetHistogram()->SetXTitle("X title"); gr->GetHistogram()->SetYTitle("Y title"); c1->Modified(); c1->Update(); } //!aCanvas2 }
// id is an old ident in case of an import ColDiagramWindow::ColDiagramWindow(const QString & s, BrowserColDiagram * b, int id) : DiagramWindow(b, s), view(0) { Q3ToolBar * toolbar = new Q3ToolBar(this, "communication diagram operations"); addToolBar(toolbar, TR("Toolbar"), Qt::DockTop, TRUE); add_edit_button(toolbar); toolbar->addSeparator(); select = new QToolButton(*selectButton, TR("Select"), QString::null, this, SLOT(hit_select()), toolbar, "select"); select->setToggleButton(TRUE); select->setOn(TRUE); current_button = UmlSelect; addPackage = new QToolButton(*packageButton, TR("Add Package"), QString::null, this, SLOT(hit_package()), toolbar, "add package"); addPackage->setToggleButton(TRUE); Q3WhatsThis::add(addPackage, addpackageText()); addFragment = new QToolButton(*fragmentButton, TR("Add Fragment"), QString::null, this, SLOT(hit_fragment()), toolbar, "add fragment"); addFragment->setToggleButton(TRUE); Q3WhatsThis::add(addFragment, addfragmentText()); addClassInstance = new QToolButton(*classinstanceButton, TR("Add modeled Class instance"), QString::null, this, SLOT(hit_classinstance()), toolbar, "add modeled class instance"); addClassInstance->setToggleButton(TRUE); Q3WhatsThis::add(addClassInstance, addmodeledclassinstanceText()); addClass = new QToolButton(*classButton, TR("Add Class instance"), QString::null, this, SLOT(hit_class()), toolbar, "add class instance"); addClass->setToggleButton(TRUE); Q3WhatsThis::add(addClass, addclassinstanceText()); addLink = new QToolButton(*associationButton, TR("Add Link"), QString::null, this, SLOT(hit_link()), toolbar, "add link"); addLink->setToggleButton(TRUE); Q3WhatsThis::add(addLink, linkText()); addSelfLink = new QToolButton(*selflinkButton, TR("Add Self Link"), QString::null, this, SLOT(hit_selflink()), toolbar, "add self link"); addSelfLink->setToggleButton(TRUE); Q3WhatsThis::add(addSelfLink, selflinkText()); note = new QToolButton(*noteButton, TR("Note"), QString::null, this, SLOT(hit_note()), toolbar, "note"); note->setToggleButton(TRUE); Q3WhatsThis::add(note, noteText()); anchor = new QToolButton(*anchorButton, TR("Anchor"), QString::null, this, SLOT(hit_anchor()), toolbar, "anchor"); anchor->setToggleButton(TRUE); Q3WhatsThis::add(anchor, anchorText()); text = new QToolButton(*textButton, TR("Text"), QString::null, this, SLOT(hit_text()), toolbar, "text"); text->setToggleButton(TRUE); Q3WhatsThis::add(text, textText()); image = new QToolButton(*imageButton, TR("Image"), QString::null, this, SLOT(hit_image()), toolbar, "image"); image->setToggleButton(TRUE); Q3WhatsThis::add(image, imageText()); toolbar->addSeparator(); add_grid_cmd(toolbar); toolbar->addSeparator(); add_scale_cmd(toolbar); // view = new ColDiagramView(this, canvas, (id != -1) ? id : b->get_ident()); setFocusProxy(view); setCentralWidget(view); //qApp->setMainWidget(this); QWorkspace * w = UmlWindow::get_workspace(); resize((w->width() * 4)/5, (w->height() * 4)/5); /*if (w->windowList().isEmpty()) showMaximized(); else*/ show(); view->preferred_size_zoom(); //qApp->setMainWidget(0); }
HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name) : Q3MainWindow( parent, name, Qt::WDestructiveClose ), pathCombo( 0 ), selectedURL() { DigitDebug::ctor(QString("helpwindow " + QString::number((ulong) this, 16))); readHistory(); readBookmarks(); browser = new Q3TextBrowser( this ); CHECK_PTR_ENGAUGE(browser); browser->mimeSourceFactory()->setFilePath( _path ); browser->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken ); connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); setCentralWidget( browser ); if ( !home_.isEmpty() ) browser->setSource( home_ ); connect( browser, SIGNAL( highlighted( const QString&) ), statusBar(), SLOT( message( const QString&)) ); // display help window in previous position with same size DefaultSettings& rSettings = DefaultSettings::instance(); move(rSettings.getWindowHelpPosition()); resize(rSettings.getWindowHelpSize()); QMenu* file = new QMenu( this ); CHECK_PTR_ENGAUGE(file); file->insertItem( tr("&Open File"), this, SLOT( openFile() ), Qt::CTRL+Qt::Key_O ); file->insertItem( tr("&Print"), this, SLOT( print() ), Qt::CTRL+Qt::Key_P ); file->insertSeparator(); file->insertItem( tr("&Close"), this, SLOT( close() ), Qt::CTRL+Qt::Key_Q ); //file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), Qt::CTRL+Qt::Key_X ); // The same three icons are used twice each. QPixmap helpback (helpback_xpm); QPixmap helpforward (helpforward_xpm); QPixmap helphome (helphome_xpm); QIcon icon_back (helpback); QIcon icon_forward (helpforward); QIcon icon_home (helphome); QMenu* go = new QMenu( this ); CHECK_PTR_ENGAUGE(go); backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), Qt::CTRL+Qt::Key_Left ); forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), Qt::CTRL+Qt::Key_Right ); go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); hist = new QMenu( this ); CHECK_PTR_ENGAUGE(hist); QStringList::Iterator it = history.begin(); for ( ; it != history.end(); ++it ) mHistory[ hist->insertItem( *it ) ] = *it; connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); bookm = new QMenu( this ); CHECK_PTR_ENGAUGE(bookm); bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); bookm->insertSeparator(); QStringList::Iterator it2 = bookmarks.begin(); for ( ; it2 != bookmarks.end(); ++it2 ) mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; connect( bookm, SIGNAL( activated( int ) ), this, SLOT( bookmChosen( int ) ) ); menuBar()->insertItem( tr("&File"), file ); menuBar()->insertItem( tr("&Go"), go ); menuBar()->insertItem( tr( "History" ), hist ); menuBar()->insertItem( tr( "Bookmarks" ), bookm ); menuBar()->setItemEnabled( forwardId, FALSE); menuBar()->setItemEnabled( backwardId, FALSE); connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); Q3ToolBar* toolbar = new Q3ToolBar( this ); CHECK_PTR_ENGAUGE(toolbar); addToolBar( toolbar, "Toolbar"); QToolButton* button; button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); CHECK_PTR_ENGAUGE(button); connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); button->setEnabled( FALSE ); button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); CHECK_PTR_ENGAUGE(button); connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); button->setEnabled( FALSE ); button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); CHECK_PTR_ENGAUGE(button); toolbar->addSeparator(); pathCombo = new QComboBox( TRUE, toolbar ); CHECK_PTR_ENGAUGE(pathCombo); connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); toolbar->setStretchableWidget( pathCombo ); setRightJustification( TRUE ); setDockEnabled( Qt::DockLeft, FALSE ); setDockEnabled( Qt::DockRight, FALSE ); pathCombo->insertItem( home_ ); browser->setFocus(); }