SetDialog::SetDialog(QWidget *parent): QDialog(parent) { btnRadioComputer = new QRadioButton("Computer First",this); btnRadioPlayer = new QRadioButton("Player First",this); btnApply = new QPushButton(this); btnRadioComputer->setGeometry(QRect(10,10,140,15)); btnRadioPlayer->setGeometry(QRect(150,10,140,15)); QLabel* diffTxt = new QLabel(this); diffTxt->setText(tr("Difficult Level:")); diffTxt->setGeometry(QRect(10,30,140,15)); difficult = new QSlider(Qt::Horizontal,this); difficult->setGeometry(QRect(130,30,140,15)); difficult->setRange(5,20); difficult->setValue(20); QLabel* sizeTxt = new QLabel(this); sizeTxt->setText(tr("BoardSize:")); sizeTxt->setGeometry(QRect(10,50,140,15)); sizeBox = new QSpinBox(this); sizeBox->setGeometry(QRect(130,50,140,30)); sizeBox->setRange(4,10); sizeBox->setValue(4); btnApply->setGeometry(QRect(10,170, 93, 27)); btnApply->setText(tr("Apply")); this->setGeometry(QRect(10,10,300,300)); QObject::connect(btnRadioComputer,SIGNAL(clicked(bool)),this,SLOT(setComputerFirst())); QObject::connect(btnRadioPlayer,SIGNAL(clicked()),this,SLOT(setPlayerFirst())); QObject::connect(difficult,SIGNAL(valueChanged(int)),this,SLOT(changeDifficultLevel(int))); QObject::connect(sizeBox,SIGNAL(valueChanged(int)),this,SLOT(changeBoardSize(int))); }
void About::aboutInit() { setModal(true); resize(400, 400); setWindowTitle("About"); setWindowIcon(QIcon("icons/backupsoft.png")); QWidget *icon = new QWidget(this); icon->setStyleSheet("background-image: url(icons/backupsoft.png)"); icon->setGeometry(250 , 10, 100, 100); QLabel *title = new QLabel("BackupSoft", this); title->setFont(QFont("Helvetica", 25, 10, false)); title->setGeometry(10, 10, 200, 30); QLabel *version = new QLabel("Copyright 2010 by\nMichael Kohler and Fabian Gammenthaler\n\nVersion: 1.0", this); version->setFont(QFont("Helvetica", 8, 2, false)); version->setGeometry(10, 70, 200, 55); QTextEdit *licence = new QTextEdit(this); licence->setGeometry(10, 160, 380, 230); licence->setReadOnly(true); QFile *file = new QFile("licence.txt"); if (file->open(QIODevice::ReadOnly)) { QTextStream *stream = new QTextStream(file); licence->setText(stream->readAll()); } else { QString errorMsg = "Could not open licence.txt.. Please make sure it is existent and readable."; AlertWindow *alertWin = new AlertWindow("ERROR", "", errorMsg); alertWin->show(); } }
void ProgView::layout() { int maxHeight = 0; for (int i = 0; i < channelBar.size(); i++) { int y = 0; QLabel *chan = channelBar.at(i); int x = getX(i); int width = getKey(CHANNEL_WIDTH).toInt(); int height = chan->heightForWidth(width); if (height > maxHeight) { maxHeight = height; } chan->setGeometry(x, y, width, height); chan->show(); //qDebug() << "x: " << x << "y: " << y; //qDebug() << chan->text(); } CHANNELBAR_HEIGHT.def = maxHeight; setKey(CHANNELBAR_HEIGHT); for (int i = 0; i < timeLine.size(); i++) { int x = 0; QLabel *lab = timeLine.at(i); int y = getY(timeLineDate.value(lab)); lab->setGeometry(x, y, lab->sizeHint().width(), lab->sizeHint().height()); lab->show(); //qDebug() << "x: " << x << "y: " << y; //qDebug() << lab->text(); } }
void menu:: score() { QFile file("D:/Maze_score.txt"); QString r ; r=""; int k=1 ; file.open(QIODevice::ReadOnly | QIODevice::Text); QTextStream flux(&file); while(!flux.atEnd() && k<=5) { QString temp = flux.readLine(); r+="Score"; r+=QString::number(k); r+=" : "; if(temp.toInt()>9) r+=temp; else { r+="0"+temp; } r+="\n"; k++ ; } if(k<=5) { for(int i=k;i<=5;i++) { r+="Score"; r+=QString::number(i); r+=" : 00\n" ; } } file.close(); score_page = new QWidget(); score_page->setFixedSize(320,500); score_page->setWindowTitle("ScoreBoard"); score_page->setWindowIcon(QIcon(":/img/menu_icon.png")); QLabel *bg = new QLabel(score_page); bg->setGeometry(0,0,320,500); QPixmap *bgP = new QPixmap(":/img/scoreboard.png"); bg->setPixmap(*bgP); bg->raise(); QLabel *board = new QLabel(score_page); board->setGeometry(0,250,320,250); QString text=r ; board->setText(text); board->setAlignment(Qt::AlignCenter); board->setFont(QFont("Elephant",20,5,false)); board->setStyleSheet("QLabel {color : white; }"); board->raise(); score_page->show(); }
void newWordManageWindow::insertWord(QString spell, QString meaning) { QDialog *dialog = new QDialog(addDialog); dialog->setWindowTitle("重复"); dialog->resize(200, 110); QLabel *label = new QLabel(dialog); QLabel *labelText = new QLabel(dialog); label->setStyleSheet("background-color:lightblue"); labelText->setAlignment(Qt::AlignCenter); labelText->setGeometry(30, 0, 140, 70); label->setGeometry(0, 0, this->width(), this->height()); QPushButton *yesButton = new QPushButton(dialog); yesButton->setGeometry(140, 70, 55, 20); yesButton->setText("返回"); yesButton->setStyleSheet("color:black"); bool fail = false; if(spell.size()==0) { labelText->setText("单词不能为空!"); fail = true; } else if(meaning.size()==0) { labelText->setText("释义不能为空!"); fail = true; } for(int i=0; i<newWordList.size(); i++) { if(newWordList[i].spell==spell) { labelText->setText("您已经添加过这个生词了!"); } fail = true; break; } if(fail) { dialog->show(); connect(yesButton,SIGNAL(clicked()), dialog, SLOT(close())); } if(!fail) { QDateTime sysTime = QDateTime::currentDateTime(); QStringList list = sysTime.toString("yyyy-MM-dd").split('-'); QString time = list[0]+list[1]+list[2]; NEWWORD newword = { meaning, spell, time }; newWordList.push_front(newword); qDebug() << currentPage << " " << TotalPages; update(); } }
void CreateVmlist::VmFactory() { vmslist.clear(); labels.clear(); QPalette p; p.setColor(QPalette::WindowText,Qt::white); int m = 0; for(int i=0;i < nums_vm;i++,m++) { //QPushButton *btton = new QPushButton(QIcon("./images/a_detailed.png"),Vmgs[i].at(0)+"\nv"+Vmgs[i].at(1)/*+"\n"+Vmgs[i].at(2)*/,this); QPushButton *btton = new QPushButton(this); QLabel *label = new QLabel(this); label->setStyleSheet("font-size:14px"); btton->setFlat(true); btton->setFocusPolicy(Qt::NoFocus); setButtonBackImage(btton,"./images/a_detailed.png",60,60); if((Vmgs[i].at(0)).length() > 13) { QString name = Vmgs[i].at(0); QString name_0 = name.mid(0,13),name_1=name.mid(13,name.length()-13),name_2=""; //if(name_1.length()>8) // {name_2 = name_1.mid(8,name_1.length()-8); // name_1 = name_1.mid(0,8); // } //if(name_2.length() > 0) //label->setText(name_0+"\n "+name_1+"\n "+name_2+"\n\nVDI_"+Vmgs[i].at(1)); //else label->setText(name_0+"\n "+name_1+"\n\nVDI_"+Vmgs[i].at(1)); } else label->setText(Vmgs[i].at(0)+"\n\nVDI_"+Vmgs[i].at(1)); label->setPalette(p); btngp->addButton(btton,i); vmslist.push_back(btton); labels.push_back(label); if(i%6 == 0) { m = 0; } /***********more than 6 ************/ if(nums_vm >= 6) { btton->setGeometry(x()+130*m+lskey,y()+170*(i/6),60,60); label->setGeometry(x()+130*m+lskey,y()+60+170*(i/6),120,60); } else { btton->setGeometry(x()+130*i+lskey,y(),60,60); label->setGeometry(x()+130*i+lskey,y()+60,120,60); } } repaint(); }
void outline(QWidget *baseWidget, int xPos, int yPos, int Pos) { QLabel *outLabel = new QLabel(baseWidget); if(!Pos) outLabel->setGeometry(xPos,yPos,552,20); //Horizontal Borders else outLabel->setGeometry(xPos,yPos,20,512); //Vertical Borders outLabel->setStyleSheet("QLabel { background-color :rgb(170, 170, 127); color : black; }"); }
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint); setGeometry(0, 0, SC_ABOUT_WIDTH, SC_ABOUT_HEIGHT); QPixmap pixmap(SC_ABOUT_IMAGE); setMask(pixmap.mask()); QPalette palette; palette.setBrush(QPalette::Background, pixmap); setPalette(palette); QString qstrVersion = "<span style=\"font-family:" + QString(SC_BOLD_FONT_NAME) + "\">" + tr("stealth") + "<span style=\"color:" + QString(SC_MAIN_COLOR_BLUE) + ";\">" + tr("client") + "</span> " + "<span style=\"color:" + QString(SC_MAIN_COLOR_GREY) + ";\"> V " + QString::fromStdString(FormatVersionNumbers()) + "</span></span>"; QLabel* lblVersion = new QLabel(this); QFont fntVersion = lblVersion->font(); fntVersion.setPixelSize(14); lblVersion->setFont(fntVersion); lblVersion->setAlignment(Qt::AlignCenter); lblVersion->setGeometry(0, 0, 200, 30); lblVersion->move(this->rect().center() - lblVersion->rect().center()); lblVersion->setText(qstrVersion); lblVersion->setStyleSheet("QLabel {color: white;}"); QString qstrCopy = QString::fromUtf8( "\u00A9 2014 AlphabetCoinFund Developers\n" "This is experimental software.\n" "If you don't treat it as such,\n" "you're likely to put an eye out."); QLabel* lblCopy = new QLabel(this); QFont fntCopy = lblCopy->font(); fntCopy.setPixelSize(12); lblCopy->setFont(fntCopy); lblCopy->setAlignment(Qt::AlignCenter); lblCopy->setGeometry(0, 0, 220, 70); QPoint pt = this->rect().center() - lblCopy->rect().center(); lblCopy->move(pt.x(), pt.y() + 60); lblCopy->setText(qstrCopy); // lblCopy->setStyleSheet("QLabel {color: white; background-color: blue;}"); lblCopy->setStyleSheet("QLabel {color: white;}"); move(QApplication::desktop()->screen()->rect().center() - this->rect().center()); }
Conversation::Conversation(const std::string &contact, QWidget *parent) : QWidget(parent), _contact(contact) { _call = false; _first = true; QLabel *name = new QLabel(tr(contact.c_str()), this); _textZone = new QLineEdit(this); _callButton = new QPushButton(this); _callButton->setIcon(QIcon("./gui/img/phone61.png")); _callButton->setIconSize(QSize(120, 120)); QPushButton *sendButton = new QPushButton(tr("Send"), this); _messageZone = new QTextEdit(this); QFont f("Calibri", 10, QFont::Bold); name->setFont(f); _messageZone->setStyleSheet("background-color:white;"); _messageZone->setReadOnly(true); /* Image */ std::stringstream pp; pp << "./gui/img/avatar" << g_PTUser.currentUser().getContactFromName(contact).getPic() << ".png"; QPixmap profilPicture(pp.str().c_str()); QLabel *imgP = new QLabel(this); imgP->setPixmap(profilPicture.scaled(432, 432, Qt::KeepAspectRatio)); /* --- */ int imgHeight = 432; int imgWidth = 432; /* MOVE */ connect(_callButton, SIGNAL(released()), this, SLOT(functionCall())); connect(sendButton, SIGNAL(released()), this, SLOT(functionText())); imgP->setGeometry(0, 0, imgHeight, imgWidth); name->setGeometry(10, imgHeight + 10, 160, 50); _messageZone->setGeometry(imgWidth, 0, 1370, 920); _textZone->setGeometry(imgWidth, 920, 1120, 100); sendButton->setGeometry(1660, 920, 100, 100); _callButton->setGeometry(130, 900, 120, 120); /* --- ¨*/ }
void MainWindow::buildGameUi() { // Create score board QLabel *scoreBoard = new QLabel(); //scoreBoard->setAttribute(Qt::WA_TranslucentBackground); scoreBoard->setAlignment(Qt::AlignCenter); scoreBoard->setText("<font color='white'>SCORE</font>"); QFont *font = new QFont(); font->setPointSizeF(18); font->setBold(true); font->setFamily(QString("Adobe Devanagari")); scoreBoard->setFont(*font); scoreBoard->setGeometry(QRect(20,20,120,30)); scene->addWidget(scoreBoard); otherSceneObjectList.push_back(scoreBoard); // score points scoreBoardPoints = new QLabel(); scoreBoard->setAttribute(Qt::WA_TranslucentBackground); scoreBoardPoints->setNum(this->scorePoint); scoreBoardPoints->setFont(*font); scoreBoardPoints->setGeometry(QRect(200,20,90,30)); scene->addWidget(scoreBoardPoints); otherSceneObjectList.push_back(scoreBoardPoints); // add timer to update connect(&timer, SIGNAL(timeout()), this,SLOT(updateScorePonit())); // Create birdleft board QLabel *birdLeftBoard = new QLabel(); birdLeftBoard->setAttribute(Qt::WA_TranslucentBackground); birdLeftBoard->setAlignment(Qt::AlignCenter); birdLeftBoard->setText("<font color='white'>BIRD LEFT</font>"); birdLeftBoard->setFont(*font); birdLeftBoard->setGeometry(QRect(20,50,150,30)); scene->addWidget(birdLeftBoard); otherSceneObjectList.push_back(birdLeftBoard); // bird left num birdLeftNumbers = new QLabel(); //scoreBoard->setAttribute(Qt::WA_TranslucentBackground); birdLeftNumbers->setNum(this->scorePoint); birdLeftNumbers->setFont(*font); birdLeftNumbers->setGeometry(QRect(200,50,90,30)); scene->addWidget(birdLeftNumbers); otherSceneObjectList.push_back(birdLeftNumbers); // add timer to update connect(&timer, SIGNAL(timeout()), this,SLOT(updateBirdLeft())); }
/*** méthode AJOUT LECTEUR ***/ void Ihm::ajoutLecteur(int numLecteur, int num_vue, int x, int y, ClientConnection *cCL){ //se placer sur le bon onglet QWidget *onglet; onglet = pDynamique->onglet[num_vue]; //test valeur //qDebug() << "valeur pointeur onglet" << onglet << endl; //nouveau label dynamique pour mettre l'image correspondant QLabel *labelL = new QLabel(onglet); //différente taille d'images utilisées if(num_vue == 1){ labelL->setPixmap(QPixmap("ressources/lecteur_actif_petit.jpg")); }else{ labelL->setPixmap(QPixmap("..//lecteur_actif.jpg")); } labelL->setGeometry(x, y, 15, 42); // largeur hauteur à définir //sauvegarde du pointeur du label du lecteur //pDynamique->labelL[num_vue][numLecteur] = labelL; AfficheAlarme *aA = new AfficheAlarme(this, numLecteur); connect(aA, SIGNAL(signalLecteurInactif(int)), this, SLOT(lecteurInactif(int))); //en cas de suppression connect(cCL, SIGNAL(sig_disconnected()), labelL, SLOT(clear())); connect(cCL, SIGNAL(sig_disconnected()), labelL, SLOT(deleteLater())); connect(cCL, SIGNAL(sig_disconnected()), aA, SLOT(lecteurInactif())); }
Menu::Menu(QWidget *parent) : QWidget(parent), ui(new Ui::Menu) { ui->setupUi(this); setWindowFlags(Qt::WindowStaysOnTopHint); setWindowModality(Qt::ApplicationModal); setWindowTitle("Tandem Techies"); setFixedSize(geometry().width(), geometry().height()); QIcon icon(":/images/player.png"); setWindowIcon(icon); QLabel* background = new QLabel(this); QPixmap backgroundImg(":/images/bg.png"); background->setPixmap(backgroundImg); background->setGeometry(0, 0, geometry().width(), geometry().height()); background->setScaledContents(true); background->lower(); background->show(); //Make the logo's background transparent ui->lblLogo->setAttribute(Qt::WA_TranslucentBackground); //Make the menu border invisible setWindowFlags(Qt::MSWindowsFixedSizeDialogHint); setWindowFlags(Qt::CustomizeWindowHint); setWindowFlags(Qt::FramelessWindowHint); }
void MainWindow::loadNewImage(QString pathName) { if(sa == NULL) {return;} FileCentre *fc = FileCentre::GetInstance(); QString path = fc->GetRecordPath(); QDir dir(path); QStringList filter; filter<<"*.png"<<"*.jpg"<<"*.bmp"; dir.setNameFilters(filter); int iNum = dir.count(); if(iNum < 1) {return;} //MyLabel *lb = new MyLabel(mLW, pathName); QLabel *lb = WidgetFactory::GetLabel(mLW, pathName); lb->setGeometry(QRect(10, (iNum-1)*190, 180, 180)); lb->setPixmap(pathName); lb->setScaledContents(true); lb->show(); /* sa->setWidget(mLW); sa->setGeometry(0,0, 210, 820); mLW->setGeometry(0,0,190,190*(iNum+1)); mLW->show(); sa->show(); */ mLW->setGeometry(0,0,190,190*(iNum+1)); }
void accessories(QWidget *baseWidget) { QLabel *player2 = new QLabel(baseWidget); QLabel *name2 = new QLabel("Player 2", baseWidget); QLabel *time2 = new QLabel("00:00:00", baseWidget); QLabel *player1 = new QLabel(baseWidget); QLabel *name1 = new QLabel("Player 1", baseWidget); QLabel *time1 = new QLabel("00:00:00", baseWidget); QLabel *moves = new QLabel(baseWidget); name1->setGeometry(125,610,80,20); time1->setGeometry(120,635,80,20); player1->setGeometry(100,500,100,100); player1->setPixmap(QPixmap(":/Images/profile.png")); name2->setGeometry(125,210,80,20); time2->setGeometry(120,235,80,20); player2->setGeometry(100,100,100,100); player2->setPixmap(QPixmap(":/Images/profile.png")); moves->setGeometry(1000,105,250,550); moves->setStyleSheet("QLabel {background-color: white;}"); }
/** * @brief ventanaIP::ventanaIP * @param parent * Constructor que inicializa las parte grafica de la ventana * e indica los slot apropiados */ ventanaIP::ventanaIP(QWidget *parent){ // Instanciamos los objetos de la GUI de la ventana de comandos. QLabel* fondo = new QLabel(this); QPixmap imagenFondo("/home/diego/Escritorio/CrazyDuckHunt/ClientePrincipal-ServidorSecundario/FondoPrincipal.jpg"); QPixmap imagenButton("/home/diego/Escritorio/CrazyDuckHunt/ClientePrincipal-ServidorSecundario/buttonSolicitarPeticion.png"); QIcon iconoComandos(imagenButton); QPushButton* enviarPeticion = new QPushButton(this); pBarraIP = new QLineEdit("Escriba la IP del servidor", this); pBarraPuerto = new QLineEdit("Escriba el numero de puerto", this); // Definimos caracteristicas de los objetos de la GUI this->resize(imagenFondo.width(),imagenFondo.height()); fondo->setGeometry(0,0,imagenFondo.width(),imagenFondo.height()); fondo->setPixmap(imagenFondo); pBarraIP->setGeometry(100, 100, 300, 50); pBarraPuerto->setGeometry(100, 200, 300, 50); enviarPeticion->setFont(QFont("Times", 18, QFont::Bold)); enviarPeticion->setGeometry(250,270,imagenButton.width(),imagenButton.height()); enviarPeticion->setIcon(iconoComandos); enviarPeticion->setIconSize(imagenButton.rect().size()); // cout << pBarraIP->text().toStdString() << pBarraPuerto->text().toStdString() <<endl; QObject::connect(enviarPeticion, SIGNAL(clicked()), this, SLOT(newVentana())); this->show(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget w; w.resize(500, 500); QLabel *label = new QLabel(&w); label->setGeometry(0, 0, 30, 30); SeekBar *big_seek_bar = new SeekBar(&w); SeekBar *small_seek_bar = new SeekBar(&w); big_seek_bar->setGeometry(0, 40, 500, 32); big_seek_bar->setRange(0, 100); QObject::connect(big_seek_bar, &SeekBar::valueChanged, [label, small_seek_bar](int value) { label->setText(QString::number(value)); small_seek_bar->setValue(value - 10); }); small_seek_bar->setGeometry(30, 280, 300, 20); small_seek_bar->setRange(0, 100); QObject::connect(small_seek_bar, &SeekBar::valueChanged, [label, big_seek_bar](int value) { label->setText(QString::number(value)); big_seek_bar->setValue(value); }); QTimer::singleShot(3000, [big_seek_bar] { big_seek_bar->resize(200, 15); }); w.show(); return a.exec(); }
void BGDialog::slotIdentifyScreens() { // Taken from PositionTab::showIdentify in kdebase/kcontrol/kicker/positiontab_impl.cpp for (unsigned s = 0; s < m_numScreens; s++) { QLabel *screenLabel = new QLabel(0, Qt::X11BypassWindowManagerHint); screenLabel->setObjectName("Screen Identify"); QFont identifyFont(KGlobalSettings::generalFont()); identifyFont.setPixelSize(100); screenLabel->setFont(identifyFont); screenLabel->setFrameStyle(QFrame::Panel); screenLabel->setFrameShadow(QFrame::Plain); screenLabel->setAlignment(Qt::AlignCenter); screenLabel->setNum(int(s + 1)); // BUGLET: we should not allow the identification to be entered again // until the timer fires. QTimer::singleShot(1500, screenLabel, SLOT(deleteLater())); QPoint screenCenter(QApplication::desktop()->screenGeometry(s).center()); QRect targetGeometry(QPoint(0, 0), screenLabel->sizeHint()); targetGeometry.moveCenter(screenCenter); screenLabel->setGeometry(targetGeometry); screenLabel->show(); } }
void MainWindow ::retrievElements(QDomElement root, QString tag, QString att) { QDomNodeList nodes = root.elementsByTagName(tag); QGridLayout *layout = new QGridLayout (this); qDebug() << "# nodes = " << nodes.count(); for(int i = 0; i < nodes.count(); i++) { QDomNode elm = nodes.at(i); if(elm.isElement()) { QDomElement e = elm.toElement(); QStringList allAttrs = att.split("+"); for(int k=0;k<allAttrs.length();k++) { qDebug() << e.attribute(allAttrs[k]); QLabel *l = new QLabel(this); l->setText(e.attribute(allAttrs[k])); l->setStyleSheet("QLabel {color : blue; }"); QFont f( "Arial", 10, QFont::Bold); l->setGeometry(0,0,500,60); l->setFont(f); l->setMaximumHeight(50); layout->addWidget(l,i,k); } } } show(); }
void accessories(QWidget *baseWidget) { QLabel *player2 = new QLabel(baseWidget); QLabel *name2 = new QLabel("Player 2", baseWidget); QLabel *time2 = new QLabel("00:00:00", baseWidget); QLabel *player1 = new QLabel(baseWidget); QLabel *name1 = new QLabel("Player 1", baseWidget); QLabel *time1 = new QLabel("00:00:00", baseWidget); QLabel *moves = new QLabel(baseWidget); name1->setGeometry(120,610,60,20); name1->setStyleSheet("background:rgb(211, 211, 158);"); time1->setGeometry(120,635,60,20); time1->setStyleSheet("background:rgb(211, 211, 158);"); player1->setGeometry(100,500,100,100); player1->setPixmap(QPixmap(":/Images/profile.png")); name2->setGeometry(120,210,60,20); name2->setStyleSheet("background:rgb(211, 211, 158);"); time2->setGeometry(120,235,60,20); time2->setStyleSheet("background:rgb(211, 211, 158);"); player2->setGeometry(100,100,100,100); player2->setPixmap(QPixmap(":/Images/profile.png")); moves->setGeometry(900,100,400,550); moves->setStyleSheet("background: rgb(211, 211, 158);"); }
// elaborazione dei dati: // creazione dell'interfaccia grafica per l'arrivo su di una // casella in cui e` necessario PAGARE qualcuno void PopUp::initPaga(const QString &NomeCasella, int DindiniDaPagare, Giocatore *g) { QString text = "\"Il pedaggio e` il pedaggio, e il formaggio e` il formaggio\ne se tu non paghi il pedaggio, io non mangio formaggio\" by Little John\n\nHEI! Ti trovi in " + NomeCasella; // se su e` su una casella Edificabile if(g) { text.append("\n\nche per tua sfortuna e` una proprieta` privata...\ninsomma: devi pagare " + num2string(DindiniDaPagare) + " succulente Ghiande!\nNon disperare...tutte queste prelibatezze verranno devolute\ned andranno ad ingrassare le finanze di " + string2QString(g->getNomeGiocatore())); } // se si e` su una casella Non Edificabile else { text.append("\n\ne sfortunatamente per te che hai voglia di posare le tue zampette un po' ovunque\ndovrai pagare un'ammenda di " + num2string(DindiniDaPagare) + " Ghiande\n...insomma, e` per il bene di tutti: la Banca e la Societa` si augurano che capiate\n...e che magari passiate ancora!"); } QLabel *info = new QLabel(text, this); info->setGeometry(15, 60, 595, 200); info->setAlignment(Qt::AlignCenter); QPushButton *paga = new QPushButton(tr("PAGA"), this); paga->setFont(QFont("Verdana", 15, QFont::Bold)); paga->setGeometry(192, 260, 241, 45); connect(paga, SIGNAL(clicked()), this, SLOT(setPagamento())); // setPagamento chiama slot::close() return; }
// elaborazione dei dati: // creazione dell'interfaccia grafica per l'arrivo su di una // casella in cui e` possibile variare l'IPOTECA dell'albergo void PopUp::initIpot(const QString &NomeCasella, int ipotecaAttuale, int ipotecaMinima, int costoAlbergo) { QString text = "HEI! Ti trovi in " + NomeCasella + "\n\nGuardandoti attorno probabilmente noterai che il posto non ti e` completamente\nestraneo, anzi: il terreno e l'albergo sono proprio tuoi!!! Anzi...dovresti essere\nproprio tronfio d'orgoglio per aver fatto una simile speculazione edilizia,\ncotanta avidita` e brutalita` su un tanto bel territorio.\nMamma Natura ne chiedera` il prezzo un giorno: e pure tu ne dovrai rispondere!!!\nAnche se, ora come ora, la Magnificentissima e Rigogliosissima Banca delle Ghiande,\nben piu` pressante di Mamma Natura, Vi informa che e` disponibilissima a modificare\nil tasso di ipoteca sul Vostro albergo, sempre che Voi lo vogliate..."; BarraIpoteca *ipoteca = new BarraIpoteca(ipotecaAttuale, ipotecaMinima, costoAlbergo, this); ipoteca->setGeometry(15, 60, 595, 330); ipoteca->hide(); connect(ipoteca, SIGNAL(aggiornaIpoteca(int)), this, SLOT(setVariazioneIpoteca(int))); // setIpoteca CHIAMA slot:close() QPushButton *fatto = new QPushButton(tr("FATTO"), this); fatto->setFont(QFont("Verdana", 15, QFont::DemiBold)); fatto->setGeometry(192, 310, 241, 35); connect(fatto, SIGNAL(clicked()), this, SLOT(setNulla())); QLabel *label = new QLabel(text, this); label->setAlignment(Qt::AlignCenter); label->setGeometry(15, 60, 595, 200); QPushButton *mostraIpoteca = new QPushButton(tr("OPZIONI IPOTECA"), this); mostraIpoteca->setFont(QFont("Verdana", 15, QFont::DemiBold)); mostraIpoteca->setGeometry(192, 260, 241, 45); connect(mostraIpoteca, SIGNAL(clicked()), mostraIpoteca, SLOT(hide())); connect(mostraIpoteca, SIGNAL(clicked()), label, SLOT(hide())); connect(mostraIpoteca, SIGNAL(clicked()), ipoteca, SLOT(show())); return; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QMovie *mov = new QMovie(":/img/pics/start.gif"); QLabel *label = new QLabel("",0); label->setGeometry(450,200,500,300); label->setMovie(mov); mov->start(); label->setWindowFlags(Qt::FramelessWindowHint); label->show(); QTime t; t.start(); while(t.elapsed() < 1500) { a.processEvents(); } MainWindow w; w.show(); w.move((QApplication::desktop()->width()-w.width())/2,(QApplication::desktop()->height()-w.height())/2); label->close(); return a.exec(); }
void MusicProgressWidget::initWidget() { m_background = new QLabel(this); m_background->setGeometry(20, 20, 360, 115); QWidget *backgroundMask = new QWidget(this); backgroundMask->setGeometry(20, 45, 360, 90); backgroundMask->setStyleSheet("background:rgba(255,255,255,200);"); QLabel *topTitleName = new QLabel(this); topTitleName->setText(tr("Progress Bar")); topTitleName->setGeometry(30, 20, 221, 25); topTitleName->setStyleSheet("color:#FFFFFF;font-weight:bold;"); QToolButton *topTitleCloseButton = new QToolButton(this); topTitleCloseButton->setGeometry(360, 22, 20, 20); topTitleCloseButton->setIcon(QIcon(":/share/searchclosed")); topTitleCloseButton->setStyleSheet(MusicUIObject::MToolButtonStyle03); topTitleCloseButton->setEnabled(false); m_progressBar = new QProgressBar(this); setBar(m_progressBar); m_progressBar->setStyleSheet(MusicUIObject::MProgressBar01); m_textLabel = new QLabel(this); m_textLabel->setAlignment(Qt::AlignCenter); m_textLabel->setGeometry(40, 50, 320, 25); }
void ViewHelpMenu::showLicense() { QDialog b(this,Qt::Tool); b.setModal(true); QPixmap logo = ViewerIcon::getPixmap( "gnu.png"); QLabel * llogo = new QLabel(&b); llogo->setGeometry(QRect(QPoint(0,0),logo.size())); llogo->setPixmap(logo); b.setMinimumSize(QSize(logo.width()*4,logo.height())); b.setWindowTitle("License"); QTextBrowser * lictext = new QTextBrowser(&b); QFont f("Courrier", 8); lictext->setFont( f ); lictext->setGeometry(QRect(logo.width(),0,logo.width()*3,logo.height())); // lictext->setHScrollBarMode(QScrollView::AlwaysOff); lictext->setLineWidth(0); /* QPalette pal = lictext->palette(); QColorGroup c = pal.active(); c.setColor(QColorGroup::Background,QColor(255,255,255)); pal.setActive(c); lictext->setPalette(pal);*/ QString copyright((TOOLS(getPlantGLDir())+"/share/plantgl/LICENSE").c_str()); if(QFileInfo(copyright).exists() ) lictext->setSource(copyright); QSize s = qApp->desktop()->size(); s = s - b.size(); s /= 2; b.move(s.width(),s.height()); b.exec(); }
void LoginWidget::refreshUI() { _buttons = new QDialogButtonBox(this); _editUsername = new QLineEdit(this); QPixmap pix("./gui/img/spyke_blue.png"); QLabel *logo = new QLabel(this); logo->setPixmap(pix.scaled(100, 100, Qt::KeepAspectRatio)); _editPassword = new QLineEdit(this); _editPassword->setEchoMode(QLineEdit::Password); _editIp = new QLineEdit(this); _editIp->setText(tr("51.254.139.53:4040")); logo->setGeometry(387, -75, 250, 250); _mainLayout->addWidget(_editUsername, 0, 0); _mainLayout->addWidget(_editPassword, 1, 0); _mainLayout->addWidget(_editIp, 2, 0); _editIp->hide(); this->displayButton(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget window; QLabel *label = new QLabel(QApplication::translate("windowlayout", "Scale:"),&window); QCheckBox *chb = new QCheckBox(QApplication::translate("windowlayout", "Calc mode"),&window); mle *myline = new mle(&window); render widget(&window); QPainter painter; QSlider *spinbox = new QSlider(Qt::Horizontal,&window); spinbox->setValue(30); widget.setGeometry(10,10, 512, 512); myline->setGeometry(10,532,512,20); myline->setText("Enter expession"); myline->createStandardContextMenu(); myline->selectAll(); label->setGeometry(532,10,200,20); chb->move(532,535); spinbox->setGeometry(567,10,165,20); spinbox->setRange(1, 200); //Святое место определения механизма сигналов и слотов, унёсший 8 дней практики на реализацию передачи значений между экземплярами класса //изменять с осторожностью и благословлением, церковная зона QObject::connect(spinbox, SIGNAL(valueChanged(int)), &widget, SLOT(scale(int))); QObject::connect(spinbox, SIGNAL(valueChanged(int)), myline, SLOT(emitsig())); QObject::connect(myline, SIGNAL(returnPressed()), myline, SLOT(emitsig())); QObject::connect(myline, SIGNAL(givechar(QString)), &widget, SLOT(calc(QString))); QObject::connect(chb, SIGNAL(stateChanged(int)), &widget, SLOT(chk(int))); QObject::connect(&widget, SIGNAL(emitstr(QString)), myline, SLOT(takestr(QString))); //конец защищенной церковной зоны window.setWindowTitle( QApplication::translate("GCPLOT", "GCPLOT")); window.setFixedSize(742, 562); window.show(); return app.exec(); }
LivePanel::LivePanel(QWidget *parent) : QWidget(parent) { QVBoxLayout *vboxLayout = new QVBoxLayout(this); vboxLayout->setSpacing(0); vboxLayout->setMargin(0); splitter = new QSplitter(this); splitter->setOrientation(Qt::Vertical); splitter->setOpaqueResize(false); vboxLayout->addWidget(splitter); QListView *listView = new QListView(splitter); //listView1->setSizePolicy(* new QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum)); //listView1->setGeometry(0,0,400,300); QFrame *frame = new QFrame(splitter); frame->setStyleSheet("background-color:white"); //QMessageBox::about(this,QString::number(frame1->width()),""); //frame1->resize(frame1->width(),frame1->width()*3/4); frame->resize(256,192); //frame1->setFrameStyle(QFrame::Raised); QLabel *label = new QLabel(frame); label->setGeometry(10,10,400,300); label->setFrameStyle(QFrame::Box); label->setStyleSheet("background-color:green"); label->setText("<html><head><body><center><h1>上山打老虎 1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br><h1></center></body></html>"); }
CuriousCat::CuriousCat(QWidget *parent) { setX(128); setY(450); setW(192); setH(192); setType("CuriousCat"); //jumpSpeed = 100; //gravity = 0; height = 0; speed = 200; isClimbing = false; isFalling = false; isLanded = true; counter = 0; catMovie = new QMovie(":/cat.gif"); cat = new QLabel(parent); cat->setMovie(catMovie); catMovie->start(); cat->setGeometry(128,450, 192, 192); cat->setScaledContents(true); cat->show(); QLabel * mouthSensor = new QLabel(parent); mouthSensor->setGeometry(mouthX, mouthY, sensorW, sensorH); catSensors.push_back(mouthSensor); QLabel * frontPawSensor = new QLabel(parent); frontPawSensor->setGeometry(frontPawX,frontPawY, sensorW,sensorH); catSensors.push_back(frontPawSensor); QLabel * backPawSensor = new QLabel(parent); backPawSensor->setGeometry(frontPawX - 75, frontPawY, sensorW, sensorH); catSensors.push_back(backPawSensor); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); int size = 10; int x0 = 250; int y0 = 250; int radius = 200; qreal k = 3.1415926535/180; for(int i=0;i<360;i++) { map[i] = 999999; QLabel *l = new QLabel(ui->frame); l->setText("."); //l->setStyleSheet("background:gray;border-radius:5px"); int x = x0 + radius * qCos(i * k); int y = y0 + radius * qSin(i * k); l->setGeometry(x, y, size, size); points[i] = l; } QLabel *center = new QLabel(ui->frame); center->setStyleSheet("background:green;border-radius:5px"); center->setGeometry(x0, y0, size, size); Lidar *reader = new Lidar(); MockLidar *lidar = new MockLidar(); connect(reader, SIGNAL(data(int,int, int,int, int, int)), lidar, SLOT(data(int,int,int,int,int,int))); connect(lidar, SIGNAL(point(int,int)), this, SLOT(point(int,int))); QTimer::singleShot(0, lidar, SLOT(start())); QTimer::singleShot(0, this, SLOT(display())); /*** * * Use start_from_serial() to read data from serial port (lidar) * User start_from_file() to read data from binary file * ***/ //QTimer::singleShot(0, reader, SLOT(start_from_file())); QTimer::singleShot(0, reader, SLOT(start_from_serial())); }
MapSettingsWindow::MapSettingsWindow(QWidget *parent) : QMainWindow(parent), m_pqcdColorPicker(0) { this->resize(220, 0); m_pqsbWidthSpinBox = new QSpinBox(this); m_pqsbWidthSpinBox->setGeometry(20, 20, 75, 25); m_pqsbWidthSpinBox->setMinimum(1); m_pqsbWidthSpinBox->setMaximum(std::numeric_limits<int>::max()); m_pqsbWidthSpinBox->show(); std::cout << std::numeric_limits<int>::max() << std::endl; m_pqsbHeightSpinBox = new QSpinBox(this); m_pqsbHeightSpinBox->setGeometry(125, 20, 75, 25); m_pqsbHeightSpinBox->setMinimum(1); m_pqsbHeightSpinBox->setMaximum(std::numeric_limits<int>::max()); m_pqsbHeightSpinBox->show(); m_pqlblProductLabel = new QLabel(this); m_pqlblProductLabel->setGeometry(107, 20, 10, 25); m_pqlblProductLabel->setStyleSheet("color: rgb(255, 255, 255);"); m_pqlblProductLabel->setText("x"); m_pqlblProductLabel->show(); int iY = 60; for(int iIndex = 0; iIndex < 4; iIndex++) { QLabel *pqlblStateName = new QLabel(this); pqlblStateName->setGeometry(20, iY, 120, 25); pqlblStateName->setStyleSheet("color: rgb(255, 255, 255);"); pqlblStateName->setText(Globals::getInstance().m_rqstStateNames[iIndex] + ":"); pqlblStateName->show(); QPushButton *pqfColorPickerButton = new QPushButton(this); pqfColorPickerButton->setFlat(true); pqfColorPickerButton->setGeometry(size().width() - 36, iY + 5, 16, 16); pqfColorPickerButton->show(); pqfColorPickerButton->setStyleSheet("QPushButton:flat { border: 1px solid white; background-color: " + Globals::getInstance().m_rqcColors[iIndex].name() + "; }"); pqfColorPickerButton->show(); connect(pqfColorPickerButton, &QPushButton::clicked, this, [=]() { changeColor(iIndex, pqfColorPickerButton); }); iY += 40; } this->resize(220, iY + 65); m_pqpbApplyButton = new QPushButton(this); m_pqpbApplyButton->setGeometry(20, size().height() - 40, 180, 25); this->move((QApplication::desktop()->width() - this->size().width()) / 2, (QApplication::desktop()->height() - this->size().height()) / 2); connect(m_pqpbApplyButton, SIGNAL(clicked()), this, SLOT(applyButtonClickEvent())); m_pqpbApplyButton->setText("Anwenden"); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(repaint())); timer->start(500); }