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. New to Qt! Simple button to control peripherals
Qt 6.11 is out! See what's new in the release blog

New to Qt! Simple button to control peripherals

Scheduled Pinned Locked Moved General and Desktop
6 Posts 5 Posters 4.3k Views 1 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.
  • V Offline
    V Offline
    valerio.j
    wrote on last edited by
    #1

    Hello,

    My name is Jose and I'm new to Qt. I've used C# and C++ before to create very basic UIs, I'm not an expert, but I really like what I see and read about Qt and will like to get familiar with it. Ok done with that!!

    I'm trying to create a simple UI in Qt to communicate via the COM port with a microchip. I already have my own C++ .dll for the COM port, and the microchip side I can take care of.
    So basically I need a button and an indicator for the UI. There will be only two stages ON/OFF and the state must be reflected on the indicator. I've created two indicators (images) using GIMP(I call it "LED_OFF" and "LED_ON") one is black (off) one is green (on).
    So basically when the button is pressed and if the indicator is OFF then a turnON signal will be sent out over the COM port and the opposite when it's on. The indicator on the UI will display the current state at all times.

    Maybe I wrote too much, but I hope someone get's what I'm trying to do and point me in the right direction as to what the best approach to accomplish this with Qt will be. Also I need this to be compatible with Windows XP or greater and Linux (Ubuntu 11.03)

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Sounds like a perfect job for a custom widget (i.e. custom drawing). You can give a look to the "embedded widgets" demo for inspiration:

      http://qt.nokia.com/qt-in-use/developer/embedded-widget-demos

      (see the links in the lower right corner).

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        "Here":http://qt-apps.org/index.php?xcontentmode=4298, you can find a collection of Qt Widgets you can use. Among them, are a few LED-type widgets. Perhaps you can use those?

        Edit:
        Forgot to actually set the "link":http://qt-apps.org/index.php?xcontentmode=4298 for "Here".

        1 Reply Last reply
        0
        • T Offline
          T Offline
          TobbY
          wrote on last edited by
          #4

          would you provide some code?? you can create desktop based button which can communicate via COM port

          1 Reply Last reply
          0
          • S Offline
            S Offline
            soroush
            wrote on last edited by
            #5

            Maybe you need to use ordinary widgets with custom styles? For example a toggle button or radio button...
            I suggest take a look at "Style Sheets":http://doc.qt.nokia.com/latest/qradiobutton.html

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TobbY
              wrote on last edited by
              #6

              it would take only less than 30 minutes to do that. in desktop application select form and create two push buttons, right click on button and choose signal and slot(on Clicked()), it will provide you function where you can put your code to pass HEX or binary signal to COM port to set or reset.

              1 Reply 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