///creates new drawing here! void DrawingWidget::trigger(MsbObject* other){ if (other->name=="Draw Particles"){ useTool=TOOL_DRAW; sceneData->drawTool->bPaintMesh=false; sceneData->brush->drawType=DRAW_SPRITE; setTextureID("icon_paint"); } if (other->name=="Draw Calligraphy"){ useTool=TOOL_CALLIGRAPHY; sceneData->drawTool->bPaintMesh=false; sceneData->brush->drawType=DRAW_SPRITE; setTextureID("icon_paintFancy"); } if (other->name=="Draw Meshes"){ useTool=TOOL_DRAW; sceneData->drawTool->bPaintMesh=true; sceneData->brush->drawType=DRAW_VBOMESH; setTextureID("icon_drawMesh"); } //close widget and select again clickedRight(); clickedLeft(); }
void SelectWidget::trigger(MsbObject* other){ if (other->name=="Select Objects"){ useTool=TOOL_SELECT; setTextureID("icon_select"); } if (other->name=="Select Particles"){ useTool=TOOL_PARTICLESELECT; setTextureID("icon_selectParticles"); } clickedRight(); clickedLeft(); }
void BoneWidget::trigger(MsbObject* other){ if (other->name=="Paint Weights"){ useTool=TOOL_SKIN; setTextureID("icon_paintWeights"); } if (other->name=="Create Bone"){ useTool=TOOL_BONE; setTextureID("icon_addBones"); } clickedRight(); clickedLeft(); }
void SourceWindow::infoMousePress(QMouseEvent* ev) { // we handle left and middle button if (ev->button() != Qt::LeftButton && ev->button() != Qt::MidButton) { return; } // get row int row = cursorForPosition(QPoint(0, ev->y())).blockNumber(); if (row < 0) return; if (ev->x() > m_widthItems) { if (isRowExpanded(row)) { actionCollapseRow(row); } else { actionExpandRow(row); } return; } int sourceRow; int line = rowToLine(row, &sourceRow); // find address if row is disassembled code DbgAddr address; if (row > sourceRow) { // get offset from source code line int off = row - sourceRow; address = m_sourceCode[line].disassAddr[off-1]; } switch (ev->button()) { case Qt::LeftButton: TRACE(QString().sprintf("left-clicked line %d", line)); emit clickedLeft(m_fileName, line, address, (ev->modifiers() & Qt::ShiftModifier) != 0); break; case Qt::MidButton: TRACE(QString().sprintf("mid-clicked row %d", line)); emit clickedMid(m_fileName, line, address); break; default:; } }
void AssetInspector::closeKinectTool(){ sceneData->externalInputList["kinectInput"]->stopProgram(); clickedLeft(); }
GameWindow::GameWindow(int sizeX, int sizeY, int minesNumber) : QMainWindow(), ui(new Ui::GameWindow) { ui->setupUi(this); QPixmap background(":/resources/images/options_background.jpg"); QPalette qPalette; qPalette.setBrush(this->backgroundRole(),QBrush(background)); this->setPalette(qPalette); sizeOfFieldX = sizeX; sizeOfFieldY = sizeY; minesInTheField = minesNumber; core = new Field(sizeOfFieldX, sizeOfFieldY, minesInTheField); fieldLayout = new QGridLayout; backButton = new QPushButton("Back to menu"); backButton->setStyleSheet(QPushButtonStyle); backButton->setFixedSize(175,50); refreshButton = new QPushButton("Refresh game"); refreshButton->setStyleSheet(QPushButtonStyle); refreshButton->setFixedSize(175,50); QObject::connect(backButton, SIGNAL(clicked(bool)), this, SLOT(backToMenu())); QObject::connect(refreshButton, SIGNAL(clicked(bool)), this, SLOT(refreshGame())); mainFieldLayout = new QVBoxLayout; panelLayout = new QVBoxLayout; mainLayout = new QHBoxLayout; vector<QMyPushButton*> tmpVect; for (int i = 0; i < core->getSizeX(); i++) { for (int j = 0; j < core->getSizeY(); j++) { QMyPushButton* newButton; tmpVect.push_back(newButton); } buttons.push_back(tmpVect); } QLabel *fieldHeight = new QLabel("Height of field: "); fieldHeight->setStyleSheet(QLabelStyle); QLabel *fieldLength = new QLabel("Length of field: "); fieldLength->setStyleSheet(QLabelStyle); QLabel *allCells = new QLabel("Cells in the field:"); allCells->setStyleSheet(QLabelStyle); QLabel *cellsLeft = new QLabel("Cells left: "); cellsLeft->setStyleSheet(QLabelStyle); QLabel *minesLeft = new QLabel("Mines left: "); minesLeft->setStyleSheet(QLabelStyle); QLabel *flagsLeft = new QLabel("You have flags: "); flagsLeft->setStyleSheet(QLabelStyle); fieldHeightNumber = new QLabel(QString::number(core->getSizeX())); fieldHeightNumber->setStyleSheet(QLabelStyle); fieldLengthNumber = new QLabel(QString::number(core->getSizeY())); fieldLengthNumber->setStyleSheet(QLabelStyle); allCellsNumber = new QLabel(QString::number(core->getSizeX() * core->getSizeY())); allCellsNumber->setStyleSheet(QLabelStyle); cellsLeftNumber = new QLabel(QString::number(core->cellsLeft)); cellsLeftNumber->setStyleSheet(QLabelStyle); minesLeftNumber = new QLabel(QString::number(core->minesLeft)); minesLeftNumber->setStyleSheet(QLabelStyle); flagsLeftNumber = new QLabel(QString::number(core->flagsLeft)); flagsLeftNumber->setStyleSheet(QLabelStyle); QHBoxLayout *panelHorizontal1 = new QHBoxLayout; panelHorizontal1->addWidget(fieldHeight); panelHorizontal1->addWidget(fieldHeightNumber); QHBoxLayout *panelHorizontal2 = new QHBoxLayout; panelHorizontal2->addWidget(fieldLength); panelHorizontal2->addWidget(fieldLengthNumber); QHBoxLayout *panelHorizontal3 = new QHBoxLayout; panelHorizontal3->addWidget(allCells); panelHorizontal3->addWidget(allCellsNumber); QHBoxLayout *panelHorizontal4 = new QHBoxLayout; panelHorizontal4->addWidget(cellsLeft); panelHorizontal4->addWidget(cellsLeftNumber); QHBoxLayout *panelHorizontal5 = new QHBoxLayout; panelHorizontal5->addWidget(minesLeft); panelHorizontal5->addWidget(minesLeftNumber); QHBoxLayout *panelHorizontal6 = new QHBoxLayout; panelHorizontal6->addWidget(flagsLeft); panelHorizontal6->addWidget(flagsLeftNumber); //timer = new QTimer; //timer->start(10000); panelLayout = new QVBoxLayout; mainPanelLayout = new QVBoxLayout; panelBox = new QGroupBox; panelLayout->addSpacing(5); panelLayout->addLayout(panelHorizontal1); panelLayout->addLayout(panelHorizontal2); panelLayout->addLayout(panelHorizontal3); panelLayout->addLayout(panelHorizontal4); panelLayout->addLayout(panelHorizontal5); panelLayout->addLayout(panelHorizontal6); panelBox->setLayout(panelLayout); mainPanelLayout->addWidget(panelBox); //mainPanelLayout->addWidget(timer); mainPanelLayout->addStretch(1); mainPanelLayout->addWidget(refreshButton); mainPanelLayout->addWidget(backButton); mainPanelLayout->setSpacing(20); for (int i = 0; i < core->getSizeX(); i++) for (int j = 0; j < core->getSizeY(); j++) { buttons[i][j] = new QMyPushButton; fieldButtonSize = new QSize(32,32); buttons[i][j]->setStyleSheet(QFieldButtonStyle); buttons[i][j]->setFixedSize(*fieldButtonSize); //buttons[i][j]->setText("Do it!"); fieldLayout->addWidget(buttons[i][j], i, j, 1, 1); buttons[i][j]->setProperty("coordinates", i * 1000 + j); connect(buttons[i][j], SIGNAL(pressed()), this, SLOT(clickedLeft())); connect(buttons[i][j], SIGNAL(rClicked()), this, SLOT(setFlag())); //QMyPushButton *but = new QMyPushButton; //connect(but, SIGNAL()) } //mainFieldLayout->addSpacing(15); fieldLayout->setSpacing(0); mainFieldLayout->addLayout(fieldLayout); //mainLayout->addSpacing(15); mainLayout->addLayout(mainFieldLayout); mainLayout->addSpacing(25); mainLayout->addLayout(mainPanelLayout); //mainLayout->addSpacing(15); QWidget *centralWidget = new QWidget; centralWidget->setLayout(mainLayout); this->setCentralWidget(centralWidget); this->setWindowTitle("Minesweeper TOP Game"); this->setWindowIcon(QIcon(":/resources/images/icon.png")); connect(this, SIGNAL(allCellsOpen()), this, SLOT(winGame())); connect(this, SIGNAL(allah_BABAH()), this, SLOT(loseGame())); }