void MTContactDetails::on_btnAddressAdd_clicked()
{
    QObject * pqobjSender = QObject::sender();

    if (NULL != pqobjSender)
    {
        QPushButton * pBtnAdd = dynamic_cast<QPushButton *>(pqobjSender);

        if (m_pAddresses && (NULL != pBtnAdd))
        {
            QVariant    varContactID   = pBtnAdd->property("contactid");
            QVariant    varMethodCombo = pBtnAdd->property("methodcombo");
            QVariant    varAddressEdit = pBtnAdd->property("addressedit");
            int         nContactID     = varContactID.toInt();
            QComboBox * pCombo         = VPtr<QComboBox>::asPtr(varMethodCombo);
            QLineEdit * pAddressEdit   = VPtr<QLineEdit>::asPtr(varAddressEdit);
            QWidget   * pWidget        = VPtr<QWidget>::asPtr(pBtnAdd->property("methodwidget"));

            if ((nContactID > 0) && (NULL != pCombo) && (NULL != pAddressEdit) && (NULL != pWidget))
            {
                QString qstrMethodType  = QString("");
                QString qstrAddress     = QString("");
                // --------------------------------------------------
                if (pCombo->currentIndex() < 0)
                    return;
                // --------------------------------------------------
                QVariant varMethodType = pCombo->itemData(pCombo->currentIndex());
                qstrMethodType = varMethodType.toString();

                if (qstrMethodType.isEmpty())
                    return;
                // --------------------------------------------------
                qstrAddress = pAddressEdit->text();

                if (qstrAddress.isEmpty())
                    return;
                // --------------------------------------------------
                bool bAdded = MTContactHandler::getInstance()->AddMsgAddressToContact(nContactID, qstrMethodType, qstrAddress);

                if (bAdded) // Let's add it to the GUI, too, then.
                {
                    QString qstrTypeDisplay = pCombo->currentText();
                    // --------------------------------------------------
                    QLayout     * pLayout = m_pAddresses->layout();
                    QVBoxLayout * pVBox   = (NULL == pLayout) ? NULL : dynamic_cast<QVBoxLayout *>(pLayout);

                    if (NULL != pVBox)
                    {
                        QWidget * pNewWidget = this->createSingleAddressWidget(nContactID, qstrMethodType, qstrTypeDisplay, qstrAddress);

                        if (NULL != pNewWidget)
                            pVBox->insertWidget(pVBox->count()-1, pNewWidget);
                    }
                }
            }
        }
    }
}
示例#2
0
//-------------------------------------------------------------------------
void SetupDialog::fontColorButtonClicked()
{
	QPushButton * button = (QPushButton *)sender();
	mColorDialog->disconnect();
	mColorDialog->setCurrentColor (button->property( BUTTON_COLOR ).value<QColor>());
	connect( mColorDialog , SIGNAL( currentColorChanged(const QColor&)) , this , SLOT( fontColorChanged(const QColor&) ) );	
	mColorDialog->setProperty( DIALOG_ELEMENT_ID , button->property( SYNTAX_ELT_ID ).toInt() );
	mColorDialog->open();
	if (mColorDialog->result() == QDialog::Rejected) {
	}
}
示例#3
0
void ResourceManager::uninstallExtension()
      {
      QPushButton* uninstallButton = static_cast<QPushButton*>(sender());
      QString extensionId = uninstallButton->property("extensionId").toString();
      if (mscore->uninstallExtension(extensionId)) {
            // find uninstall button and make it visible
            int rowId = uninstallButton->property("rowId").toInt();
            QPushButton* installButton = static_cast<QPushButton*>(extensionsTable->indexWidget(extensionsTable->model()->index(rowId, 3)));
            installButton->setText("Install");
            installButton->setDisabled(false);
            uninstallButton->setDisabled(true);
            }
      }
void BiLiTextSourcePropertyDlg::mSltColorChangeBtn() {

	QPushButton *btn = qobject_cast<QPushButton *>(sender());

	int64_t colorVal = btn->property("color1ColorInt64").toLongLong();

	QColor color1Color = color_from_int(colorVal);

	QColorDialog::ColorDialogOptions options = QColorDialog::ShowAlphaChannel;
#ifdef __APPLE__
		options |= QColorDialog::DontUseNativeDialog;
#endif
	color1Color = QColorDialog::getColor(color1Color, this, tr("Select color"), options);
	if (!color1Color.isValid())
		return;


	colorVal = color_to_int(color1Color);
	//set alpha = 255,强制去除透明
	//color1Val |= 0xff000000;
	btn->setProperty("color1ColorInt64", colorVal);
	SetPushButtonBackgroundColor(btn, colorVal);

	mChangeEvnetFilter->OnChanged();
}
void LayoutAliasEditDialog::deleteAlias() {

    QPushButton * src = (QPushButton *) sender();

    Alias * currAlias = (Alias *) src->property("ptr").value<void *>();
    QHBoxLayout * aliasLayout = (QHBoxLayout *) src->property("layout").value<void *>();

    for (uint i = 0; i < srcNineMLLayout->AliasList.size(); ++i) {
        if (srcNineMLLayout->AliasList[i] == currAlias) {
            srcNineMLLayout->AliasList.erase(srcNineMLLayout->AliasList.begin()+i, srcNineMLLayout->AliasList.begin()+i+1);
            recursiveDeleteLater2(aliasLayout);
            return;
        }
    }

}
示例#6
0
void IconOptions::onSetFile() {
  QPushButton * btn = qobject_cast<QPushButton *>(sender());
  QString sid =  btn->property("SID").toString();
  QLineEdit * edit = this->findChild<QLineEdit *>(sid);
  if (! edit ) {
    return;
  }
  QString d = m_directory->text();
  QString p = getLexicon()->getResourceFilePath(Lexicon::Image);
  QString imagedirectory = p;
  if (! d.isEmpty()) {
    QFileInfo fi(p,d);
    if (fi.isDir()) {
      imagedirectory = fi.absoluteFilePath();
    }
  }
  QString fileName = QFileDialog::getOpenFileName(this,
            tr("Open Image"),imagedirectory , tr("Image Files (*.*)"));


  QDir id(imagedirectory);

  if (! fileName.isEmpty()) {
    edit->setText(id.relativeFilePath(fileName));
  }
 setIconFromField(edit,sid);
}
示例#7
0
void FormJqgzcs::valeChanged(QWidget *obj){
    QSpinBox *spinbox = qobject_cast<QSpinBox *>(obj);
    if(spinbox){
        int val = spinbox->value();
        int index = spinbox->property("index").toInt();
        param->setData(QParam::SpaItemHd_Jqgzcs,index,val);
        if(14==index)
            pcomm->yajiaoTest(Md::POSFRONT,4,val);
        if(15==index)
            pcomm->yajiaoTest(Md::POSREAR,4,val);
        return;
    }
    QDoubleSpinBox *doublespinbox = qobject_cast<QDoubleSpinBox *>(obj);
    if(doublespinbox){
        int val =doublespinbox->value()*10;
        int index = doublespinbox->property("index").toInt();
        param->setData(QParam::SpaItemHd_Jqgzcs,index,val);
        return;
    }
    QPushButton *pushbutton = qobject_cast<QPushButton *>(obj);
    if(pushbutton){
        int val =pushbutton->isChecked();
        int index = pushbutton->property("index").toInt();
        param->setData(QParam::SpaItemHd_Jqgzcs,index,val);
        return;
    }
}
示例#8
0
void ParamsList::slotEditItem()
{
    QPushButton *btn = static_cast<QPushButton *>(sender());
    QString name, value;
    QTreeWidgetItem *item = NULL;
    if( btn->property("add").isNull() ) {
        item = currentItem();
        if( item != NULL ) {
            name = item->text(0);
            value = item->text(1);
        }
    }

    EditDlgImpl *dlg = new EditDlgImpl(this);
    dlg->setName(name);
    dlg->setValue(value);

    dlg->exec();

    name = dlg->getName();
    value = dlg->getValue();
    int res = dlg->result();
    delete dlg;

    if( res == QDialog::Rejected ) {
        return;
    }

    if( item == NULL ) {
        item = new QTreeWidgetItem(this);
    }

    item->setText(0, name);
    item->setText(1, value);
}
void UpdateCheckerDialog::downloadUpdate()
{
	QPushButton *button = qobject_cast<QPushButton*>(sender());

	if (button)
	{
		QVariant updateInfo = button->property("downloadInfo");

		if (!updateInfo.isNull())
		{
			for (int i = 0; i < m_ui->gridLayout->count(); ++i)
			{
				m_ui->gridLayout->itemAt(i)->widget()->setVisible(false);
				m_ui->gridLayout->itemAt(i)->widget()->deleteLater();
			}

			m_ui->label->setText(tr("Downloading:"));
			m_ui->progressBar->setRange(0, 100);
			m_ui->progressBar->show();
			m_ui->buttonBox->setDisabled(true);

			Updater *updater = new Updater(updateInfo.value<UpdateInformation>(), this);

			connect(updater, SIGNAL(progress(int)), this, SLOT(updateProgress(int)));
			connect(updater, SIGNAL(finished(bool)), this, SLOT(transferFinished(bool)));
		}
	}
}
示例#10
0
void FormXtcs::valeChanged(QWidget *obj){
    QSpinBox *spinbox = qobject_cast<QSpinBox *>(obj);
    if(spinbox){
        int val = spinbox->value();
        int index = spinbox->property("index").toInt();
        param->setData(QParam::SpaItemHd_Xtcs,index,val,FALSE);
        if((index == 11)||(index ==12))
            param->updataPivotal();
        if(14==index)
            pcomm->yajiaoTest(Md::POSFRONT,3,val); //shengke buchang
        if(15==index)
            pcomm->yajiaoTest(Md::POSREAR,3,val);  //shengke buchang
        return;
    }
    QDoubleSpinBox *doublespinbox = qobject_cast<QDoubleSpinBox *>(obj);
    if(doublespinbox){
        int val =qRound(doublespinbox->value()*10);
        int index = doublespinbox->property("index").toInt();
        param->setData(QParam::SpaItemHd_Xtcs,index,val,FALSE);
        if(index==5)
            param->updataPivotal();
        return;
    }
    QPushButton *pushbutton = qobject_cast<QPushButton *>(obj);
    if(pushbutton){
        int val =pushbutton->isChecked();
        int index = pushbutton->property("index").toInt();
        param->setData(QParam::SpaItemHd_Xtcs,index,val,FALSE);
        return;
    }

}
示例#11
0
void ScheduleScreen::disableRow(bool checked)
{
    QPushButton* button = dynamic_cast<QPushButton* >(this->sender());
    int index = button->property("dayNumber").toInt()*4;

    // display only those points that are requested by weekday check boxes
    if(checked) {
        //enable all points in the row
        for(int a = 0;a<4;a++)
        {
            pointList.at(index+a)->setDisabled(false);

            //check each point in the column, if one is selected then select this one and break
            for(int b=0;b<7;b++)
                if(pointList.at(a +4*b)->selected())
                {
                    pointList.at(index+a)->setSelected(true);
                    break;
                }
        }
        button->setStyleSheet("");
    }
    else
    {
        for(int a = 0;a<4;a++)
            pointList.at(index+a)->setDisabled(true);
        button->setStyleSheet("color:#CCCCCC");
    }

    return;

}
示例#12
0
void LabCanvas::pickRenderTechnique() {
    QPushButton* push = (QPushButton*)QObject::sender();
    m_renderTechnique = (RenderTechnique)push->property("data").toInt();
    std::cout << "Picked render technique: " << m_renderTechnique << std::endl;
    applyRenderSettings();
    repaint();
}
示例#13
0
void ResourceManager::downloadExtension()
      {
      QPushButton* button = static_cast<QPushButton*>(sender());
      QString path  = button->property("path").toString();
      QString hash = button->property("hash").toString();
      button->setText(tr("Updating"));
      button->setDisabled(true);
      QString baseAddress = baseAddr() + path;
      DownloadUtils dl(this);
      dl.setTarget(baseAddress);
      QString localPath = QDir::tempPath() + "/" + path.split('/')[1];
      QFile::remove(localPath);
      dl.setLocalFile(localPath);
      dl.download(true);
      bool saveFileRes = dl.saveFile();
      bool verifyFileRes = saveFileRes && verifyFile(localPath, hash);
      if(!verifyFileRes) {
            QFile::remove(localPath);
            button->setText(tr("Failed, try again"));
            button->setEnabled(true);

            QMessageBox msgBox;
            msgBox.setStandardButtons(QMessageBox::Ok);
            msgBox.setTextFormat(Qt::RichText);
            msgBox.setWindowTitle(tr("Extensions Installation Failed"));
            if (!saveFileRes) //failed to save file on disk
                  msgBox.setText(tr("Unable to save the extension file on disk"));
            else //failed to verify package, so size or hash sum is incorrect
                  msgBox.setText(tr("Unable to download, save and verify the package.\nCheck your internet connection."));
            msgBox.exec();
            }
      else {
            bool result = mscore->importExtension(localPath);
            if (result) {
                  QFile::remove(localPath);
                  button->setText(tr("Updated"));
                  // find uninstall button and make it visible
                  int rowId = button->property("rowId").toInt();
                  QPushButton* uninstallButton = static_cast<QPushButton*>(extensionsTable->indexWidget(extensionsTable->model()->index(rowId, 4)));
                  uninstallButton->setDisabled(false);
                  }
            else {
                  button->setText(tr("Failed, try again"));
                  button->setEnabled(1);
                  }
            }
      }
示例#14
0
void Widget::FanSettingHandler()
{
    QPushButton *button = (QPushButton *)sender();

    if( button->property("name").toString() == "auto" )
    {
        qDebug() << "auto pressed";
        fanstate = "auto";
        ui->autoButton->setFocus(Qt::OtherFocusReason);
    }
    else if(button->property("name").toString() == "high")
    {
        qDebug() << "high pressed";
        fanstate = "high";
    }
    else if(button->property("name").toString() == "low")
    {
        qDebug() << "low pressed";
        fanstate = "low";
    }
    else if(button->property("name").toString() == "off")
    {
        qDebug() << "off pressed";
        fanstate = "off";
    }
    if (fanstate == "auto")
    {
        ui->autoButton->setFocus(Qt::OtherFocusReason);
    }
    else if (fanstate == "high")
    {
        ui->highButton->setFocus(Qt::OtherFocusReason);
    }
    else if (fanstate == "low")
    {
        ui->lowButton->setFocus(Qt::OtherFocusReason);
    }
    else if (fanstate == "off")
    {
        ui->offButton->setFocus(Qt::OtherFocusReason);
    }

    qDebug() << "in FanSettingHandler and state is : " << fanstate;

}
示例#15
0
void ConfigTabAppearance::updateFontButtons()
{
    if ( !isVisible() )
        return;

    const int iconExtent = pointsToPixels(12);
    const QSize iconSize(iconExtent * 2, iconExtent);

    const auto ratio = ui->scrollAreaTheme->devicePixelRatio();
    QPixmap pix(iconSize * ratio);
    pix.setDevicePixelRatio(ratio);

    const QRect textRect( QPoint(0, 0), iconSize );

    const QRegExp re("^pushButton(.*)Font$");
    QList<QPushButton *> buttons = ui->scrollAreaTheme->findChildren<QPushButton *>(re);

    for (auto button : buttons) {
        if ( re.indexIn(button->objectName()) == -1 )
            Q_ASSERT(false);

        const QString colorButtonName = "pushButtonColor" + re.cap(1);

        QPushButton *buttonFg = ui->scrollAreaTheme->findChild<QPushButton *>(colorButtonName + "Fg");
        QColor colorFg = (buttonFg == nullptr) ? m_theme.color("fg")
                                            : evalColor( buttonFg->property("VALUE").toString(), m_theme );

        QPushButton *buttonBg = ui->scrollAreaTheme->findChild<QPushButton *>(colorButtonName + "Bg");
        QColor colorBg = (buttonBg == nullptr) ? m_theme.color("bg")
                                            : evalColor( buttonBg->property("VALUE").toString(), m_theme );

        pix.fill(colorBg);

        QPainter painter(&pix);
        painter.setPen(colorFg);

        QFont font = m_theme.themeFontFromString( button->property("VALUE").toString() );
        painter.setFont(font);
        painter.drawText( textRect, Qt::AlignCenter,
                          tr("Abc", "Preview text for font settings in appearance dialog") );

        button->setIcon(pix);
        button->setIconSize(iconSize);
    }
}
示例#16
0
void MainWindow::drawPath() {
    QPushButton* b = qobject_cast<QPushButton *>(sender());

    int index = b->property("index").toInt();

    qDebug() << "DRAW PATH!!!" << index;

    ui->mapWidget->drawPath(vvPaths.at(index));
}
示例#17
0
void CustomFunctionsPanel::playMusic()
{
  if (!clickObject) {
    clickObject = new Phonon::MediaObject(this);
    clickOutput = new Phonon::AudioOutput(Phonon::NoCategory, this);
    Phonon::createPath(clickObject, clickOutput);
    connect(clickObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(mediaPlayer_state(Phonon::State, Phonon::State)));
  }

  QPushButton * button = qobject_cast<QPushButton*>(sender());
  int index = button->property("index").toInt();
  QString path = g.profile[g.id()].sdPath();
  QDir qd(path);
  QString track;
  if (qd.exists()) {
    if (firmware->getCapability(VoicesAsNumbers)) {
      track = path + QString("/%1.wav").arg(int(fswtchParam[index]->value()), 4, 10, (const QChar)'0');
    }
    else {
      path.append("/SOUNDS/");
      QString lang = generalSettings.ttsLanguage;
      if (lang.isEmpty())
        lang = "en";
      path.append(lang);
      if (fswtchParamArmT[index]->currentText() != "----") {
        track = path + "/" + fswtchParamArmT[index]->currentText() + ".wav";
      }
    }
    QFile file(track);
    if (!file.exists()) {
      QMessageBox::critical(this, tr("Error"), tr("Unable to find sound file %1!").arg(track));
      return;
    }

    if (phononCurrent == index) {
      clickObject->stop();
      clickObject->clear();
      playBT[index]->setIcon(CompanionIcon("play.png"));
      phononCurrent = -1;
    }
    else {
      if (phononCurrent >= 0) {
        playBT[phononCurrent]->setIcon(CompanionIcon("play.png"));
      }
      phononCurrent = index;
      clickObject->clear();
#ifdef __APPLE__
      clickObject->setCurrentSource(QUrl("file://"+track));
#else
      clickObject->setCurrentSource(QUrl(track));
#endif
      clickObject->play();
      playBT[index]->setIcon(CompanionIcon("stop.png"));
    }
  }
}
示例#18
0
文件: tile.cpp 项目: kyak/Tile
bool Tile::isSolved()
{
    QPushButton *button;
    for (int i = 1; i < 17; i++) {
        button = idtoButton(i);
        if (button->text() != button->property("id")) {
            return 0;
        }
    }
    return 1;
}
示例#19
0
void MTContactDetails::on_btnAddressDelete_clicked()
{
    QObject * pqobjSender = QObject::sender();

    if (NULL != pqobjSender)
    {
        QPushButton * pBtnDelete = dynamic_cast<QPushButton *>(pqobjSender);

        if (m_pAddresses && (NULL != pBtnDelete))
        {
            QVariant  varContactID   = pBtnDelete->property("contactid");
            QVariant  varMethodType  = pBtnDelete->property("methodtype");
            QVariant  varMethodAddr  = pBtnDelete->property("methodaddr");
            int       nContactID     = varContactID .toInt();
            QString   qstrMethodType = varMethodType.toString();
            QString   qstrAddress    = varMethodAddr.toString();
            QWidget * pWidget        = VPtr<QWidget>::asPtr(pBtnDelete->property("methodwidget"));

            if (NULL != pWidget)
            {
                bool bRemoved = MTContactHandler::getInstance()->RemoveMsgAddressFromContact(nContactID, qstrMethodType, qstrAddress);

                if (bRemoved) // Let's remove it from the GUI, too, then.
                {
                    QLayout * pLayout = m_pAddresses->layout();

                    if (NULL != pLayout)
                    {
                        pLayout->removeWidget(pWidget);

                        pWidget->setParent(NULL);
                        pWidget->disconnect();
                        pWidget->deleteLater();

                        pWidget = NULL;
                    }
                }
            }
        }
    }
}
示例#20
0
void
CXTechDlg::onButtonClicked()
{
  QPushButton* clickedButton = qobject_cast<QPushButton*>(sender());
  QString prop = clickedButton->property("tech").toString();

  std::for_each(ckBox.begin(), ckBox.end(), [&prop](const QCheckBox* _item){
  	if(_item->isChecked()) prop += ":" + _item->property("opt").toString();
  } );
  emit postTechnology(prop);
  hide();
}
示例#21
0
void TilesetItemBox::editSelectedTileset()
{
    TilesetConfigureDialog *tilesetConfDia;

    if(mw()->activeChildWindow() == 1)
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, mw()->activeLvlEditWin()->scene, mw());
    else if(mw()->activeChildWindow() == 3)
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, mw()->activeWldEditWin()->scene, mw());
    else
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, NULL, mw());

    util::DialogToCenter(tilesetConfDia);

    QPushButton *b = qobject_cast<QPushButton *>(sender());
    if(!b)
    {
        delete tilesetConfDia;
        return;
    }

    QWidget *parent = b->parentWidget();
    if(!parent)
    {
        delete tilesetConfDia;
        return;
    }

    QGroupBox *box = qobject_cast<QGroupBox *>(parent);
    if(!box)
    {
        delete tilesetConfDia;
        return;
    }

    QString fileName = b->property("tileset-file-name").toString();//box->title();
    QVector<SimpleTileset> ctilesets = loadCustomTilesets();
    for(int i = 0; i < ctilesets.size(); ++i)
    {
        SimpleTileset &aTileset = ctilesets[i];
        if(aTileset.fileName == fileName)
        {
            tilesetConfDia->loadSimpleTileset(aTileset, aTileset.customDir);
            tilesetConfDia->exec();
            break;
        }
    }

    delete tilesetConfDia;

    mw()->configs.loadTilesets();
    setTileSetBox();
}
示例#22
0
void MainWindow::ServerTypeButtonClick( )
{
    QPushButton* pBtn = ( QPushButton* ) sender( );
    int nServerType = pBtn->property( "ServerType" ).toInt( );
    static bool bStart = false;
    bStart = !bStart;

    switch ( nServerType ) {
    case PassengerFlow :
        PassengerFlowServer( bStart );
        break;
    }
}
void LayoutAliasEditDialog::addAlias() {

    QPushButton * src = (QPushButton *) sender();

    QVBoxLayout * contentLayout = (QVBoxLayout *) src->property("layout").value<void *>();

    srcNineMLLayout->AliasList.push_back(new Alias());
    srcNineMLLayout->AliasList.back()->name = "newAlias";
    srcNineMLLayout->AliasList.back()->maths = new MathInLine;
    srcNineMLLayout->AliasList.back()->maths->equation = "0";

    // add new Alias to display
    contentLayout->insertLayout(contentLayout->count() - 3, drawAlias(srcNineMLLayout->AliasList.back()));

}
示例#24
0
void ItemTagsLoader::onColorButtonClicked()
{
    QPushButton *button = qobject_cast<QPushButton*>(sender());
    Q_ASSERT(button);

    const QColor color = button->property(propertyColor).value<QColor>();
    QColorDialog dialog(button->window());
    dialog.setOptions(dialog.options() | QColorDialog::ShowAlphaChannel);
    dialog.setCurrentColor(color);

    if ( dialog.exec() == QDialog::Accepted )
        setColorIcon( button, dialog.selectedColor() );

    onAllTableWidgetItemsChanged();
}
void SSGIntegrationDialog::variantRequested()
{
    QObject* sender = QObject::sender();
    QPushButton* button = dynamic_cast<QPushButton*>(sender);

    if (!button)
        return;

    const QString variant = button->property("ssg_variant").toString();

    const QDir& dir(getSSGDirectory());

    mSelectedSSGFile = dir.absoluteFilePath(QString("ssg-%1-ds.xml").arg(variant));
    accept();
}
void cQSettingsDialog::OnColorClicked( bool iChecked )
/**********************************************************************/
{
    QPushButton *vSender = (QPushButton*)sender();
    Ogre::ColourValue *iColor = (Ogre::ColourValue*)(qvariant_cast<void*>(vSender->property("OgreColor")));
    QColorDialog vDialog;
    vDialog.setCurrentColor( QColor( iColor->r * 255, iColor->g * 255, iColor->b * 255 ) );
    if ( !vDialog.exec() ) return;

    QColor vColor = vDialog.currentColor();
    iColor->r = vColor.red()   / 255.0f;
    iColor->g = vColor.green() / 255.0f;
    iColor->b = vColor.blue()  / 255.0f;
    
    QPixmap vPixmap( 24, 16 );
    vPixmap.fill( vColor );
    vSender->setIcon( QIcon( vPixmap ) );
}
示例#27
0
void Receiver::slotLaunchTest()
{
    QPushButton *button = qobject_cast<QPushButton *>(sender());
    Q_ASSERT(button);
    const int testNumber = button->property("testNumber").toInt();
    QList<QUrl> urls;
    if (QByteArray(s_tests[testNumber].text).startsWith("runCommand")) {
        KRun::runCommand(s_tests[testNumber].exec, this);
    } else {
        if (s_tests[testNumber].url) {
            QString urlStr(s_tests[testNumber].url);
            if (urlStr == QLatin1String(testFile)) {
                urlStr = QFINDTESTDATA(testFile);
            }
            urls << QUrl::fromUserInput(urlStr);
        }
        KRun::run(s_tests[testNumber].exec, urls, this);
    }
}
示例#28
0
void AutoFillWidget::loginToPage()
{
    QPushButton* button = qobject_cast<QPushButton*>(sender());
    if (!button || !m_view) {
        return;
    }

    bool ok;
    int index = button->property("data-index").toInt(&ok);

    if (ok && QzTools::vectorContainsIndex(m_data, index)) {
        const PasswordEntry entry = m_data.at(index);

        PageFormCompleter completer(m_view->page());
        completer.completePage(entry.data);
    }

    close();
}
void UpdateCheckerDialog::showDetails()
{
	QPushButton *button = qobject_cast<QPushButton*>(sender());

	if (button)
	{
		const QUrl url = button->property("detailsUrl").toUrl();

		if (url.isValid() && !SessionsManager::hasUrl(url, true))
		{
			QVariantMap parameters;
			parameters[QLatin1String("url")] = url;

			ActionsManager::triggerAction(ActionsManager::OpenUrlAction, this, parameters);

			close();
		}
	}
}
示例#30
0
void MainWindow::showFullInfo() {
    QPushButton* b = qobject_cast<QPushButton *>(sender());
    int index = b->property("index").toInt();

    std::vector<SearchParameters> path = vvPaths.at(index);

    QString startName = QString::fromStdString(CityMap::Instance().getPlaceById(path.at(0).getStart()).getName());
    QString finishName = QString::fromStdString(CityMap::Instance().getPlaceById(path.at(path.size() - 1).getFinish()).getName());

    QString cost = QString::number(MainWindow::defineCost(path));
    QString duration = MainWindow::defineDuration(path).toString();

    std::vector<QString> stopsList;
    for(int i = 0; i < path.size(); i++) {
        SearchParameters sp = path.at(i);
        QString stopName = QString::fromStdString(CityMap::Instance().getPlaceById(sp.getStart()).getName());
        stopsList.push_back(stopName);
    }
//    for(int i = 0; i < routesTableItem.pathVector.size(); i++) {
//        SearchParameters searchParams = routesTableItem.pathVector.at(i);
//        std::string str = CityMap::Instance().getPlaceById(searchParams.getStart()).getName();
//        stopsList.push_back(QString::fromStdString(str));
//    }
    stopsList.push_back(finishName);

    QString stopsStr;
    for(int i = 0; i < stopsList.size();i++) {
        stopsStr += QString::number(i+1);
        stopsStr += ") ";
        stopsStr += stopsList.at(i);
        stopsStr += "\n";
    }

    QMessageBox::information(this, "Информация о маршруте",
                             QString("\nИз: ") + startName +
                             QString("\nВ: ") + finishName +
                             QString("\nСтоимость: ") + cost +
                             QString("\nВремя: ") + duration +
                             QString("\nОстановки: \n") +
                             stopsStr);

}