• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setValid函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setValid函数的典型用法代码示例。如果您正苦于以下问题:C++ setValid函数的具体用法?C++ setValid怎么用?C++ setValid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setValid

bool BitcoinAmountField::eventFilter(QObject *object, QEvent *event)
{
    if (event->type() == QEvent::FocusIn)
    {
        // Clear invalid flag on focus
        setValid(true);
    }
    else if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
    {
        QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
        if (keyEvent->key() == Qt::Key_Comma)
        {
            // Translate a comma into a period
            QKeyEvent periodKeyEvent(event->type(), Qt::Key_Period, keyEvent->modifiers(), ".", keyEvent->isAutoRepeat(), keyEvent->count());
            QApplication::sendEvent(object, &periodKeyEvent);
            return true;
        }
    }
    return QWidget::eventFilter(object, event);
}
开发者ID:K1773R,项目名称:tlascoin,代码行数:20,代码来源:bitcoinamountfield.cpp


示例2: filename

bool KoPattern::load()
{
    QString fileExtension;
    int index = filename().lastIndexOf('.');

    if (index != -1)
        fileExtension = filename().mid(index).toLower();

    bool result;
    if (fileExtension == ".pat") {
        QFile file(filename());
        file.open(QIODevice::ReadOnly);
        QByteArray data = file.readAll();
        file.close();
        result = init(data);
    } else {
        result = m_image.load(filename());
        setValid(result);
    }
    return result;
}
开发者ID:NavyZhao1978,项目名称:QCalligra,代码行数:21,代码来源:KoPattern.cpp


示例3: i18n

bool DatabaseDialog::tablesDoNext()
{
    m_databaseStatus->setText(i18n("Retrieving meta data of tables..."));
    QStringList tables;

    {
        for (int i = 0; i < m_tableView->count(); ++i) {
            QListWidgetItem* item = m_tableView->item(i);
            if (item->checkState() == Qt::Checked) {
                tables.append(item->text());
            }
        }
    }

    if (tables.empty()) {
        KMessageBox::error(this, i18n("You have to select at least one table."));
        return false;
    }

    m_columnView->clear();
    QSqlRecord info;
    for (int i = 0; i < (int) tables.size(); ++i) {
        info = m_dbConnection.record(tables[i]);
        for (int j = 0; j < (int) info.count(); ++j) {
            QString name = info.fieldName(j);
            QSqlField field = info.field(name);
            QTreeWidgetItem * checkItem = new QTreeWidgetItem(QStringList() << name << tables[i] << QVariant::typeToName(field.type()));

            checkItem->setFlags(checkItem->flags() | Qt::ItemIsUserCheckable);
            checkItem->setCheckState(0, Qt::Unchecked);
            m_columnView->addTopLevelItem(checkItem);
        }
    }
    m_columnView->sortItems(1, Qt::AscendingOrder);

    setValid(m_columns, true);

    return true;
}
开发者ID:KDE,项目名称:koffice,代码行数:39,代码来源:DatabaseDialog.cpp


示例4: SettingWidget

NovellVpnSettingWidget::NovellVpnSettingWidget(Knm::Connection * connection, QWidget * parent)
: SettingWidget(connection, parent), d(new Private)
{
    setValid(false);
    d->ui.setupUi(this);
    d->ui.x509Cert->setMode(KFile::LocalOnly);
    d->setting = static_cast<Knm::VpnSetting *>(connection->setting(Knm::Setting::Vpn));

    connect(d->ui.leGateway, SIGNAL(textChanged(QString)), this, SLOT(validate()));
    connect(d->ui.cbShowPasswords, SIGNAL(toggled(bool)), this, SLOT(showPasswordsChanged(bool)));

    connect(d->ui.cmbGwType, SIGNAL(currentIndexChanged(int)), this, SLOT(gatewayTypeChanged(int)));

    connect(d->ui.btnAdvanced, SIGNAL(clicked()), this, SLOT(advancedClicked()));

    d->advancedDialog = new KDialog(this);
    d->advancedDialog->setButtons(KDialog::Ok);
    d->advancedDialog->setCaption(i18nc("@window:title NovellVPN advanced connection options", "NovellVPN advanced options"));
    QWidget * advWid = new QWidget(d->advancedDialog);
    d->advUi.setupUi(advWid);
    d->advancedDialog->setMainWidget(advWid);
}
开发者ID:netrunner-debian-kde-extras,项目名称:networkmanagement,代码行数:22,代码来源:novellvpnwidget.cpp


示例5: playerId

Player::Player(int16_t playerId, sf::Vector2f position, OutputSocket socket, char * nick) :
playerId(playerId),
timeSinceLastShot(sf::Time::Zero),
speed(500),
rotation(0),
cross_thickness(5),
socket(socket),
health(100),
playerInfo(0),
ip(socket.ip),
nick(nick),
ammo(10),
invisibleTime(sf::Time::Zero)
{
    boundingBox = BoundingBox(position.x, position.y, 50, 50);
    updateCross();
    horz_rect.width = boundingBox.width;
    vert_rect.height = boundingBox.height;
    type = EntityType::Player_T;
    setTeam(0);
    setValid(0);
}
开发者ID:gallowstree,项目名称:PE-Server,代码行数:22,代码来源:Player.cpp


示例6: metric

void KisTextBrush::updateBrush()
{
    QFontMetrics metric(m_font);
    int w = metric.width(m_txt);
    int h = metric.height();

    // don't crash, if there is no text
    if (w==0) w=1;
    if (h==0) h=1;

    QPixmap px(w, h);
    QPainter p;
    p.begin(&px);
    p.setFont(m_font);
    p.fillRect(0, 0, w, h, Qt::white);
    p.setPen(Qt::black);
    p.drawText(0, metric.ascent(), m_txt);
    p.end();
    setImage(px.toImage());
    setValid(true);
    resetBoundary();
}
开发者ID:KDE,项目名称:calligra-history,代码行数:22,代码来源:kis_text_brush.cpp


示例7: filename

bool KoStopGradient::loadFromDevice(QIODevice *dev)
{
    QString strExt;
    const int result = filename().lastIndexOf('.');
    if (result >= 0) {
        strExt = filename().mid(result).toLower();
    }
    QByteArray ba = dev->readAll();

    QBuffer buf(&ba);
    if (strExt == ".kgr") {
        loadKarbonGradient(&buf);
    }
    else if (strExt == ".svg") {
        loadSvgGradient(&buf);
    }
    if (m_stops.count() >= 2) {
        setValid(true);
    }
    updatePreview();
    return true;
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:22,代码来源:KoStopGradient.cpp


示例8: ba

bool Sample::decompressOggVorbis(char* src, int size)
      {
      AudioFile af;
      QByteArray ba(src, size);

      start = 0;
      end   = 0;
      if (!af.open(ba)) {
            qDebug("Sample::decompressOggVorbis: open failed: %s", af.error());
            return false;
            }
      int frames = af.frames();
      data = new short[frames * af.channels()];
      if (frames != af.readData(data, frames)) {
            qDebug("Sample read failed: %s", af.error());
            delete[] data;
            data = 0;
            }
      end = frames - 1;

      if (loopend > end ||loopstart >= loopend || loopstart <= start) {
            /* can pad loop by 8 samples and ensure at least 4 for loop (2*8+4) */
            if ((end - start) >= 20) {
                  loopstart = start + 8;
                  loopend = end - 8;
                  }
            else { // loop is fowled, sample is tiny (can't pad 8 samples)
                  loopstart = start + 1;
                  loopend = end - 1;
                  }
            }
      if ((end - start) < 8) {
            qDebug("invalid sample");
            setValid(false);
            }

      return true;
      }
开发者ID:CombatCube,项目名称:MuseScore,代码行数:38,代码来源:sfont3.cpp


示例9: setValid

bool cc2Point5DimEditor::RasterGrid::init(unsigned w, unsigned h)
{
	setValid(false);

	if (w == width && h == height)
	{
		//simply reset values
		reset();
		return true;
	}

	clear();

	try
	{
		data.resize(h,0);
		for (unsigned i=0; i<h; ++i)
		{
			data[i] = new RasterCell[w];
			if (!data[i])
			{
				//not enough memory
				clear();
				return false;
			}
		}
	}
	catch (const std::bad_alloc&)
	{
		//not enough memory
		return false;
	}

	width = w;
	height = h;

	return true;
}
开发者ID:ORNis,项目名称:CloudCompare,代码行数:38,代码来源:cc2.5DimEditor.cpp


示例10: setObject

const bool CtrlrLuaMethod::setCodeInternal(const String &newMethodCode)
{
	bool compileRet			= owner.getOwner().runCode (newMethodCode);
	errorString.clear();
	errorString.append ("Compile: "+getName()+" - ", out, Colours::black);

	String error;

	if (compileRet && getName() != String::empty)
	{
		try
		{
			setObject ( (luabind::object)luabind::globals (getLuaState()) [(const char *)getName().toUTF8()] );
		}
		catch (const luabind::error &e)
		{
			error = String(e.what());
		}
	}
	else if (compileRet == false)
	{
		error = owner.getOwner().getLastError();
	}

	if (compileRet)
	{
		errorString.append ("OK\n", out.withStyle(Font::bold), Colours::black);
	}
	else
	{
		errorString.append ("FAILED\n", out.withStyle(Font::bold), Colours::darkred);
		errorString.append (error+"\n", out, Colours::darkred);
	}

	setValid(compileRet);

	return (compileRet);
}
开发者ID:Srikrishna31,项目名称:ctrlr,代码行数:38,代码来源:CtrlrLuaMethod.cpp


示例11: if

void Board::move(const Coord &pos)
{
    if (pos.x == -1 && pos.y == -1)
        passFlag[sideFlag] = true;

    else if (inRange(pos.x, pos.y))
    {
        for (int i = 0; i < 8; i++)
        {
            int dx = dir[i][0], dy = dir[i][1];

            if (cell[pos.x + dx][pos.y + dy].stat == !sideFlag)
            {
                for (int p = pos.x + dx, q = pos.y + dy; inRange(p, q); p += dx, q += dy)
                {
                    if (cell[p][q].stat >= Empty)
                        break;
                    if (cell[p][q].stat == Status(sideFlag))
                    {
                        cell[pos.x][pos.y].stat = Status(sideFlag);

                        for (int r = p - dx, s = q - dy; cell[r][s].stat != Status(sideFlag); r -= dx, s -= dy)
                            cell[r][s].stat = Status(sideFlag);
                        break;
                    }
                }
            }
        }
        passFlag[sideFlag] = false;
    }
    else
        fatalError(1);

    movesRecord.push_back(pos);
    flipSide();
    setValid();
    count();
}
开发者ID:BuriedJet,项目名称:Othello,代码行数:38,代码来源:board.cpp


示例12: DataCommand

SetTypeTypeSectionCommand::SetTypeTypeSectionCommand(TypeSection *typeSection, TypeSection::RoadType newRoadType, DataCommand *parent)
    : DataCommand(parent)
    , typeSection_(typeSection)
{
    // Check for validity //
    //
    if (typeSection->getRoadType() == newRoadType)
    {
        setInvalid(); // Invalid because new RoadType is the same as the old
        setText(QObject::tr("Set Road Type (invalid!)"));
        return;
    }
    else
    {
        setValid();
        setText(QObject::tr("Set Road Type"));
    }

    // Road Type //
    //
    newRoadType_ = newRoadType;
    oldRoadType_ = typeSection->getRoadType();
}
开发者ID:nixz,项目名称:covise,代码行数:23,代码来源:typesectioncommands.cpp


示例13: setInvalid

void
SetLaneRoadMarkTypeCommand::construct()
{
    // Check for validity //
    //
    if (marks_.isEmpty())
    {
        setInvalid();
        setText(QObject::tr("Set Road Mark Type: Parameters invalid! No element given."));
        return;
    }
    else
    {
        setValid();
        setText(QObject::tr("Set Road Mark Type"));
    }

    // Old Types //
    //
    foreach (LaneRoadMark *element, marks_)
    {
        oldTypes_.append(element->getRoadMarkType());
    }
开发者ID:lbovard,项目名称:covise,代码行数:23,代码来源:lanesectioncommands.cpp


示例14: DataCommand

SetLaneRoadMarkSOffsetCommand::SetLaneRoadMarkSOffsetCommand(LaneRoadMark *mark, double sOffset, DataCommand *parent)
    : DataCommand(parent)
    , mark_(mark)
    , newSOffset_(sOffset)
{
    // Check for validity //
    //
    if (!mark || (sOffset == mark_->getSOffset()))
    {
        setInvalid();
        setText(QObject::tr("Set Road Mark Offset: Parameters invalid! No element given or no change."));
        return;
    }
    else
    {
        setValid();
        setText(QObject::tr("Set Road Mark Offset"));
    }

    // Road Type //
    //
    oldSOffset_ = mark_->getSOffset();
}
开发者ID:lbovard,项目名称:covise,代码行数:23,代码来源:lanesectioncommands.cpp


示例15: if

 void Cluster::Centroid::compute() {
     int size = __c.__size, dim = __dimensions;
     double average, total;
     if(size == 1) {
         __p = __c[0];
     }
     else if (size > 0) {
         for(int i = 0; i < dim; i++) {
             for (int k = 0; k < size; k++) {
                 Point p(__c[k]);
                 total += p[i];
             }
             average = total / size;
             __p.setValue(i, average);
             total = 0;
         }
     }
     else {
         toInfinity();
     }
     setValid(true);
     //std::cout << isValid() << " should be 1" << std::endl;
 }
开发者ID:feghalim,项目名称:ucd-csci2312-pa3,代码行数:23,代码来源:Cluster.cpp


示例16: lookupPublicKey

void ContactView::publicKeyEdited(const QString& public_key_string)
{
  ui->id_edit->clear();  //clear keyhotee id field
  if (gMiningIsPossible)
    lookupPublicKey();
  //check for validly hashed public key and enable/disable save button accordingly
  bool public_key_is_valid = public_key_address::is_valid(public_key_string.toStdString());
  bool doubleContact = false;
  if (public_key_is_valid)
  {
    if (! (doubleContact = existContactWithPublicKey(public_key_string.toStdString())))
    {
      ui->id_status->setText(tr("Public Key Only Mode: valid key") );
      ui->id_status->setStyleSheet("QLabel { color : green; }");
    }
  }
  else
  {
    ui->id_status->setText(tr("Public Key Only Mode: not a valid key") );
    ui->id_status->setStyleSheet("QLabel { color : red; }");
  }
  setValid (public_key_is_valid && ! doubleContact);
}
开发者ID:4Ykw,项目名称:keyhotee,代码行数:23,代码来源:ContactView.cpp


示例17: filename

bool KoStopGradient::load()
{
    QString strExt;
    const int result = filename().lastIndexOf('.');
    if (result >= 0) {
        strExt = filename().mid(result).toLower();
    }
    QFile f(filename());

    if (f.open(QIODevice::ReadOnly)) {
        if (strExt == ".kgr") {
            loadKarbonGradient(&f);
        } else if (strExt == ".svg") {
            loadSvgGradient(&f);
        }
    }
    if (m_stops.count() >= 2)
        setValid(true);

    updatePreview();

    return true;
}
开发者ID:KDE,项目名称:calligra-history,代码行数:23,代码来源:KoStopGradient.cpp


示例18: value

void BitcoinAmountField::unitChanged(int idx)
{
    // Use description tooltip for current unit for the combobox
    unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString());

    // Determine new unit ID
    int newUnit = unit->itemData(idx, BitcoinUnits::UnitRole).toInt();

    // Parse current value and convert to new unit
    bool valid = false;
    qint64 currentValue = value(&valid);

    currentUnit = newUnit;

    // Set max length after retrieving the value, to prevent truncation
    amount->setDecimals(BitcoinUnits::decimals(currentUnit));
    amount->setMaximum(qPow(10, BitcoinUnits::amountDigits(currentUnit)) - qPow(10, -amount->decimals()));

    if(currentUnit == BitcoinUnits::uBTC)
        amount->setSingleStep(1);
    else if(currentUnit == BitcoinUnits::mBTC)
        amount->setSingleStep(0.1);
    else
        amount->setSingleStep(0.01);

    if(valid)
    {
        // If value was valid, re-place it in the widget with the new unit
        setValue(currentValue);
    }
    else
    {
        // If current value is invalid, just clear field
        setText("");
    }
    setValid(true);
}
开发者ID:micryon,项目名称:planetdollar,代码行数:37,代码来源:bitcoinamountfield.cpp


示例19: AbstractSensorChannel

GyroscopeSensorChannel::GyroscopeSensorChannel(const QString& id) :
        AbstractSensorChannel(id),
        DataEmitter<TimedXyzData>(10),
        previousSample_()
{
    SensorManager& sm = SensorManager::instance();

    gyroscopeAdaptor_ = sm.requestDeviceAdaptor("gyroscopeadaptor");
    Q_ASSERT( gyroscopeAdaptor_ );

    gyroscopeReader_ = new BufferReader<TimedXyzData>(1);

    outputBuffer_ = new RingBuffer<TimedXyzData>(1);

    // Create buffers for filter chain
    filterBin_ = new Bin;
    filterBin_->add(gyroscopeReader_, "gyroscope");
    filterBin_->add(outputBuffer_, "output");

    filterBin_->join("gyroscope", "source", "output", "sink");

    // Join datasources to the chain
    connectToSource(gyroscopeAdaptor_, "gyroscope", gyroscopeReader_);

    marshallingBin_ = new Bin;
    marshallingBin_->add(this, "sensorchannel");

    outputBuffer_->join(this);

    // Set MetaData
    setDescription("x, y, and z axes angular velocity in mdps");
    setRangeSource(gyroscopeAdaptor_);
    addStandbyOverrideSource(gyroscopeAdaptor_);
    setIntervalSource(gyroscopeAdaptor_);

    setValid(true);
}
开发者ID:faenil,项目名称:sensorfw,代码行数:37,代码来源:gyroscopesensor.cpp


示例20: setName

bool KisWorkspaceResource::loadFromDevice(QIODevice *dev)
{
    QDomDocument doc;
    if (!doc.setContent(dev)) {
        return false;
    }

    QDomElement element = doc.documentElement();
    setName(element.attribute("name"));

    QDomElement state = element.firstChildElement("state");

    if (!state.isNull()) {
        m_dockerState = QByteArray::fromBase64(state.text().toLatin1());
    }

    QDomElement settings = element.firstChildElement("settings");
    if (!settings.isNull()) {
        KisPropertiesConfiguration::fromXML(settings);
    }

    setValid(true);
    return true;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:24,代码来源:kis_workspace_resource.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setValidator函数代码示例发布时间:2022-05-30
下一篇:
C++ setUsingNativeTitleBar函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap