Results 1 to 11 of 11

Thread: Cursor is not changed when mouse is moving around the edges of a framed dockwidget

  1. #1
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Cursor is not changed when mouse is moving around the edges of a framed dockwidget

    Hi everyone,

    I've created a custom dockwidget with its custom titlebar. I've added a QFrame around the dockwidget and now, when the mouse is moving around the edges of the dockwidget, the cursor does not change to the sizehorcursor/sizevercursor shape.

    Any ideas?

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    My idea is you messed up something in your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    Hello again,

    I must have messed up the whole code completely by now...

    I'm still stuck with this issue. The thing is I don't know which widget/object/whatever is responsible for handling the cursor change when the mouse moves over the edges of a floating QDockwidget. Is this managed by the OS? (I hope not...)

    When I hide the QFrame, everything seems to work fine, but when it is shown, something gets lost.
    I want to give to my custom QDockWidget the appearance that a StyledPanel QFrame gives. Is there any other way to give that appearance getting rid of the QFrame? I couldn't add a "border" to the QDockWidget using stylesheets.

    Thank you.

  4. #4
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    Resizing works. The problem is that the cursor doesn't change if the QFrame is shown.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    Please prepare a minimal compilable example reproducing the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    Hi wysota, and thank you.
    I hope the following code helps to understand my problem. The area of the "dock" that is not covered by the "frame" works fine (shows the resizing arrows).


    Qt Code:
    1. ResizeArrowTest::ResizeArrowTest(QWidget *parent, Qt::WFlags flags)
    2. : QMainWindow(parent, flags)
    3. {
    4. ui.setupUi(this);
    5.  
    6. QDockWidget *dock = new QDockWidget(this);
    7. QWidget *titlebar = new QWidget();
    8. dock->setTitleBarWidget(titlebar);
    9. titlebar->show();
    10. dock->setAutoFillBackground(false);
    11. this->addDockWidget(Qt::LeftDockWidgetArea, dock);
    12. dock->setFloating(true);
    13. dock->setFeatures(QDockWidget::DockWidgetMovable);
    14. QFrame *frame = new QFrame(dock);
    15. frame->setFrameShape(QFrame::Shape::StyledPanel);
    16. frame->show();
    17.  
    18. }
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    Please make your example compilable and minimal.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    Sorry!
    I hope it is "minimal" and "compilable" now...

    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication a(argc, argv);
    6.  
    7. QDockWidget *dock = new QDockWidget();
    8. QWidget *titlebar = new QWidget();
    9. dock->setTitleBarWidget(titlebar);
    10. w.addDockWidget(Qt::LeftDockWidgetArea, dock);
    11. dock->setFloating(true);
    12. QFrame *frame = new QFrame(dock);
    13. frame->setFrameShape(QFrame::Shape::StyledPanel);
    14. frame->show();
    15. w.show();
    16.  
    17. return a.exec();
    18. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by harregui; 5th July 2011 at 09:29.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    Why would you expect the above code to change the cursor shape?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    As far as I understand, if I remove (or hide) the QFrame, it works as I want to.
    Then, if I add the QFrame, resizing the dockwidget with the mouse still works, so why shouldn't the cursor change the shape if resizing is available?

    My guess is: QFrame is handling some sort of event when the mouse is moving over the edges, and that event is missed by the object in charge of the cursor shaping. But which one is the event? Who is in charge of the cursor shaping? (the application, the OS, the dockwidget,...?)

    Otherwise should I reimplement the shaping myself? How could I determine if I should use horizontal or vertical arrows?

    Or probably the cursor shaping is handled by the OS. In that case I find myself a little bit (more) lost...

    Am I pointing to some kind of wrong direction? Thanks a lot for your time.

  11. #11
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge

    I also tried using stylesheets to add a border instead of the QFrame but I couldn't get any success.
    I think using QFrame should do the job, but I must be missing something.

Similar Threads

  1. Replies: 4
    Last Post: 17th August 2010, 19:38
  2. Replies: 1
    Last Post: 15th August 2010, 21:40
  3. Moving cursor in QPlainTextEdit
    By pgbackup in forum Qt Programming
    Replies: 2
    Last Post: 11th September 2009, 19:26
  4. DockWidget not moving inside QWidget ?
    By aurelius in forum Qt Programming
    Replies: 6
    Last Post: 3rd February 2009, 10:24
  5. Replies: 1
    Last Post: 1st February 2007, 17:07

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.