Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [PLEASE HELP] how to make a barcode receiver?
Forum Updated to NodeBB v4.3 + New Features

[PLEASE HELP] how to make a barcode receiver?

Scheduled Pinned Locked Moved Solved General and Desktop
57 Posts 9 Posters 13.8k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS SGaist

    Hi,

    To add to @raven-worx:

    • What OS are you developing on ?
    • How is your barcode seen by the system ?
    ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #6

    [EDITED]
    @SGaist Windows 10
    @raven-worx ,Yes the barcode scanner submit return/enter
    i had created a simple form and put in it a QLineEdit, QButton and Qlable
    and created a slot when i press the button it takes the lineedit text and put it in the lable
    also created a shortcut for the button when i return
    0_1534108510217_d417d81b-9d0c-41ff-b3e2-da7a9872773d-image.png
    0_1534108535258_6d93ce0b-b8b3-4737-8830-c443bbe4fee1-image.png
    0_1534108566717_5bb895d7-bd66-4e5f-b5f3-c4644e7e11f8-image.png
    0_1534108666666_232b4413-d0e4-4650-b8a6-c8809e2a097d-image.png
    I'm very sorry about the bad English because it's not my mother language.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #7

      So it's basilly seen as a keyboard, correct ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      ? 1 Reply Last reply
      0
      • SGaistS SGaist

        So it's basilly seen as a keyboard, correct ?

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #8

        @SGaist edited and yes something like a keyboard

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #9

          Then you should check with the Windows API if you can target that specific device.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • ? A Former User

            I'm trying to make a shop manger application and i want to make a barcode receiver .
            when I connect my barcode reader and point to a barcode it inserts the barcode numbers and press enter automatically, so i want to make a Qtextbox always waiting for input even if it wasn't the active widget.

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #10

            @davidlabib said in [PLEASE HELP] how to make a barcode receiver?:

            i want to make a Qtextbox always waiting for input even if it wasn't the active widget

            This is not the original/intended behavior of this widget or any other related widget. The keyboard input is directed to the widget having the focus.

            Given that said:

            1. have you seen any other application working the way you want?
            2. I'd say you may want to override the keyPressEvent() method in MainWindow class and when you "detect a barcode" given the focus is not on it, you paste the value received to it. See this SO question for a related matter.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            1
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by A Former User
              #11

              @Pablo-J-Rogina

              1. you almost understand me yes in this quote
              1. I'd say you may want to override the keyPressEvent() method in MainWindow class and when you "detect a barcode" given the focus is not on it, you paste the value received to it. See this SO question for a related matter.
              1. i know that making a Qtextbox always waiting for input is impossible but it was a phrase describe what i want (something like that) i mean

              2. SO question is not what i mean

              what i mean exactly is
              at any time and under any condition when the barcode scanner hardware detetect any barcaode it will do_something()

              Pablo J. RoginaP 1 Reply Last reply
              0
              • ? A Former User

                @Pablo-J-Rogina

                1. you almost understand me yes in this quote
                1. I'd say you may want to override the keyPressEvent() method in MainWindow class and when you "detect a barcode" given the focus is not on it, you paste the value received to it. See this SO question for a related matter.
                1. i know that making a Qtextbox always waiting for input is impossible but it was a phrase describe what i want (something like that) i mean

                2. SO question is not what i mean

                what i mean exactly is
                at any time and under any condition when the barcode scanner hardware detetect any barcaode it will do_something()

                Pablo J. RoginaP Offline
                Pablo J. RoginaP Offline
                Pablo J. Rogina
                wrote on last edited by
                #12

                @davidlabib said in [PLEASE HELP] how to make a barcode receiver?:

                at any time and under any condition when the barcode scanner hardware detetect any barcaode it will do_something()

                You've changed the requirements :-)
                In this case I'd say you need to change the barcode driver, and work at a lower level than Qt... so the driver code instead of pasting the decoded text/numbers into the keyboard buffer does some kind of notification that your application can trap. But it looks like that work it's out of scope for Qt framework

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                jsulmJ 1 Reply Last reply
                1
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by A Former User
                  #13

                  @Pablo-J-Rogina
                  can you send me your number on whatsapp or telegram or any other messenger so we can have a long conversation in private and after we got the solution i will post it in this topic so other can benefits from it

                  Pablo J. RoginaP 1 Reply Last reply
                  0
                  • ? A Former User

                    @Pablo-J-Rogina
                    can you send me your number on whatsapp or telegram or any other messenger so we can have a long conversation in private and after we got the solution i will post it in this topic so other can benefits from it

                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #14

                    @davidlabib please continue this way. I'm not sure I have enough spare time to go on privately. Thanks

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    2
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #15

                      @Pablo-J-Rogina
                      OK ,I'm developing a shop manager application.
                      I'm beginner on programing i had learned c++ just for a year or less
                      and now I'm learning qt lib.
                      i don't have problems with sqlite but have problems with the barcode
                      of course i can make a line edit and button when the button got clicked it will search on the database for the barcode and so on
                      but the problem is what if I selected another line edit and pointed the barcode scanner hardware to a barcode
                      it will type on the anther line edit not the barcode line edit
                      so what is your ideas to solve this problem .

                      1 Reply Last reply
                      0
                      • Pablo J. RoginaP Pablo J. Rogina

                        @davidlabib said in [PLEASE HELP] how to make a barcode receiver?:

                        at any time and under any condition when the barcode scanner hardware detetect any barcaode it will do_something()

                        You've changed the requirements :-)
                        In this case I'd say you need to change the barcode driver, and work at a lower level than Qt... so the driver code instead of pasting the decoded text/numbers into the keyboard buffer does some kind of notification that your application can trap. But it looks like that work it's out of scope for Qt framework

                        jsulmJ Online
                        jsulmJ Online
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #16

                        @Pablo-J.-Rogina said in [PLEASE HELP] how to make a barcode receiver?:

                        at any time and under any condition when the barcode scanner hardware detetect any barcaode it will do_something()

                        Can't your barcode scanner just write to a string and you then put it in the correct line edit?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        ? 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @Pablo-J.-Rogina said in [PLEASE HELP] how to make a barcode receiver?:

                          at any time and under any condition when the barcode scanner hardware detetect any barcaode it will do_something()

                          Can't your barcode scanner just write to a string and you then put it in the correct line edit?

                          ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by A Former User
                          #17

                          @jsulm
                          yes it write to a string
                          but it cannot put this string in the correct line edit
                          and what if a button is selected
                          0_1534367535920_542f4758-8857-46ef-8892-598bb52a2f78-image.png
                          not line edit

                          jsulmJ 1 Reply Last reply
                          0
                          • ? A Former User

                            @jsulm
                            yes it write to a string
                            but it cannot put this string in the correct line edit
                            and what if a button is selected
                            0_1534367535920_542f4758-8857-46ef-8892-598bb52a2f78-image.png
                            not line edit

                            jsulmJ Online
                            jsulmJ Online
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #18

                            @davidlabib To put a string into a line edit this line edit does not need to have focus!
                            Simply:

                            ui->lineEdit_1->setText(someText);
                            

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            Pablo J. RoginaP 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @davidlabib To put a string into a line edit this line edit does not need to have focus!
                              Simply:

                              ui->lineEdit_1->setText(someText);
                              
                              Pablo J. RoginaP Offline
                              Pablo J. RoginaP Offline
                              Pablo J. Rogina
                              wrote on last edited by Pablo J. Rogina
                              #19

                              @jsulm I think his problem is at a lower level, not just set the "text" for the proper line edit.

                              Most barcode reader drivers mimic the keyboard, so when they scan something they place the data read like the keyboard, and SO is facing the issue that if focus is with another widget, not the line edit, if a scan is done that data will go there, or as his last example with the button, lost.

                              Upvote the answer(s) that helped you solve the issue
                              Use "Topic Tools" button to mark your post as Solved
                              Add screenshots via postimage.org
                              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                              1 Reply Last reply
                              0
                              • ? Offline
                                ? Offline
                                A Former User
                                wrote on last edited by
                                #20

                                @Pablo-J-Rogina

                                @Pablo-J.-Rogina said in [PLEASE HELP] how to make a barcode receiver?:

                                Most barcode reader drivers mimic the keyboard, so when they scan something they place the data read like the keyboard, and SO is facing the issue that if focus is with another widget, not the line edit, if a scan is done that data will go there, or as his last example with the button, lost.

                                that's exactly what I'm talking about
                                You completely understand me

                                but i don't think that it's a lower level problem
                                i think that making thread always waiting for input 13 digit --any right barcode in the world contain 13 digit-- less than 1 second
                                if the input was 13 digit and inputted less than a second then it's a barcode and deal with it as a barcode
                                else what for input again

                                Pablo J. RoginaP 1 Reply Last reply
                                0
                                • ? A Former User

                                  @Pablo-J-Rogina

                                  @Pablo-J.-Rogina said in [PLEASE HELP] how to make a barcode receiver?:

                                  Most barcode reader drivers mimic the keyboard, so when they scan something they place the data read like the keyboard, and SO is facing the issue that if focus is with another widget, not the line edit, if a scan is done that data will go there, or as his last example with the button, lost.

                                  that's exactly what I'm talking about
                                  You completely understand me

                                  but i don't think that it's a lower level problem
                                  i think that making thread always waiting for input 13 digit --any right barcode in the world contain 13 digit-- less than 1 second
                                  if the input was 13 digit and inputted less than a second then it's a barcode and deal with it as a barcode
                                  else what for input again

                                  Pablo J. RoginaP Offline
                                  Pablo J. RoginaP Offline
                                  Pablo J. Rogina
                                  wrote on last edited by
                                  #21

                                  @davidlabib said in [PLEASE HELP] how to make a barcode receiver?:

                                  always waiting for input 13 digit --any right barcode in the world contain 13 digit

                                  Be careful with this assumption, think of EAN 8 for instance...

                                  Like the UPC code, there is the EAN-13 symbology with 13 digits, and an abbreviated EAN barcode called the EAN-8 with only 8 digits for smaller goods where space is limited.

                                  Upvote the answer(s) that helped you solve the issue
                                  Use "Topic Tools" button to mark your post as Solved
                                  Add screenshots via postimage.org
                                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                  1 Reply Last reply
                                  2
                                  • ? Offline
                                    ? Offline
                                    A Former User
                                    wrote on last edited by
                                    #22

                                    @Pablo-J-Rogina thanks for the warning
                                    @mrjj take a look here i think you faced this type of problems
                                    https://forum.qt.io/topic/71310/reading-barcode-from-barcode-scanner

                                    mrjjM Pablo J. RoginaP 2 Replies Last reply
                                    0
                                    • ? A Former User

                                      @Pablo-J-Rogina thanks for the warning
                                      @mrjj take a look here i think you faced this type of problems
                                      https://forum.qt.io/topic/71310/reading-barcode-from-barcode-scanner

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by mrjj
                                      #23

                                      @davidlabib

                                      Yes, that very normal issues when using a
                                      scanner in HID mode so it acts like a keyboard.

                                      I usually put a button next to input that says scan and it popup dialog
                                      to do the scanning in.

                                      There is no easy solution to what you try. as unless NOTHING else can have focus. ( you can disable focus for buttons) then user might switch to other edit fields.

                                      Often scanner input is terminated with \n\r or similar- check the documentation
                                      for the scanner.

                                      1 Reply Last reply
                                      3
                                      • ? A Former User

                                        @Pablo-J-Rogina thanks for the warning
                                        @mrjj take a look here i think you faced this type of problems
                                        https://forum.qt.io/topic/71310/reading-barcode-from-barcode-scanner

                                        Pablo J. RoginaP Offline
                                        Pablo J. RoginaP Offline
                                        Pablo J. Rogina
                                        wrote on last edited by
                                        #24

                                        @davidlabib I did some grocery shopping yesterday, and looking at the point of sale software the clerk used when I checked out, and also thinking about the shopping cart and checkout process in websites, I wonder why do you need this "always on" scanning phase?

                                        I mean, maybe you're overcomplicating your requirements. Do you really have such use case from an actual user/customer of your application?

                                        While checking out most of the software overthere that I remember have some steps/phases:

                                        1. Initial data (optional)
                                        2. 1-N items scanning (using barcode reader!!) so focus is there for just one widget (a list where scanned items are added, or a line edit where you click a "Add" button, whatever)
                                        3. When you are ready (by self-checkout or a clerk helping you) a "Proceeed to checkout" button move to next phase, i.e. Delivery information or just Payment (at this point if credit card is read, again focus is only for reading the credit card data)
                                        4. "Finish" button to print receipt and move into next customer...

                                        Is your use case completely different from this scenario? if so, why!?

                                        Upvote the answer(s) that helped you solve the issue
                                        Use "Topic Tools" button to mark your post as Solved
                                        Add screenshots via postimage.org
                                        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                        1 Reply Last reply
                                        2
                                        • ? Offline
                                          ? Offline
                                          A Former User
                                          wrote on last edited by
                                          #25

                                          the only payment method is cash only (for now), so we can skip 3

                                          It's not very require to make focus when the barcode input something but i thought that it will be a good extra feature in the application

                                          mrjjM raven-worxR 2 Replies Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved