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. Question about modal file open dialog box
Forum Updated to NodeBB v4.3 + New Features

Question about modal file open dialog box

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k 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.
  • D Offline
    D Offline
    dolevo
    wrote on last edited by
    #1

    I use QWebView in my application and at a certain point I open a File Digalog Box to let user choose a file from his computer. However, this box comes modal and I can't, for example, move the mouse cursor to a certain location. What happens is that, the mouse cursor moves after the user selects the file, after the dialog box is closed. Could anyone tell me how I make it non-modal? How I can move the mouse cursor to a specific target after I open a Dialog Box?
    Note: Dialog Box is opened after clicking a file upload button on the html page loaded into QWebView.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Well any dialog has a setModal(true/false) method but since it's provided by the webview I don't think you get any access to it (I might be wrong).

      You can move cursor with "QCursor::setPos()":http://qt-project.org/doc/qt-5/qcursor.html#setPos

      Out of curiosity - what's wrong with cursor moving after the dialog? Isn't it considered annoying if an app moves your cursor around? I could imagine a multi-screen situation when I open a dialog, move it to the other screen, select something and bam! my cursor is gone and I need to furiously move my mouse to spot the cursor and figure out it moved back to the other screen. Man I hate that :P

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dolevo
        wrote on last edited by
        #3

        Hi Chris,

        You are right that it is annoying moving mouse cursor is a bit annoying but I am actually trying to simulate user clicks to upload preselected file from the computer. As an example, to upload an image to a very well known image hosting services, you have to click on a upload button and select the image file in your computer and it uploads it for you. However, I am trying to do the same thing for a folder where I have all my images. Instead of clicking one by one, I want to simulate this action for all images in the folder.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Oh, ok. In that case I think you're going at it the wrong way. What if the "very well known image hosting service" changes layout (not uncommon) and moves the button just enough that you're now clicking on something else like a popup ad?
          Image hosts usually have an API that you can use to upload stuff. I would go that way instead of hacking around and hijacking user property (the cursor) ;)

          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