当前位置: 首页>>代码示例>>C++>>正文


C++ QPushButton::property方法代码示例

本文整理汇总了C++中QPushButton::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::property方法的具体用法?C++ QPushButton::property怎么用?C++ QPushButton::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPushButton的用法示例。


在下文中一共展示了QPushButton::property方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_btnAddressAdd_clicked

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);
                    }
                }
            }
        }
    }
}
开发者ID:habibmasuro,项目名称:Moneychanger,代码行数:58,代码来源:contactdetails.cpp

示例2: fontColorButtonClicked

//-------------------------------------------------------------------------
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) {
	}
}
开发者ID:iloveican,项目名称:AscoGraph,代码行数:12,代码来源:SetupDialog.cpp

示例3: uninstallExtension

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);
            }
      }
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:13,代码来源:resourceManager.cpp

示例4: mSltColorChangeBtn

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();
}
开发者ID:dourgulf,项目名称:biliobs,代码行数:25,代码来源:BiLiPropertyDlg_addTextSource.cpp

示例5: deleteAlias

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;
        }
    }

}
开发者ID:ajc158,项目名称:spinecreator,代码行数:16,代码来源:layoutaliaseditdialog.cpp

示例6: onSetFile

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);
}
开发者ID:laneslexicon,项目名称:lexicon,代码行数:27,代码来源:iconoptions.cpp

示例7: valeChanged

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;
    }
}
开发者ID:httpftpli,项目名称:mdimh,代码行数:27,代码来源:formjqgzcs.cpp

示例8: slotEditItem

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);
}
开发者ID:ScotterC,项目名称:qrestclient,代码行数:35,代码来源:paramslist.cpp

示例9: downloadUpdate

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)));
		}
	}
}
开发者ID:davidyang5405,项目名称:otter-browser,代码行数:28,代码来源:UpdateCheckerDialog.cpp

示例10: valeChanged

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;
    }

}
开发者ID:httpftpli,项目名称:mdimh,代码行数:32,代码来源:formxtcs.cpp

示例11: disableRow

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;

}
开发者ID:dgerlach,项目名称:Thermostat-Demo,代码行数:32,代码来源:schedulescreen.cpp

示例12: pickRenderTechnique

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();
}
开发者ID:pauljnixon,项目名称:Graphics,代码行数:7,代码来源:LabCanvas.cpp

示例13: downloadExtension

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);
                  }
            }
      }
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:47,代码来源:resourceManager.cpp

示例14: FanSettingHandler

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;

}
开发者ID:luofc,项目名称:qt4-demos,代码行数:45,代码来源:widget.cpp

示例15: updateFontButtons

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);
    }
}
开发者ID:m4r71n,项目名称:CopyQ,代码行数:45,代码来源:configtabappearance.cpp


注:本文中的QPushButton::property方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。