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. Two questions about QDialog
Forum Updated to NodeBB v4.3 + New Features

Two questions about QDialog

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 280 Views 3 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1
    1. I have currently got code like this:
    void DropFilesDlg::showEvent(QShowEvent* event)
    {
    	if (!event->spontaneous())
    	{
    		if (!initialised)
    		{
    			initialised = true;
    			onInitDialog();
    		}
    	}
    	// Invoke base class showEvent()
    	return Inherited::showEvent(event);
    }
    

    which invokes an mf to setup the dialog

    Should I instead be using onActivateWindow?

    1. If in that code (either onInitDialog or onActivateWindow) I decide that I don't actually want to display the dialog how can I do that?

    Why - maybe we only accept files with extension .xyzzy and the user only dropped other filetypes...

    Thanks
    David

    SGaistS 1 Reply Last reply
    0
    • PerdrixP Perdrix
      1. I have currently got code like this:
      void DropFilesDlg::showEvent(QShowEvent* event)
      {
      	if (!event->spontaneous())
      	{
      		if (!initialised)
      		{
      			initialised = true;
      			onInitDialog();
      		}
      	}
      	// Invoke base class showEvent()
      	return Inherited::showEvent(event);
      }
      

      which invokes an mf to setup the dialog

      Should I instead be using onActivateWindow?

      1. If in that code (either onInitDialog or onActivateWindow) I decide that I don't actually want to display the dialog how can I do that?

      Why - maybe we only accept files with extension .xyzzy and the user only dropped other filetypes...

      Thanks
      David

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should reject the drag and drop event if the proposed file type is not what is allowed on the widget. That way you don't have to do things like that.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      PerdrixP 1 Reply Last reply
      3
      • SGaistS SGaist

        Hi,

        You should reject the drag and drop event if the proposed file type is not what is allowed on the widget. That way you don't have to do things like that.

        PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        @SGaist That sort of works for a file drag/drop ... not so much if a directory containing a mix of files is dropped.

        If you know the answer to my first Q that would be great...

        PS I've moved the drop processing to the code the invokes the dlg so the 2nd. issue is resolved.
        Thanks
        David

        SGaistS 1 Reply Last reply
        0
        • PerdrixP Perdrix

          @SGaist That sort of works for a file drag/drop ... not so much if a directory containing a mix of files is dropped.

          If you know the answer to my first Q that would be great...

          PS I've moved the drop processing to the code the invokes the dlg so the 2nd. issue is resolved.
          Thanks
          David

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Perdrix do you mean your question about onActivateWindow ? The thing is that I don't know what that function does and when it is called.

          As for folders, are folders allowed ? Should only a subset of files be processed ? That's again something you should manage on drop.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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