Results 1 to 20 of 20

Thread: Flickering mouse pointer

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    29
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Flickering mouse pointer

    An extremely simple text editor accepts external file drop changing its title:
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6. setAcceptDrops(true);
    7. }
    8.  
    9. void MainWindow::dragEnterEvent(QDragEnterEvent *event)
    10. {
    11. event->accept();
    12. }
    13.  
    14. void MainWindow::dragMoveEvent(QDragMoveEvent *event)
    15. {
    16. event->accept();
    17. }
    18.  
    19. void MainWindow::dropEvent(QDropEvent *event)
    20. {
    21. if (event->mimeData()->hasFormat("text/uri-list")) {
    22. QList<QUrl> urls = event->mimeData()->urls();
    23. if (urls.isEmpty())
    24. return;
    25. QString fileName = urls.first().toLocalFile();
    26. if (fileName.isEmpty())
    27. return;
    28. setWindowTitle(tr("%1 - %2").arg(fileName).arg(tr("Drag File")));
    29. }
    30. }
    To copy to clipboard, switch view to plain text mode 
    MainWindow has just one widget, textEdit, defined by:
    Qt Code:
    1. MyTextEdit::MyTextEdit(QWidget *parent)
    2. : QTextEdit(parent)
    3. {
    4. setAcceptDrops(true);
    5. }
    6.  
    7. void MyTextEdit::dragEnterEvent(QDragEnterEvent *e)
    8. {
    9. if (e->source()) {
    10. if (e->source() == viewport()) {
    11. e->accept();
    12. }
    13. }
    14. }
    To copy to clipboard, switch view to plain text mode 
    textEdit accepts only "self" drops, so inserted text can then be moved or copied.
    What is the reason of the pointer flickering? How can i remove it?
    Thanks.
    Last edited by guiQt; 31st August 2010 at 17:25.

Similar Threads

  1. Is it possible to hide mouse pointer??
    By webquinty in forum Newbie
    Replies: 5
    Last Post: 24th November 2009, 14:57
  2. changing mouse pointer
    By bhogasena in forum Qt Programming
    Replies: 2
    Last Post: 29th January 2009, 15:57
  3. free mouse pointer
    By raflegan in forum Qt Programming
    Replies: 1
    Last Post: 1st October 2008, 14:11
  4. How can I hide the mouse pointer?
    By dimaz in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2008, 19:08
  5. Scribble example: problem with mouse pointer
    By srinath1986 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th February 2008, 13:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.