本文整理汇总了C++中setValid函数的典型用法代码示例。如果您正苦于以下问题:C++ setValid函数的具体用法?C++ setValid怎么用?C++ setValid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setValid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}
示例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());
}
示例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();
}
示例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;
}