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. Mouse selection handler ?

Mouse selection handler ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.7k Views
  • 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.
  • P Offline
    P Offline
    Project try
    wrote on last edited by
    #1

    Is there a way to get the coordinates of a mouse selection ?

    I want to create something like a selecting in desktop/files , when you go to your desktop and click left button and drag it you can see a blue selecting " in windows at least " that you can select things using it..

    I want something like that , when the user clicks a button the mouse acts like it acts in files and select things and then return the coordinates or a graph view.

    Basically you know the tool called snipping tool in windows ? you know when you click the button it renders a thing that lets you select what you want ? that's what I want.

    can you direct me to a class or something that gives function that does the same job ?

    I used this:

    @

    QGraphicsView Graph(this);

    Graph.setInteractive(true);
    Graph.setDragMode(Graph.RubberBandDrag);

    @

    but it doesn't show the rubber or whatever it's called ,

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Project try
      wrote on last edited by
      #2

      I followed this:

      http://qt-project.org/doc/qt-4.8/qrubberband.html

      and it's working great except I want it to get the coordinates outside of my program not just inside it.

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

        I don't think you can control mouse events if they are outside of your application.
        If you need to grab a region of a screen then open a transparent borderless widget on a whole screen to pickup mouse events on the desktop.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Project try
          wrote on last edited by
          #4

          Thanks for answering , I didn't put the parent in the QtRubberband and it's working outside except I need my widget to me showing on the screen " not minimize " + I only can control top left area of my screen since the button that shows the rubber band is on top left.

          how could I use transparent borderless widget ? I'm using qt widget...

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andreyc
            wrote on last edited by
            #5

            BTW there is a "desktop screenshot example":http://qt-project.org/doc/qt-5/qtwidgets-desktop-screenshot-example.html in Qt.

            Maybe it will work for you.

            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