Results 1 to 5 of 5

Thread: Trying to get simple button-down working?

  1. #1
    Join Date
    Jul 2018
    Location
    Minneapolis, MN USA
    Posts
    7
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Exclamation Trying to get simple button-down working?

    Hello,

    I have about 2-weeks of Qt experience so am very much a beginner.

    Here is my setup:
    Qt 5.11 running on Ubuntu 16.04
    Beaglebone Black target SBC running latest Debian build
    Adafruit 800x480 HDMI/USB touchscreen display

    Here is where I am at:
    Built a basic widget program with buttons and text-box
    Downloaded to SBC
    Able to display and drag cursor to button area and click (display is running in “digitizer”mode as was unable to get it to work in mouse mode)
    Signals and slots work as on-click produces output in text-box as desired

    Here is the seemingly simple thing I want to accomplish:
    Instead of dragging the mouse and clicking the button I want to press the touch-screen in the button area and have it activate (button-down).

    I am on a very tight time-frame to get this to work. I started looking at the button class, mouse class, and touch-screen class but not sure which if any of these are going to accomplish this. Any assistance or examples would be appreciated, thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Trying to get simple button-down working?

    Maybe this will help: From the QTouchEvent documentation:

    To receive touch events, widgets have to have the Qt::WA_AcceptTouchEvents attribute set
    Call QWidget::setAttribute() through your QPushButton pointer:

    Qt Code:
    1. myButton->setAttribute( Qt::WA_AcceptTouchEvents );
    To copy to clipboard, switch view to plain text mode 
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jul 2018
    Location
    Minneapolis, MN USA
    Posts
    7
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Trying to get simple button-down working?

    Thanks but that doesn't exactly fix the problem. I really don't want a mouse or mouse pointer at all, just the buttons and button presses. When the mouse is not focused on the button pressing the button (or anywhere on the touchpad) is intercepted as a mouse click and not handled by the pushbutton. Should I be writing this as a Qt Quick project or am I starting with the wrong base class/

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Trying to get simple button-down working?

    If you read further in the Qt::WidgetAttribute documentation, you will find this: Qt::WA_TransparentForMouseEvents. If that still doesn't do what you want, you may have to install an event filter on your buttons and eat mouse events. QObject::installEventFilter().
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Jul 2018
    Location
    Minneapolis, MN USA
    Posts
    7
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Trying to get simple button-down working?

    Still no luck!

    There is a project https://startingelectronics.org/proj...ects/kiosk-Qt/ that is close to what I am trying to do in terms of the buttons. I actually downloaded this ant got it to build for the Beaglebone Black but when I run it there is no button press UNLESS the mouse is positioned over the button. I think the problem is that I am not using any kind of server ea. X11, I am writing directly to the linuxfb (./program -platform linuxfb)? I am using a HDMI display and USB touch-screen.

Similar Threads

  1. Replies: 0
    Last Post: 3rd May 2014, 10:36
  2. Simple removeRows isn't working...
    By scott_hollen in forum Qt Programming
    Replies: 3
    Last Post: 25th May 2011, 02:22
  3. Simple Widget ToolTips Not Working
    By powerofpi in forum Qt Programming
    Replies: 0
    Last Post: 22nd February 2011, 05:19
  4. simple button
    By wreckx in forum Newbie
    Replies: 6
    Last Post: 19th November 2010, 20:54
  5. can't get a simple dialog working
    By pthomas in forum Newbie
    Replies: 8
    Last Post: 13th January 2006, 15:52

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.