【问题标题】:Reading from barcode as one input从条形码读取作为一个输入
【发布时间】:2013-10-07 01:06:29
【问题描述】:

我对@9​​87654323@ 信号有疑问,基本上我是从条形码读取的,但不幸的是,我的读取条形码是因为一系列输入女巫使textChanged() 多次发出。在 stackoverflow 上搜索给了我这两个问题:C# WinForm + Barcode Scanner input, TextChanged ErrorDetecting when a barcode scanner ends input,第一个解决方案我无法传输代码以使其对我有用(我不使用 C# 编写代码),第二个听起来很简单但是我无法阅读我的应用程序的结尾行:

connect(ui->matEdit, SIGNAL(textChanged(QString)), this, SLOT(GetEmployee(QString)));

void EmployeeDayLogger::GetEmployee(QString id)
{
    char c = id.toAscii();
    if(c == '\n')
    {

编译输出:

..\..\..\Qt\Qt4.8.3\include/QtCore/../../src/corelib/tools/qbytearray.h: In member function 'void EmployeeDayLogger::GetEmployee(QString)':
..\..\..\Qt\Qt4.8.3\include/QtCore/../../src/corelib/tools/qbytearray.h:383: error: 'QByteArray::operator QNoImplicitBoolCast() const' is private
..\employeedaylogger.cpp:152: error: within this context

【问题讨论】:

    标签: qt4 barcode barcode-scanner


    【解决方案1】:

    由于您的文本字段很可能包含整个条形码,请尝试:

    if (id.endsWith('\n'))
    

    【讨论】:

      猜你喜欢
      • 2015-07-08
      • 2012-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-06
      • 2014-08-10
      • 1970-01-01
      • 2016-06-07
      相关资源
      最近更新 更多