~Private() { stopIcon(); #ifndef WIDGET_PLUGIN if ( icon && copyIcon ) delete icon; #endif }
void setIcon(const PsiIcon *i, bool _copyIcon) { stopIcon(); if (copyIcon && icon) { delete icon; icon = 0; } copyIcon = _copyIcon; #ifndef WIDGET_PLUGIN if ( i && copyIcon ) icon = new PsiIcon(*i); else icon = (PsiIcon *)i; #else Q_UNUSED(i); #endif startIcon(); }
void MainWindow::Toolbar() { QPixmap openIcon((const char**) open_xpm); QPixmap redoIcon((const char**) redo_xpm); QPixmap simulateIcon((const char**) simulate_xpm); QPixmap stopIcon((const char**) stop_xpm); QPixmap cameraIcon((const char**) camera_xpm); QPixmap filmIcon((const char**) film_xpm); QPixmap frontViewIcon((const char**) frontView_xpm); QPixmap topViewIcon((const char**) topView_xpm); QPixmap rightSideViewIcon((const char**) rightSideView_xpm); toolbar = addToolBar("main toolbar"); QAction *open = toolbar->addAction(QIcon(openIcon), "Open Scene (Ctrl + O)"); QAction *redo = toolbar->addAction(QIcon(redoIcon), "Load last viewed scene (Ctrl + Shift + Q)"); toolbar->addSeparator(); QAction *simulate = toolbar->addAction(QIcon(simulateIcon), "Start Simulation (Ctrl + R"); QAction *stop = toolbar->addAction(QIcon(stopIcon), "Stop Simulation (Ctrl + C"); stop->setVisible(false); toolbar->addSeparator(); QAction *camera = toolbar->addAction(QIcon(cameraIcon), "Export screenshot"); QAction *film = toolbar->addAction(QIcon(filmIcon), "Export film sequence"); toolbar->addSeparator(); QAction *front = toolbar->addAction(QIcon(frontViewIcon), "View scene from front"); QAction *top = toolbar->addAction(QIcon(topViewIcon), "View scene from top"); QAction *rightSide = toolbar->addAction(QIcon(rightSideViewIcon), "View scene from right"); connect(open, SIGNAL(triggered()), this, SLOT(loadScene())); connect(redo, SIGNAL(triggered()), this, SLOT(quickLoad())); connect(simulate, SIGNAL(triggered()), this, SLOT(startSimulation())); connect(stop, SIGNAL(triggered()), this, SLOT(stopSimulation())); connect(camera, SIGNAL(triggered()), this, SLOT(camera())); connect(film, SIGNAL(triggered()), this, SLOT(film())); connect(front, SIGNAL(triggered()), this, SLOT(front())); connect(top, SIGNAL(triggered()), this, SLOT(top())); connect(rightSide, SIGNAL(triggered()), this, SLOT(side())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { thread = new QThread(); reader = new Reader(); reader->moveToThread(thread); connect(reader, SIGNAL(sendPoint(int,int,double)), this, SLOT(setPointProb(int,int,double))); connect(reader, SIGNAL(workRequested()), thread, SLOT(start())); connect(thread, SIGNAL(started()), reader, SLOT(doWork())); connect(reader, SIGNAL(finished()), thread, SLOT(quit()) , Qt::DirectConnection); connect(reader, SIGNAL(finished()), this, SLOT(fileFinished())); connect(reader, SIGNAL(sendReset()), this, SLOT(resetPositions())); setFixedSize(800,600); p_scene = new QGraphicsScene(this); p_view = new QGraphicsView(p_scene, this); QPixmap background(QCoreApplication::applicationDirPath() + "/img/sol.png"); if (background.isNull()) { std::cout << "Ouverture de sol.png échouée, ouverture de sol.jpg" << std::endl; background = QPixmap(QCoreApplication::applicationDirPath() + "/img/sol.jpg"); } p_scene->setBackgroundBrush(QBrush(background)); p_view->setGeometry(10,10,505,505); p_addPosition = new QPushButton("Ajouter position", this); p_addPosition->setGeometry(590,90, 120, 30); p_deletePos = new QPushButton("Réinitialiser positions", this); p_deletePos->setGeometry(590,130, 120, 30); p_openFile = new QPushButton("Ouvrir fichier", this); p_openFile->setGeometry(590, 170, 120, 30); p_changeTableSize = new QPushButton("Changer taille table", this); p_changeTableSize->setGeometry(50, 560, 120, 30); pauseButton = new QPushButton("", this); QIcon pauseIcon(QCoreApplication::applicationDirPath() + "/img/pause.png"); if (pauseIcon.isNull()) { std::cout << "Ouverture de pause.png échouée, ouverture de pause.jpg" << std::endl; pauseIcon = QIcon((QCoreApplication::applicationDirPath() + "/img/pause.jpg")); } pauseButton->setIcon(pauseIcon); pauseButton->setGeometry(590, 250, 30, 30); pauseButton->setDisabled(true); stopButton = new QPushButton("", this); QIcon stopIcon(QCoreApplication::applicationDirPath() + "/img/stop.png"); if (stopIcon.isNull()) { std::cout << "Ouverture de stop.png échouée, ouverture de stop.jpg" << std::endl; pauseIcon = QIcon((QCoreApplication::applicationDirPath() + "/img/stop.jpg")); } stopButton->setIcon(stopIcon); stopButton->setGeometry(630, 250, 30, 30); stopButton->setDisabled(true); stepButton = new QPushButton("", this); QIcon stepIcon(QCoreApplication::applicationDirPath() + "/img/step.png"); if (stepIcon.isNull()) { std::cout << "Ouverture de step.png échouée, ouverture de step.jpg" << std::endl; stepIcon = QIcon((QCoreApplication::applicationDirPath() + "/img/step.jpg")); } stepButton->setIcon(stepIcon); stepButton->setGeometry(670, 250, 30, 30); stepButton->setDisabled(true); p_quit = new QPushButton("Quitter", this); p_quit->setGeometry(600, 560, 100, 30); p_addPosX = new QLineEdit(this); p_addPosY = new QLineEdit(this); p_addPosP = new QLineEdit(this); p_addPosX->setGeometry(580, 50, 40, 30); p_addPosY->setGeometry(630, 50, 40, 30); p_addPosP->setGeometry(680, 50, 40, 30); p_addPosX->setPlaceholderText("Abscisse"); p_addPosY->setPlaceholderText("Ordonnée"); p_addPosP->setPlaceholderText("Proba"); currentDate = new QLabel("Pas de fichier en cours", this); currentDate->setGeometry(580, 300, 140, 30); QObject::connect(p_addPosition, SIGNAL(clicked()), this, SLOT(sendPointProbValues())); QObject::connect(this, SIGNAL(pointProbValues(int,int,double)), this, SLOT(setPointProb(int,int,double))); QObject::connect(p_deletePos, SIGNAL(clicked()), this, SLOT(resetPositions())); QObject::connect(p_quit, SIGNAL(clicked()), qApp, SLOT(quit())); QObject::connect(p_openFile, SIGNAL(clicked()), this, SLOT(readMatrixFromFile())); QObject::connect(p_changeTableSize, SIGNAL(clicked()), this, SLOT(changeTableSize())); QObject::connect(pauseButton, SIGNAL(clicked()), this, SLOT(pauseRead())); QObject::connect(stopButton, SIGNAL(clicked()), this, SLOT(stopRead())); QObject::connect(reader, SIGNAL(sendDate(QString)), this, SLOT(setDate(QString))); QObject::connect(stepButton, SIGNAL(clicked()), this, SLOT(clickNextDate())); }