本文整理汇总了C++中QChar::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::isNull方法的具体用法?C++ QChar::isNull怎么用?C++ QChar::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QChar
的用法示例。
在下文中一共展示了QChar::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makedir
int makedir (const QString& newdir)
{
QChar p;
QString buffer;
int len = newdir.length();
if (len <= 0)
return 0;
buffer = newdir;
if (buffer.endsWith("/") || buffer.endsWith("\\"))
buffer.left(len - 1);
if (mymkdir(buffer) == 0)
return 1;
uint cIndex = 1;
p = buffer[1];
while (1)
{
QString tmpBuf;
while(!p.isNull() && p != '\\' && p != '/')
p = buffer[cIndex++];
tmpBuf = buffer.left(cIndex - 1);
if ((mymkdir(tmpBuf) == -1) && (errno == ENOENT))
return 0;
if (p.isNull())
break;
p = buffer[++cIndex];
}
return 1;
}
示例2: parseAliases
QStringList GaduEmoticonParser::parseAliases()
{
QStringList result;
QChar c = peek();
if (c.isNull())
return result;
bool multiple = false;
if (c == '(')
{
multiple = true;
eat();
}
while (true)
{
QString alias = parseQuoted();
if (!alias.isEmpty())
result.append(alias);
if (!multiple)
return result;
c = get();
if (c.isNull() || c == ')')
return result;
if (c != ',') // some kind of error
return result;
}
Q_ASSERT(false);
}
示例3: setMetaFormat
void ShoutCastMetaParser::setMetaFormat(const QString &metaformat)
{
/*
We support these metatags :
%a - artist
%t - track
%b - album
%r - random bytes
*/
m_meta_format = metaformat;
m_meta_artist_pos = 0;
m_meta_title_pos = 0;
m_meta_album_pos = 0;
int assign_index = 1;
int pos = 0;
pos = m_meta_format.indexOf("%", pos);
while (pos >= 0)
{
pos++;
QChar ch;
if (pos < m_meta_format.length())
ch = m_meta_format.at(pos);
if (!ch.isNull() && ch == '%')
{
pos++;
}
else if (!ch.isNull() && (ch == 'r' || ch == 'a' || ch == 'b' || ch == 't'))
{
if (ch == 'a')
m_meta_artist_pos = assign_index;
if (ch == 'b')
m_meta_album_pos = assign_index;
if (ch == 't')
m_meta_title_pos = assign_index;
assign_index++;
}
else
LOG(VB_GENERAL, LOG_ERR,
QString("ShoutCastMetaParser: malformed metaformat '%1'")
.arg(m_meta_format));
pos = m_meta_format.indexOf("%", pos);
}
m_meta_format.replace("%a", "(.*)");
m_meta_format.replace("%t", "(.*)");
m_meta_format.replace("%b", "(.*)");
m_meta_format.replace("%r", "(.*)");
m_meta_format.replace("%%", "%");
}
示例4: translatedToVanity
QChar QPhoneNumberString::translatedToVanity(const QChar c) {
if ( c.isNull() ) return QChar();
if ( c.isNumber() ) return c;
if ( c.isSpace() ) return QChar('1');
QChar vanityChar = m_VanityChars[ c.toLower() ];
if ( vanityChar.isNull() )
kDebug() << " did not found char "
<< c << hex << c.unicode()
<< "\" to translate.";
return( vanityChar );
}
示例5: consumeUntil
void Scanner::consumeUntil(const char* stopAt, const char* stopAfter)
{
QChar ch = m_src.peek();
while (!ch.isNull() && !ch.isSpace() && !std::strchr(stopAt, ch.toLatin1())) {
m_src.move();
ch = m_src.peek();
if (stopAfter && !ch.isNull() && std::strchr(stopAfter, ch.toLatin1())) {
m_src.move();
break;
}
}
}
示例6: get
QString get(int type)
{
QChar current;
QString result;
passWhiteSpace();
while (true) {
current = next();
if (current.isNull()) {
break;
}
if (current.isSpace()) {
break;
}
bool number = isNumber(current);
if (type == GetDigit && !number) {
break;
}
if (type == GetString && number) {
break;
}
if(current == QLatin1Char( CONVERSION_CHAR )) {
break;
}
++m_index;
result += current;
}
return result;
}
示例7: paintEvent
void MainWidget::paintEvent(QPaintEvent *event) {
int xt = event->region().boundingRect().topLeft().x()/xsize;
int yt = event->region().boundingRect().topLeft().y()/ysize;
int xb = event->region().boundingRect().bottomRight().x()/xsize;
int yb = event->region().boundingRect().bottomRight().y()/ysize;
QPainter painter(this);
if (showGrid) {
painter.setPen(palette().dark().color());
for (int i = xt; i <= xb; ++i)
painter.drawLine(xsize * i, 0, xsize * i, ysize * yasc);
for (int j = yt; j <= yb; ++j)
painter.drawLine(0, ysize * j, xsize * xasc, ysize * j);
}
for (int i = xt; i <= xb; ++i) {
for (int j = yt; j <= yb; ++j) {
QRect rect = pixelRect(i, j);
if (!event->region().intersect(rect).isEmpty()) {
painter.fillRect(rect, QColor::fromRgb(background.pixel(i, j)));
painter.setPen(QColor::fromRgb(foreground.pixel(i,j)));
QChar c = text.at(j).at(i);
if (c.isNull())
c = ' ';
painter.drawText(rect.translated(1,0), Qt::AlignCenter, c);
}
}
}
QRect lastRect = pixelRect(lastx, lasty).adjusted(0,0,-1,-1);
if (!event->region().intersect(lastRect).isEmpty() && hasFocus()) {
painter.setPen(selColor);
painter.drawRect(lastRect);
}
current_brush->second->onWidgetPaint(event, painter);
}
示例8: getRenderedImage
QImage MainWidget::getRenderedImage(bool g) const {
QSize size(xsize*xasc, ysize*yasc);
if (g)
size += QSize(1, 1);
QImage image(size, QImage::Format_ARGB32);
QPainter painter(&image);
if (g) {
painter.setPen(palette().dark().color());
for (int i = 0; i <= xasc; ++i)
painter.drawLine(xsize * i, 0, xsize * i, ysize * yasc);
for (int j = 0; j <= yasc; ++j)
painter.drawLine(0, ysize * j, xsize * xasc, ysize * j);
}
for (int i = 0; i < xasc; ++i) {
for (int j = 0; j < yasc; ++j) {
QRect rect = g ? QRect(xsize * i + 1, ysize * j + 1, xsize - 1, ysize - 1) : QRect(xsize * i, ysize * j, xsize, ysize);;
painter.fillRect(rect, QColor::fromRgb(background.pixel(i, j)));
painter.setPen(QColor::fromRgb(foreground.pixel(i,j)));
QChar c = text.at(j).at(i);
if (c.isNull())
c = ' ';
painter.drawText(rect.translated(1,0), Qt::AlignCenter, c);
}
}
painter.end();
return image;
}
示例9: qt_accHotKey
QString Q_GUI_EXPORT qt_accHotKey(const QString &text)
{
#ifndef QT_NO_SHORTCUT
if (text.isEmpty())
return text;
int fa = 0;
QChar ac;
while ((fa = text.indexOf(QLatin1Char('&'), fa)) != -1) {
++fa;
if (fa < text.length()) {
// ignore "&&"
if (text.at(fa) == QLatin1Char('&')) {
++fa;
continue;
} else {
ac = text.at(fa);
break;
}
}
}
if (ac.isNull())
return QString();
return (QString)QKeySequence(Qt::ALT) + ac.toUpper();
#else
Q_UNUSED(text);
return QString();
#endif
}
示例10: setTabFillChar
void Tabruler::setTabFillChar(QChar t)
{
if (t.isNull())
{
tabFillCombo->setEditable(false);
tabFillCombo->setCurrentIndex(0);
}
else if (t == '.')
{
tabFillCombo->setEditable(false);
tabFillCombo->setCurrentIndex(1);
}
else if (t == '-')
{
tabFillCombo->setEditable(false);
tabFillCombo->setCurrentIndex(2);
}
else if (t == '_')
{
tabFillCombo->setEditable(false);
tabFillCombo->setCurrentIndex(3);
}
else
{
tabFillCombo->setCurrentIndex(4);
tabFillCombo->setEditable(true);
setCurrentComboItem(tabFillCombo, CommonStrings::trCustomTabFill+QString(t));
}
emit tabrulerChanged();
emit tabsChanged();
}
示例11: readMultiLineComment
FormatToken Scanner::readMultiLineComment(int literalId)
{
saveState(State_MultiLineComment, QChar(static_cast<ushort>(literalId)));
for(;;) {
QChar ch = m_src.peek();
if(ch.isNull())
break;
if(ch == QLatin1Char(']'))
{
bool bMatching = true;
for(int i=0; i < literalId; ++i)
{
if(m_src.peek(i+1) != QLatin1Char('='))
{
bMatching = false;
break;
}
}
if(bMatching && m_src.peek(literalId+1) == QLatin1Char(']'))
{
clearState();
m_src.move(literalId+2);
break;
}
}
m_src.move();
}
return FormatToken(Format_MLComment, m_src.anchor(), m_src.length());
}
示例12: decodeStr
void HTML::decodeStr(QString* str)
{
int index = 0;
QChar decodedChar;
QStringList res;
QRegExp entityParser("(&([a-zA-Z]+);)",Qt::CaseInsensitive);
QRegExp directCharParser("(&#([0-9]+);)",Qt::CaseInsensitive);
qDebug() << "Checking" << *str;
while (index > -1) {
index = directCharParser.indexIn(*str,index+1);
res = directCharParser.capturedTexts();
if (index != -1) {
decodedChar = QChar(directCharParser.cap(2).toInt());
str->replace(res.at(1), decodedChar);
qDebug() << *str;
}
}
index = 0;
while((index = entityParser.indexIn(*str,index)) != -1)
{
index++;
decodedChar = resolveEntity(entityParser.cap(2));
qDebug() << "Decoding in " << entityParser.cap(1) << ":" << entityParser.cap(2) << " to " << decodedChar << "(" << decodedChar.isNull()<<")";
if (!decodedChar.isNull()) {
qDebug() << "Replacing in " << entityParser.cap(1) << ":" << entityParser.cap(2) << " to " << decodedChar;
str->replace(entityParser.cap(1),QString(decodedChar));
}
}
}
示例13: keyPressEvent
void CodeEditor::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Return:
case Qt::Key_Enter:
{
QTextCursor tc = textCursor();
QString t = tc.block().text();
QString spaces;
QChar *data = t.data();
while (!data->isNull() && data->isSpace()) {
spaces.append(*data);
++data;
}
QPlainTextEdit::keyPressEvent(event);
insertPlainText(spaces);
}
break;
case Qt::Key_F1:
insertPlainText("\t");
break;
default:
QPlainTextEdit::keyPressEvent(event);
}
}
示例14: readArgument
QString Lexer::readArgument()
{
int count = 0;
QString arg;
readWhiteSpaces();
while( currentChar() ){
readWhiteSpaces();
QChar ch = currentChar();
if( ch.isNull() || (!count && (ch == ',' || ch == ')')) )
break;
Token tk(m_source);
nextToken( tk );
if( tk == '(' ){
++count;
} else if( tk == ')' ){
--count;
}
if( tk != -1 )
arg += tk.text() + " ";
}
return arg.stripWhiteSpace();
}
示例15: sendMessage
void IpcMsg::sendMessage(QString msg)
{
auto shm = new QSharedMemory("TimeTrackShm");
shm->attach();
shm->lock();
// send the message
char *to = (char*)shm->data();
QChar *data = msg.data();
while(!data->isNull()){
memset(to, data->toLatin1(), 1);
++data;
++to;
}
memset(to, 0, 1);
shm->unlock();
delete shm;
// unlock the listener
auto sem = new QSystemSemaphore(
"TimeTrackSem", 0, QSystemSemaphore::Open);
sem->release();
delete sem;
}