I've got c++ regex object
smatch matches;
regex pattern("key(\\d{3}\\w{1})");
By regex_search()
function I'm searching with success for my pattern.
As a result I execute working command: cout << matches[1]; // sub_match as output.
In my Qt application I would like to show result is QTextEdit
or any other widget.
I tried:
QTextEdit *textEdit = new QTextEdit();
textEdit->setText(QString("%1:").arg(matches[1]));
but as a result:
error C2664: 'QString QString::arg(qlonglong,int,int,QChar) const' : cannot convert parameter 1 from 'const std::sub_match<_BidIt>' to 'qlonglong'
1> with
1> [
1> _BidIt=std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Could someone please give any ideas how to handle this ? I know that there is QRegExp
class, but does it have similar regex_search()
function ? I'd rather prefer solution with my current code.
Thanks in advance!