简体   繁体   English

拖放到特定区域| t

[英]Drag and Drop in a specific Area | Qt

I have a MainWindow and inside the MainWindow there is QTextEdit. 我有一个MainWindow,并且在MainWindow中有QTextEdit。 I want to do 我想要做

setAcceptDrop(true) setAcceptDrop(true)

in QTextEdit only ie, I do not want drop enabled in the MainWindow but it should be enabled in QTextedit. 仅在QTextEdit中,即,我不想在MainWindow中启用放置,但应该在QTextedit中启用它。 I have seen some examples and everywhere I have found them to be implementing the drag and drop mechanism on the MainWindow so it automatically gets implemented on QTextEdit but I want it to be implemented in QTextEdit specifically. 我已经看到了一些示例,到处都发现它们在MainWindow上实现了拖放机制,因此它会自动在QTextEdit上实现,但我希望专门在QTextEdit中实现。

I have attached an image of a sample application for the reference! 我已附上示例应用程序的图像以供参考!

Example

ui->textEdit->setAcceptDrops(true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM