mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
define V_ASSERT()
Q_ASSERT() takes no effect in release mode. V_ASSERT() is still valid in release mode.
This commit is contained in:
parent
584472f902
commit
9bc8f36733
@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
|
|
||||||
|
#if !defined(V_ASSERT)
|
||||||
|
#define V_ASSERT(cond) ((!(cond)) ? qt_assert(#cond, __FILE__, __LINE__) : qt_noop())
|
||||||
|
#endif
|
||||||
|
|
||||||
class VUtils
|
class VUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -671,7 +671,7 @@ void VMdEditOperations::insertNewBlockWithIndent()
|
|||||||
QString text = block.text();
|
QString text = block.text();
|
||||||
QRegExp regExp("(^\\s*)");
|
QRegExp regExp("(^\\s*)");
|
||||||
regExp.indexIn(text);
|
regExp.indexIn(text);
|
||||||
Q_ASSERT(regExp.captureCount() == 1);
|
V_ASSERT(regExp.captureCount() == 1);
|
||||||
QString leadingSpaces = regExp.capturedTexts()[1];
|
QString leadingSpaces = regExp.capturedTexts()[1];
|
||||||
cursor.insertBlock();
|
cursor.insertBlock();
|
||||||
cursor.insertText(leadingSpaces);
|
cursor.insertText(leadingSpaces);
|
||||||
@ -688,7 +688,7 @@ void VMdEditOperations::insertListMarkAsPreviousLine()
|
|||||||
QRegExp regExp("^\\s*(-|\\d+\\.)\\s");
|
QRegExp regExp("^\\s*(-|\\d+\\.)\\s");
|
||||||
int regIdx = regExp.indexIn(text);
|
int regIdx = regExp.indexIn(text);
|
||||||
if (regIdx != -1) {
|
if (regIdx != -1) {
|
||||||
Q_ASSERT(regExp.captureCount() == 1);
|
V_ASSERT(regExp.captureCount() == 1);
|
||||||
cursor.beginEditBlock();
|
cursor.beginEditBlock();
|
||||||
QString markText = regExp.capturedTexts()[1];
|
QString markText = regExp.capturedTexts()[1];
|
||||||
if (markText == "-") {
|
if (markText == "-") {
|
||||||
@ -696,10 +696,10 @@ void VMdEditOperations::insertListMarkAsPreviousLine()
|
|||||||
cursor.insertText("- ");
|
cursor.insertText("- ");
|
||||||
} else {
|
} else {
|
||||||
// markText is like "123.".
|
// markText is like "123.".
|
||||||
Q_ASSERT(markText.endsWith('.'));
|
V_ASSERT(markText.endsWith('.'));
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int num = markText.left(markText.size() - 1).toInt(&ok, 10);
|
int num = markText.left(markText.size() - 1).toInt(&ok, 10);
|
||||||
Q_ASSERT(ok);
|
V_ASSERT(ok);
|
||||||
num++;
|
num++;
|
||||||
cursor.insertText(QString::number(num, 10) + ". ");
|
cursor.insertText(QString::number(num, 10) + ". ");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user