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;
|
||||
|
||||
#if !defined(V_ASSERT)
|
||||
#define V_ASSERT(cond) ((!(cond)) ? qt_assert(#cond, __FILE__, __LINE__) : qt_noop())
|
||||
#endif
|
||||
|
||||
class VUtils
|
||||
{
|
||||
public:
|
||||
|
@ -671,7 +671,7 @@ void VMdEditOperations::insertNewBlockWithIndent()
|
||||
QString text = block.text();
|
||||
QRegExp regExp("(^\\s*)");
|
||||
regExp.indexIn(text);
|
||||
Q_ASSERT(regExp.captureCount() == 1);
|
||||
V_ASSERT(regExp.captureCount() == 1);
|
||||
QString leadingSpaces = regExp.capturedTexts()[1];
|
||||
cursor.insertBlock();
|
||||
cursor.insertText(leadingSpaces);
|
||||
@ -688,7 +688,7 @@ void VMdEditOperations::insertListMarkAsPreviousLine()
|
||||
QRegExp regExp("^\\s*(-|\\d+\\.)\\s");
|
||||
int regIdx = regExp.indexIn(text);
|
||||
if (regIdx != -1) {
|
||||
Q_ASSERT(regExp.captureCount() == 1);
|
||||
V_ASSERT(regExp.captureCount() == 1);
|
||||
cursor.beginEditBlock();
|
||||
QString markText = regExp.capturedTexts()[1];
|
||||
if (markText == "-") {
|
||||
@ -696,10 +696,10 @@ void VMdEditOperations::insertListMarkAsPreviousLine()
|
||||
cursor.insertText("- ");
|
||||
} else {
|
||||
// markText is like "123.".
|
||||
Q_ASSERT(markText.endsWith('.'));
|
||||
V_ASSERT(markText.endsWith('.'));
|
||||
bool ok = false;
|
||||
int num = markText.left(markText.size() - 1).toInt(&ok, 10);
|
||||
Q_ASSERT(ok);
|
||||
V_ASSERT(ok);
|
||||
num++;
|
||||
cursor.insertText(QString::number(num, 10) + ". ");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user