void Edge::mousePressEvent(QGraphicsSceneMouseEvent *event) { /*if(event->button() == Qt::LeftButton ) { emit leftClick(id); QGraphicsItem::mousePressEvent(event); } //else if( event->button() == Qt::MidButton ){ */ if( event->buttons() == Qt::RightButton ) { emit rightClick(this); update(); QGraphicsItem::mousePressEvent(event); return; } bool ok; int val = QInputDialog::getInteger ( NULL, "Set value of node" , "Value" , 10, 0, 2147483647, 1, &ok); if(!ok) return; value = val; update(); //} //update(); //setPos( event->pos()); //QGraphicsItem::mousePressEvent(event); }
void FusionForeverWidget::mouseReleaseEvent(QMouseEvent* me) { Vector3f click_loc(me->x(), me->y(), 0); Vector3f world_loc = Camera::Instance().ScreenToWorld(click_loc); std::vector<Section_ptr> clicked_sections; core_->CheckCollisions(world_loc, clicked_sections); if(me->button() == Qt::LeftButton && !drag_occurred_) { if(clicked_sections.size() > 0) { if(clicked_sections == sections_under_mouse_) { section_under_mouse_index_++; section_under_mouse_index_ %= sections_under_mouse_.size(); SetSelection(sections_under_mouse_[section_under_mouse_index_]); } else { sections_under_mouse_ = clicked_sections; section_under_mouse_index_ = 0; SetSelection(sections_under_mouse_[section_under_mouse_index_]); } } } else if(me->button() == Qt::RightButton && !drag_occurred_) { emit selectionChanged(selection_, clicked_sections); emit rightClick(); } drag_mode_ = EditorDragMode::NotDragging; drag_occurred_ = false; }
void QUProfileController::commandDispatcher(Guid /*sessionid*/, Typeless command, Typeless /*responses*/) { // dbg(1) << "g1dfcontroller: dispatcher\n"; QString cmd = command["/cmd"].ValueOr<QString>(""); if( cmd == "zoomRect") { double x1 = command["/val1"].ValueOr<double>( 0.0); double y1 = command["/val2"].ValueOr<double>( 0.0); double x2 = command["/val3"].ValueOr<double>( 1.0); double y2 = command["/val4"].ValueOr<double>( 1.0); // make sure we don't respond to empty zoom requests if( fabs(x1-x2) < 1e-6 || fabs(y1-y2) < 1e-6) return; m_zoomX1 = ttx1inv( x1); m_zoomY1 = tty1inv( y1); m_zoomX2 = ttx1inv( x2); m_zoomY2 = tty1inv( y2); swap_ordered( m_zoomX1, m_zoomX2); swap_ordered( m_zoomY2, m_zoomY1); m_autoZoom = false; markDirty(); } else if( cmd == "rightClick") { if( getCursor() > -1) emit rightClick( getCursor()); } else if( cmd == "zoomReset") { m_autoZoom = true; markDirty(); } else { dbg(1) << ConsoleColors::warning() << "Unknown command: " << cmd << ConsoleColors::resetln(); } }
EvBox::EvBox(QWidget *parent) : QWidget(parent), ui(new Ui::EvBox) { ui->setupUi(this); QSlider *sliders[6] = {ui->hpslider, ui->atkslider, ui->defslider, ui->satkslider, ui->sdefslider, ui->speedslider}; QLabel *descs[6] = {ui->hpdesc, ui->atkdesc, ui->defdesc, ui->satkdesc, ui->sdefdesc, ui->speeddesc}; QLabel *labels[6] = {ui->hplabel, ui->atklabel, ui->deflabel, ui->satklabel, ui->sdeflabel, ui->speedlabel}; QLineEdit *edits[6] = {ui->hpedit, ui->atkedit, ui->defedit, ui->satkedit, ui->sdefedit, ui->speededit}; QImageButtonLR *boosts[6] = {ui->hpboost, ui->atkboost, ui->defboost, ui->satkboost, ui->sdefboost, ui->speedboost}; memcpy(m_sliders, sliders, sizeof(sliders)); memcpy(m_descs, descs, sizeof(descs)); memcpy(m_stats, labels, sizeof(labels)); memcpy(m_evs, edits, sizeof(edits)); memcpy(m_boosts, boosts, sizeof(boosts)); #define setNums(var) for (int i = 0; i < 6; i++) { var[i]->setProperty("stat", i);} setNums(m_sliders); setNums(m_evs); setNums(m_boosts); #undef setNums for(int i = 0; i < 6; i++) { connect(m_sliders[i], SIGNAL(valueChanged(int)), this, SLOT(changeEV(int))); connect(m_evs[i], SIGNAL(textChanged(QString)), this, SLOT(changeEV(QString))); connect(m_boosts[i], SIGNAL(rightClick()), this, SLOT(changeToMinusBoost())); connect(m_boosts[i], SIGNAL(leftClick()), this, SLOT(changeToPlusBoost())); } }
void QImageButtonLR::mouseReleaseEvent(QMouseEvent *ev) { if(ev->button() == Qt::LeftButton) emit leftClick(); else if (ev->button() == Qt::RightButton) emit rightClick(); }
void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent* mouseEvent) { emit mousePressed(mouseEvent); if (mouseEvent->button() == Qt::RightButton) { emit rightClick(); } }
void NotificationView::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::RightButton) emit rightClick(); else QWebView::mousePressEvent(event); }
void GraphicsView::mouseReleaseEvent(QMouseEvent *event) { QGraphicsView::mouseReleaseEvent(event); if(event->button() == Qt::RightButton) { emit rightClick(); } else if(event->button() == Qt::MiddleButton) { emit middleClick(); } }
void favoritesTab::updateFavorites() { QStringList assoc = QStringList() << "name" << "note" << "lastviewed"; QString order = assoc[ui->comboOrder->currentIndex()]; bool reverse = (ui->comboAsc->currentIndex() == 1); if (order == "note") { qSort(m_favorites.begin(), m_favorites.end(), sortByNote); } else if (order == "lastviewed") { qSort(m_favorites.begin(), m_favorites.end(), sortByLastviewed); } else { qSort(m_favorites.begin(), m_favorites.end(), sortByName); } if (reverse) { m_favorites = reversed(m_favorites); } QString format = tr("MM/dd/yyyy"); clearLayout(ui->layoutFavorites); QString display = m_settings->value("favorites_display", "ind").toString(); int i = 0; for (Favorite fav : m_favorites) { QString xt = tr("<b>Name:</b> %1<br/><b>Note:</b> %2 %%<br/><b>Last view:</b> %3").arg(fav.getName(), QString::number(fav.getNote()), fav.getLastViewed().toString(format)); QWidget *w = new QWidget(ui->scrollAreaWidgetContents); QVBoxLayout *l = new QVBoxLayout(w); if (display.contains("i")) { QPixmap img = fav.getImage(); QBouton *image = new QBouton(fav.getName(), false, false, 0, QColor(), this); image->setIcon(img); image->setIconSize(img.size()); image->setFlat(true); image->setToolTip(xt); connect(image, SIGNAL(rightClick(QString)), this, SLOT(favoriteProperties(QString))); connect(image, SIGNAL(middleClick(QString)), this, SLOT(addTabFavorite(QString))); connect(image, SIGNAL(appui(QString)), this, SLOT(loadFavorite(QString))); l->addWidget(image); } QAffiche *caption = new QAffiche(fav.getName(), 0 ,QColor(), this); caption->setText((display.contains("n") ? fav.getName() : "") + (display.contains("d") ? "<br/>("+QString::number(fav.getNote())+" % - "+fav.getLastViewed().toString(format)+")" : "")); caption->setTextFormat(Qt::RichText); caption->setAlignment(Qt::AlignCenter); caption->setToolTip(xt); if (!caption->text().isEmpty()) { connect(caption, SIGNAL(clicked(QString)), this, SLOT(loadFavorite(QString))); l->addWidget(caption); } ui->layoutFavorites->addWidget(w, i / 8, i % 8); ++i; } }
void GraphicsView::mouseReleaseEvent(QMouseEvent *event) { QGraphicsView::mouseReleaseEvent(event); if(event->button() == Qt::RightButton) { //rightclick -> reset image scale to 1:1 emit rightClick(); } else if(event->button() == Qt::MiddleButton) { //middle click -> fit image to view emit middleClick(); } }
void cVideoLabel::mousePressEvent(QMouseEvent *ev) { this->xCoord = ev->pos().x(); this->yCoord = ev->pos().y(); if (ev->button() == Qt::LeftButton) { emit leftClick(); } if (ev->button() == Qt::RightButton) { this->xInitialCoord = ev->pos().x(); this->yInitialCoord = ev->pos().y(); setCursor(Qt::BlankCursor); emit rightClick(); } }
bool Scene::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) { //if (_vm->getGameType() != GType_Burger) // return false; // If the game is currently paused, don't do any scene processing if (_vm->_kernel->paused) return false; switch (eventType) { case MEVENT_LEFT_CLICK: leftClick(x, y); break; case MEVENT_RIGHT_CLICK: rightClick(x, y); break; case MEVENT_MOVE: mouseMove(x, y); break; default: return false; } return true; }
//connects gui buttons with Slots in this class void MainWindow::connectSignalSlots() { //connect signals/slots //load/save/open export folder connect(ui->pushButton_load, SIGNAL(clicked()), this, SLOT(loadUserFilePath())); connect(ui->pushButton_save, SIGNAL(clicked()), this, SLOT(saveUserFilePath())); connect(ui->pushButton_openExportFolder, SIGNAL(clicked()), this, SLOT(openExportFolder())); //zoom connect(ui->pushButton_zoomIn, SIGNAL(clicked()), this, SLOT(zoomIn())); connect(ui->pushButton_zoomOut, SIGNAL(clicked()), this, SLOT(zoomOut())); connect(ui->pushButton_resetZoom, SIGNAL(clicked()), this, SLOT(resetZoom())); connect(ui->pushButton_fitInView, SIGNAL(clicked()), this, SLOT(fitInView())); //calculate connect(ui->pushButton_calcNormal, SIGNAL(clicked()), this, SLOT(calcNormalAndPreview())); connect(ui->pushButton_calcSpec, SIGNAL(clicked()), this, SLOT(calcSpecAndPreview())); connect(ui->pushButton_calcDisplace, SIGNAL(clicked()), this, SLOT(calcDisplaceAndPreview())); connect(ui->pushButton_calcSsao, SIGNAL(clicked()), this, SLOT(calcSsaoAndPreview())); //switch between tabs connect(ui->tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(preview(int))); //display channel intensity connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), this, SLOT(preview())); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), ui->radioButton_displayRed, SLOT(setEnabled(bool))); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), ui->radioButton_displayGreen, SLOT(setEnabled(bool))); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), ui->radioButton_displayBlue, SLOT(setEnabled(bool))); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), ui->radioButton_displayAlpha, SLOT(setEnabled(bool))); connect(ui->radioButton_displayRed, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); connect(ui->radioButton_displayGreen, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); connect(ui->radioButton_displayBlue, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); connect(ui->radioButton_displayAlpha, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); //autoupdate after changed values // spec autoupdate connect(ui->doubleSpinBox_spec_redMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_greenMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_blueMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_alphaMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_scale, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->comboBox_mode_spec, SIGNAL(currentIndexChanged(int)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_contrast, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); // normal autoupdate connect(ui->checkBox_useRed_normal, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->checkBox_useGreen_normal, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->checkBox_useBlue_normal, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->checkBox_useAlpha_normal, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->comboBox_mode_normal, SIGNAL(currentIndexChanged(int)), this, SLOT(autoUpdate())); connect(ui->comboBox_method, SIGNAL(currentIndexChanged(int)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_strength, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->checkBox_tileable, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->checkBox_invertHeight, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->spinBox_normalmapSize, SIGNAL(valueChanged(int)), this, SLOT(autoUpdate())); connect(ui->checkBox_keepLargeDetail, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->spinBox_largeDetailScale, SIGNAL(valueChanged(int)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_largeDetailHeight, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); // displcacement autoupdate connect(ui->doubleSpinBox_displace_redMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_displace_greenMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_displace_blueMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_displace_scale, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->comboBox_mode_displace, SIGNAL(currentIndexChanged(int)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_displace_contrast, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); // ssao autoupdate connect(ui->doubleSpinBox_ssao_size, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); //graphicsview drag and drop connect(ui->graphicsView, SIGNAL(singleImageDropped(QUrl)), this, SLOT(loadSingleDropped(QUrl))); connect(ui->graphicsView, SIGNAL(multipleImagesDropped(QList<QUrl>)), this, SLOT(loadMultipleDropped(QList<QUrl>))); //graphicsview rightclick/middleclick/zoom connect(ui->graphicsView, SIGNAL(rightClick()), this, SLOT(resetZoom())); connect(ui->graphicsView, SIGNAL(middleClick()), this, SLOT(fitInView())); connect(ui->graphicsView, SIGNAL(zoomIn()), this, SLOT(zoomIn())); connect(ui->graphicsView, SIGNAL(zoomOut()), this, SLOT(zoomOut())); //queue (item widget) connect(ui->pushButton_removeImagesFromQueue, SIGNAL(clicked()), this, SLOT(removeImagesFromQueue())); connect(ui->pushButton_processQueue, SIGNAL(clicked()), this, SLOT(processQueue())); connect(ui->pushButton_stopProcessingQueue, SIGNAL(clicked()), this, SLOT(stopProcessingQueue())); connect(ui->pushButton_changeOutputPath_Queue, SIGNAL(clicked()), this, SLOT(changeOutputPathQueueDialog())); connect(ui->lineEdit_outputPath, SIGNAL(editingFinished()), this, SLOT(editOutputPathQueue())); connect(ui->listWidget_queue, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(queueItemDoubleClicked(QListWidgetItem*))); //queue drag and drop connect(ui->listWidget_queue, SIGNAL(singleImageDropped(QUrl)), this, SLOT(loadSingleDropped(QUrl))); connect(ui->listWidget_queue, SIGNAL(multipleImagesDropped(QList<QUrl>)), this, SLOT(loadMultipleDropped(QList<QUrl>))); //normalmap size preview text connect(ui->spinBox_normalmapSize, SIGNAL(valueChanged(int)), this, SLOT(normalmapSizeChanged())); //"About" button connect(ui->pushButton_about, SIGNAL(clicked()), this, SLOT(showAboutDialog())); }
void editLevelStateClass::update(sf::RenderWindow& window) { sf::Event event; while(window.pollEvent(event)) { if(event.type == sf::Event::Closed) { window.close(); } else if(event.type == sf::Event::KeyPressed) { switch(event.key.code) { case sf::Keyboard::Escape: { setNoMode(); break; } case sf::Keyboard::A: { drawAllFloor = !drawAllFloor; break; } case sf::Keyboard::F: { setAddFloorMode(); break; } case sf::Keyboard::W: { setAddWallMode("WALL"); break; } case sf::Keyboard::X: { setAddWallMode("STICKMAN_WALL"); break; } case sf::Keyboard::P: { currentMode = PLACE_PLAYER; break; } case sf::Keyboard::Return: { returnPressed(); break; } case sf::Keyboard::BackSpace: { backspacePressed(); break; } case sf::Keyboard::Delete: { deletePressed(); break; } case sf::Keyboard::LShift: { speedFactor = 5; break; } case sf::Keyboard::O: { saveLevel(); break; } case sf::Keyboard::I: { loadLevel(); break; } case sf::Keyboard::H: { moveAllLevel(-1, 0); break; } case sf::Keyboard::J: { moveAllLevel(0, 1); break; } case sf::Keyboard::K: { moveAllLevel(0, -1); break; } case sf::Keyboard::L: { moveAllLevel(1, 0); break; } case sf::Keyboard::F10: { global::activeGameStateStack->set(new mainMenuStateClass()); return; } case sf::Keyboard::Add: { if(static_cast<unsigned int>(currentFloor - 1) < listOfFloor.size()) { ++currentFloor; } break; } case sf::Keyboard::Subtract: { if(currentFloor > 0) { --currentFloor; } break; } case sf::Keyboard::B: { if(chooseNameOfLevel == false) { chooseNameOfLevel = true; tmpIndexOfLevel = currentIndexOfLevel; } else { --tmpIndexOfLevel; if(tmpIndexOfLevel < 0) { tmpIndexOfLevel = listOfLevel.size() - 1; } } nameOfLevelTextHasChanged(); break; } case sf::Keyboard::N: { if(chooseNameOfLevel == false) { chooseNameOfLevel = true; tmpIndexOfLevel = currentIndexOfLevel; } else { ++tmpIndexOfLevel; if(static_cast<unsigned int>(tmpIndexOfLevel) >= listOfLevel.size()) { tmpIndexOfLevel = 0; } } nameOfLevelTextHasChanged(); break; } case sf::Keyboard::M: { if(chooseNameOfLevel == true) { chooseNameOfLevel = false; currentIndexOfLevel = tmpIndexOfLevel; loadThisLevel(listOfLevel[currentIndexOfLevel]); } break; } default: { break; } } } else if(event.type == sf::Event::KeyReleased) { if(event.key.code == sf::Keyboard::LShift) { speedFactor = 1; } } else if(event.type == sf::Event::MouseButtonPressed) { if(event.mouseButton.button == sf::Mouse::Left) { leftClick(view.getCenter().x - ((WIDTH_SCREEN / 2) * zoomLevel) + event.mouseButton.x * zoomLevel, view.getCenter().y - ((HEIGHT_SCREEN / 2) * zoomLevel) + event.mouseButton.y * zoomLevel); } else if(event.mouseButton.button == sf::Mouse::Right) { rightClick(view.getCenter().x - ((WIDTH_SCREEN / 2) * zoomLevel) + event.mouseButton.x * zoomLevel, view.getCenter().y - ((HEIGHT_SCREEN / 2) * zoomLevel) + event.mouseButton.y * zoomLevel); } } else if(event.type == sf::Event::MouseWheelMoved) { zoomView(event.mouseWheel.delta); } if(event.type == sf::Event::TextEntered) { char character = static_cast<char>(event.text.unicode); if(character >= 48 && character <= 57 && currentMode == NO_MODE) { if(character - 48 < static_cast<char>(listOfFloor.size())) { currentFloor = character - 48; } } } } if(sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) { moveView(-speedView * zoomLevel - 1, 0); } if(sf::Keyboard::isKeyPressed(sf::Keyboard::D)) { moveView(speedView * zoomLevel + 1, 0); } if(sf::Keyboard::isKeyPressed(sf::Keyboard::Z)) { moveView(0, -speedView * zoomLevel - 1); } if(sf::Keyboard::isKeyPressed(sf::Keyboard::S)) { moveView(0, speedView * zoomLevel + 1); } if(chooseNameOfLevel == true) { updateNameOfLevelText(); } }
Korn::Korn(QWidget *parent, KornSettings *settings, WFlags f) : QFrame(parent, "korn", f) { int count=0; KornButton *button; QBoxLayout::Direction dir= QBoxLayout::TopToBottom; _optionsDialog = 0; _noConfig = false; // popup menu menu = new QPopupMenu(); menu->insertItem(i18n("&Setup"), this, SLOT( optionDlg() )); menu->insertSeparator(); menu->insertItem(i18n("&Help"), this, SLOT( help() )); menu->insertItem(i18n("&About"), this, SLOT( about() )); menu->insertSeparator(); menu->insertItem(i18n("E&xit"), qApp, SLOT( quit() )); // widget decorations if(settings->layout() == KornSettings::horizontal ) dir = QBoxLayout::LeftToRight; QBoxLayout *layout = new QBoxLayout(this, dir, 2); setFrameStyle(Panel | Raised); setLineWidth(1); // read settings and create boxes options = new QList<KornBox>; options->setAutoDelete( true ); while( !settings->done() ) { // create a new button with these settings button = new KornButton(this, settings); button->resize(20,20); layout->addWidget(button); connect( button, SIGNAL( rightClick() ), this, SLOT( popupMenu() )); button->show(); /// keep track of settings locally KornBox *thisBox = new KornBox; thisBox->name = settings->name().data(); thisBox->caption = settings->caption().data(); thisBox->path = settings->file().data(); thisBox->poll = settings->pollTime(); thisBox->notify = settings->audioCmd().data(); thisBox->click = settings->clickCmd().data(); options->append( thisBox ); count++; settings->nextBox(); } // dont layout or resize if no buttons were created // This should be changed, perhaps to a default single button if( !settings->valid() || count == 0 ) { // no valid config _noConfig = true; int result = KMsgBox::yesNo(0, i18n("korn: configure now?"), i18n("you have not yet configured korn.\n" "would you like to do this now?"), KMsgBox::QUESTION, i18n("Yes"), i18n("No - Quit")); if( result == 1 ) { // create a list with the default mailbox in it. KornBox *box = new KornBox; box->name = i18n("personal"); box->caption = i18n("Inbox"); box->path = (const char *)getenv("MAIL"); box->poll = 240; options->append( box ); optionDlg(); } else { qApp->quit(); } return; } if( dir == QBoxLayout::LeftToRight ) resize(count*(2+20)+2,4+20); else resize(4+20, count*(2+20)+2); // move to the saved position if a position was saved if( settings->geomSet() ) { setGeometry( settings->geom().x(), settings->geom().y(), width(), height() ); } else { // save position KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup("Korn"); config->writeEntry("PosX", frameGeometry().x(), true); config->writeEntry("PosY", frameGeometry().y(), true); config->writeEntry("winHeight", frameGeometry().height(), true); } if( settings->noMouse() ) { XSelectInput( x11Display(), handle(), ExposureMask | StructureNotifyMask ); } }
void RecipeWidget::init(HeadcookerWindow *win) { ui->setupUi(this); this->win = win; ui->bodyWidget->setObjectName("body"); ui->instructions->setObjectName("instructions"); ui->instructions->verticalScrollBar()->setObjectName("scrollbar"); ui->backButton->setObjectName("backButton"); ui->tagWidget->setObjectName("tagBox"); ui->ingredientBox->setObjectName("ingredientBox"); ui->instructionBox->setObjectName("instructionBox"); ui->recipeName->setObjectName("headline"); ui->subtitle->setObjectName("subtitle"); ui->servingsText->setObjectName("metaInfo"); ui->servingsEdit->setObjectName("inputArea"); connect(ui->backButton, SIGNAL(clicked()), this, SLOT(back())); ui->recipeName->setText(recipe->getTitle()); ui->subtitle->setText(recipe->getSubtitle()); ui->instructions->setText(recipe->getInstructions()); updateIngredients(); //Metainformations ui->servingsEdit->setText(QString::number(recipe->getServings())); if (ui->metaInfoWidget->layout() != NULL) delete ui->metaInfoWidget->layout(); FlowLayout *metaInfoLayout = new FlowLayout; ui->metaInfoWidget->setLayout(metaInfoLayout); for (QPair<QString, QString> metaInfo : recipe->getMetaInfo()) { QLabel *name = new QLabel(metaInfo.first); name->setObjectName("metaInfo"); QFont font = name->font(); font.setBold(true); name->setFont(font); QLabel *value = new QLabel(metaInfo.second); value->setObjectName("text"); metaInfoLayout->addWidget(name); metaInfoLayout->addWidget(value); } //Tags if (ui->tagWidget->layout()) { delete ui->tagWidget->layout(); } tagLayout = new FlowLayout; ui->tagWidget->setLayout(tagLayout); for (QString tag : recipe->getTags()) { addTag(tag); } ui->servingsEdit->setValidator(new QDoubleValidator); addAddTagButton(); connect(&leftClickMapper, SIGNAL(mapped(QString)), this, SLOT(leftClick(QString))); connect(&rightClickMapper, SIGNAL(mapped(QString)), this, SLOT(rightClick(QString))); connect(Options::ptr(), SIGNAL(updated()), this, SLOT(updateStylesheet())); connect(ui->servingsEdit, SIGNAL(textChanged(QString)), this, SLOT(updateIngredients(QString))); updateStylesheet(); }
/** Default constructor */ MainWindow::MainWindow() : QWidget() { /** constructor() that has in input file for scores */ ifstream fin; fin.open("scores.txt"); if(fin.fail()) { cout << "Could not find the scores file" << endl; } else { string temp; int temp2; getline(fin,temp,'|'); fin >> temp2; while(fin.good()) { scorenames.push_back(temp); scores.push_back(temp2); getline(fin,temp,'|'); fin >> temp2; } } /** Set the Pixmaps */ ez=new QPixmap("ezreal.png"); *ez=ez->scaled(75,75,Qt::KeepAspectRatioByExpanding); melee=new QPixmap("meleeminion.png"); *melee=melee->scaled(50,50,Qt::KeepAspectRatioByExpanding); caster=new QPixmap("casterminion.png"); *caster=caster->scaled(45,45,Qt::KeepAspectRatioByExpanding); siege=new QPixmap("siegeminion.png"); *siege=siege->scaled(65,65,Qt::KeepAspectRatioByExpanding); basic=new QPixmap("basicattack.gif"); *basic=basic->scaled(10,10,Qt::KeepAspectRatioByExpanding); mystic=new QPixmap("basicattack.gif"); *mystic=mystic->scaled(30,30,Qt::KeepAspectRatioByExpanding); trueshot=new QPixmap("trueshot.png"); *trueshot=trueshot->scaled(75,75,Qt::KeepAspectRatioByExpanding); heal=new QPixmap("heal.png"); *heal=heal->scaled(50,50,Qt::KeepAspectRatioByExpanding); clarity=new QPixmap("clarity.png"); *clarity=clarity->scaled(50,50,Qt::KeepAspectRatioByExpanding); ignite=new QPixmap("ignite.png"); *ignite=ignite->scaled(50,50,Qt::KeepAspectRatioByExpanding); energy=new QPixmap("energybolt.gif"); *energy=energy->scaled(50,50,Qt::KeepAspectRatioByExpanding); cannon=new QPixmap("cannonshot.png"); *cannon=cannon->scaled(55,55,Qt::KeepAspectRatioByExpanding); /** color is the default color set for spacers and background of widgets*/ color.setRgb(240,240,240,255); /** MainWidget which holds everything */ mainwidget= new QWidget; mainwidget->setFixedSize(1200,800); /** Main Layout for MainWindow */ mainLayout = new QVBoxLayout; mainwidget->setLayout(mainLayout); /** TITLE above row1*/ row0 = new QHBoxLayout; /** IconObject used to display QPixmap */ hold_spacer0 = new IconObject; /** Used to hold a space */ spacer0 = new QPixmap(100,64); spacer0->fill(color); /** IconObject used to display QPixmap */ hold_title = new IconObject; /** Ability display icon */ title = new QPixmap("title.png"); /** IconObject used to display QPixmap */ hold_spacer01 = new IconObject; /** Used to hold a space */ spacer01 = new QPixmap(100,64); spacer01->fill(color); // set pixmaps hold_spacer0->setPixmap(*spacer0); hold_title->setPixmap(title->scaled(700,40,Qt::KeepAspectRatioByExpanding)); hold_spacer0->setPixmap(*spacer01); //add to layout row0 row0->addWidget(hold_spacer0); row0->addWidget(hold_title); row0->addWidget(hold_spacer01); mainLayout->addLayout(row0); /** Horizontal box for row 1*/ row1= new QHBoxLayout; /** Button which initiates/restarts game*/ start= new QPushButton("Start"); /** Button which pauses/continues game*/ pause = new QPushButton("Pause"); /** quits the game*/ quit = new QPushButton("Quit"); /** Score display*/ name = new QTextEdit("Name"); name->setMaximumHeight(30); name->setMaximumWidth(200); /** level display*/ level = new QLabel("LEVEL: 00"); /** score display*/ score = new QLabel("SCORE: 00"); row1->addWidget(start); row1->addWidget(pause); row1->addWidget(quit); row1->addWidget(name); row1->addWidget(level); row1->addWidget(score); mainLayout->addLayout(row1); /** Horizontal box for row 2*/ row2 = new QHBoxLayout; /** Scene which holds monsters, player and powerups*/ scene = new QGraphicsScene; /** View which holds gameplay*/ view = new GameWindow(scene); row2->addWidget(view); mainLayout->addLayout(row2); /** Horizontal box for row 3*/ row3 = new QHBoxLayout; //left /** IconObject used to display QPixmap */ hold_basicattackicon = new IconObject; /** Ability display icon */ basicattackicon = new QPixmap("basicattack.gif"); /** IconObject used to display QPixmap */ hold_mysticshoticon = new IconObject; /** Ability display icon */ mysticshoticon = new QPixmap("basicattack.gif"); //mysticshoticon->scaledToHeight(64,Qt::FastTransformation); /** IconObject used to display QPixmap */ hold_trueshoticon = new IconObject; /** Ability display icon */ trueshoticon = new QPixmap("trueshot.png"); /** IconObject used to display QPixmap */ hold_spacer1 = new IconObject; /** Used to hold a space */ spacer1 = new QPixmap(400,64); spacer1->fill(color); //midleft /** IconObject used to display QPixmap */ hold_heart = new IconObject; /** Heart Icon */ heart = new QPixmap("heart.gif"); /** Health display */ health = new QLabel("200"); health->setMaximumHeight(25); /** IconObject used to display QPixmap */ hold_spacer2 = new IconObject; /** Used to hold a space */ spacer2 = new QPixmap(64,64); spacer2->fill(color); //midright /** IconObject used to display QPixmap */ hold_potion = new IconObject; /** Mana Icon */ potion = new QPixmap("mana.gif"); /** Mana display */ mana= new QLabel("50"); mana->setMaximumHeight(25); /*Add the Pixmaps to the IconObjects*/ hold_basicattackicon->setPixmap(basicattackicon->scaledToHeight(10)); hold_mysticshoticon->setPixmap(mysticshoticon->scaledToHeight(20)); hold_trueshoticon->setPixmap(trueshoticon->scaled(40,60,Qt::KeepAspectRatioByExpanding)); hold_spacer1->setPixmap(*spacer1); hold_heart->setPixmap(*heart); hold_spacer2->setPixmap(*spacer2); hold_potion->setPixmap(*potion); /* Add IconObjects to row3 */ row3->addWidget(hold_basicattackicon); row3->addWidget(hold_mysticshoticon); row3->addWidget(hold_trueshoticon); row3->addWidget(hold_spacer1); row3->addWidget(hold_heart); row3->addWidget(health); row3->addWidget(hold_spacer2); row3->addWidget(hold_potion); row3->addWidget(mana); /* Add layout to main widget*/ mainLayout->addLayout(row3); // set player //objects.push_back( //set bool variables trueshotfiring = false; inGame = false; gamePaused = false; playerAlive = false; up = false; down = false; left = false; right = false; grabbedignite=false; lostgame=false; //set counters /** Level identifies which level the game is at */ levelff=1; /** Leftclickcounter determines how many times left click is pressed */ leftclickcounter=0; /** Leftclickholdcounter determines how long left click is pressed */ leftclickholdcounter=0; /** Spawn counter for a meleeminoin */ spawnmelee=0; /** Spawn counter for a Siegeminion*/ spawnsiege=0; /** Spawn counter for a Casterminion*/ spawncaster=0; /** Ez can not be hurt immediately at next clock *giving the player time to move out of the way*/ ezhurt=0; /** Points scored*/ points=0; /** Icon spawning at 200*/ iconspawn=0; // set timer timer = new QTimer(this);// timer->start(val) later on in show() //connections connect(start,SIGNAL(clicked()),this,SLOT(clickedStart())); connect(pause,SIGNAL(clicked()),this,SLOT(clickedPause())); connect(view,SIGNAL(leftButtonClicked()),this,SLOT(leftClick())); connect(view,SIGNAL(rightButtonClicked()),this,SLOT(rightClick())); connect(view,SIGNAL(leftButtonHoldStart()),this,SLOT(leftHoldstart())); connect(view,SIGNAL(leftButtonHoldCancel()),this,SLOT(leftHoldcancel())); connect(view,SIGNAL(uparrow()),this,SLOT(moveup())); connect(view,SIGNAL(downarrow()),this,SLOT(movedown())); connect(view,SIGNAL(leftarrow()),this,SLOT(moveleft())); connect(view,SIGNAL(rightarrow()),this,SLOT(moveright())); connect(timer,SIGNAL(timeout()),this,SLOT(handleTimer())); connect(quit,SIGNAL(clicked()),this,SLOT(clickedQuit())); }
void ThumbnailList::forwardRightClick( const KPDFPage * p, const QPoint & t ) { emit rightClick( p, t ); }