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. Right click with mouse
Qt 6.11 is out! See what's new in the release blog

Right click with mouse

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 6.1k 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.
  • M Offline
    M Offline
    maxguevara
    wrote on last edited by
    #1

    Hello.
    I made a minesweeper game and i want to implement the "put flag" function.
    I want to put the flag on a PushButton by right clicking.

    How can i implement that?

    Some sort of

    "If rightClick

    then put flag"

    many thanks.

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

      Override the mouse events and implement the logic.

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        maxguevara
        wrote on last edited by
        #3

        How?

        Is there an example available?

        Thanks.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          You can overwrite the mouse event of the button "mousePressEvent":http://doc.qt.nokia.com/4.7/qwidget.html#mousePressEvent or install an event Filter for the buttons in you parent class. How to do that, have a look at the documentation. How to do that, "have a look at the docs":http://doc.qt.nokia.com/4.7/qobject.html#installEventFilter

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • M Offline
            M Offline
            maxguevara
            wrote on last edited by
            #5

            Many thanks :-)

            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