Search related threads. Remove From My Forums. Answered by:. Archived Forums. Visual Basic. Not for VB6 questions. Sign in to vote.
Hallo Everyone, I need some help for which I will be very grateful. Can anyone please help me out. Thank you for taking your time to read my post. Tuesday, October 14, AM. I dont know why it is not working with me. Length - 1 Console. To be able to receive media dropped on a widget, call setAcceptDrops true for the widget, and reimplement the dragEnterEvent and dropEvent event handler functions.
For example, the following code enables drop events in the constructor of a QWidget subclass, making it possible to usefully implement drop event handlers:. The dragEnterEvent function is typically used to inform Qt about the types of data that the widget accepts. The following code shows how dragEnterEvent can be reimplemented to tell the drag and drop system that we can only handle plain text:.
The dropEvent is used to unpack dropped data and handle it in way that is suitable for your application. In this case, we accept the proposed action without checking what it is. In a real world application, it may be necessary to return from the dropEvent function without accepting the proposed action or handling the data if the action is not relevant. For example, we may choose to ignore Qt::LinkAction actions if we do not support links to external sources in our application.
We may also ignore the proposed action, and perform some other action on the data. To do this, we would call the event object's setDropAction with the preferred action from Qt::DropAction before calling accept. This ensures that the replacement drop action is used instead of the proposed action. For more sophisticated applications, reimplementing dragMoveEvent and dragLeaveEvent will let you make certain parts of your widgets sensitive to drop events, and give you more control over drag and drop in your application.
Certain standard Qt widgets provide their own support for drag and drop. When subclassing these widgets, it may be necessary to reimplement dragMoveEvent in addition to dragEnterEvent and dropEvent to prevent the base class from providing default drag and drop handling, and to handle any special cases you are interested in.
In the simplest case, the target of a drag and drop action receives a copy of the data being dragged, and the source decides whether to delete the original. This is described by the CopyAction action. The target may also choose to handle other actions, specifically the MoveAction and LinkAction actions.
If the source calls QDrag::exec , and it returns MoveAction , the source is responsible for deleting any original data if it chooses to do so. The target is responsible for taking ownership of the data sent in the drag and drop operation; this is usually done by keeping references to the data.
If the target understands the LinkAction action, it should store its own reference to the original information; the source does not need to perform any further processing on the data. The most common use of drag and drop actions is when performing a Move within the same widget; see the section on Drop Actions for more information about this feature. Drag and drop is not limited to text and images. Any type of information can be transferred in a drag and drop operation.
To drag information between applications, the applications must be able to indicate to each other which data formats they can accept and which they can produce. This is achieved using MIME types. The QDrag object constructed by the source contains a list of MIME types that it uses to represent the data ordered from most appropriate to least appropriate , and the drop target uses one of these to access the data.
For common data types, the convenience functions handle the MIME types used transparently but, for custom data types, it is necessary to state them explicitly. Using standard MIME types maximizes the interoperability of your application with other software now and in the future. This download package contains all the files of the original release including all example files and demos!
Loads of extensions available, especially for game development, but also for applications: Move to download section Libraries for details. Quickbasic Extended 7. Download and install VM Player 2. Now you'll have four options: 1. Run QBasic 1. Run QuickBasic 4.
0コメント