Results 1 to 8 of 8

Thread: specify an Icon when mouseOver a QSizeGrip

  1. #1
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default specify an Icon when mouseOver a QSizeGrip

    I am guessing that there are 4 possible system Icons that pop-up when you mouse-Over a QSizeGrip: the double arrow up-down, left-right, 45 degrees one way, or 45 degrees the other. My problem: I've set my QSizeGrip to move up and down (its parent widget has a fixed width). But when I mouseOver the SizeGrip, the up-down Icon doesn't appear. Instead, one of the 45 degree icons appears. How can I fix this?

    My QSizeGrip is already subclassed so that I can implement my own paintEvent; is there an additional function I can add to select which icon appears when the sizeGrip is moused Over? One thing I've thought of doing: turning off the widget's (presumably) internal mouse-over behavior, adding an eventFilter, and then including my own pop-up icon in the eventFilter. But this seems cumbersome/unnecessary.

    thanx

  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: specify an Icon when mouseOver a QSizeGrip

    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
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: specify an Icon when mouseOver a QSizeGrip

    Now I'll follow-up my embarrassingly easy question ...with an embarrassing observation: it doesn't work.

    I tested it on a QSlider; no problem, it works. But on the QSizeGrip: I still get the default icon.

  4. #4
    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: specify an Icon when mouseOver a QSizeGrip

    I just had a look at the code. Changing the cursor will not be easy. It might be better if you just disable the size grip although even then the cursor keeps its properties.
    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.


  5. #5
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: specify an Icon when mouseOver a QSizeGrip

    Quote Originally Posted by wysota View Post
    It might be better if you just disable the size grip
    I'm not sure what you mean there; I want the sizeGrip enabled so I can use it, of course.

    Quote Originally Posted by wysota View Post
    Changing the cursor will not be easy.
    I'm actually already sub-classing this QSizeGrip so that I can implement my own paintEvent. Is there not an additional function I can add to over-ride the cursor behavior? Perhaps by "disable the size grip" you mean disable it's mouseOver/Cursor feature, and either re-implement it here somehow... or add an installEventFilter(this) to the sizeGrip widget and change the cursor in my this::eventFilter(QObject *o, QEvent *e), something like:

    Qt Code:
    1. eventFilter(QObject *obj, QEvent *event)
    2. {
    3. if(event->type() == QEvent::Enter)
    4. {
    5. if(obj == mySizeGrip)
    6. {
    7. QRect rect = mySizeGrip->geometry();
    8. Qt_upDown_icon->move( rect.right(), rect.bottom())
    9. Qt_upDown_icon->show();
    10. // etc.....
    To copy to clipboard, switch view to plain text mode 

    Anyway, just curious what you think. Thanks.

  6. #6
    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: specify an Icon when mouseOver a QSizeGrip

    Quote Originally Posted by vonCZ View Post
    I'm not sure what you mean there; I want the sizeGrip enabled so I can use it, of course.
    You'll be able to resize the dialog by dragging regardless of the presence of QSizeGrip.

    I'm actually already sub-classing this QSizeGrip so that I can implement my own paintEvent. Is there not an additional function I can add to over-ride the cursor behavior?
    You have to reimplement a bunch of events and the event filter. It might be much easier to implement the size grip from scratch but even then I'm not sure you'll be able to manipulate the cursor the way you want.

    Perhaps by "disable the size grip" you mean disable it's mouseOver/Cursor feature,
    I mean calling QDialog::setSizeGripEnabled(false).
    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.


  7. #7
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: specify an Icon when mouseOver a QSizeGrip

    Quote Originally Posted by wysota View Post
    I've actually never used a QDialog; the widget I want to stretch vertically is simply a QWidget with various layouts & widgets. See attached image; the mySizeGrip is at the very bottom in the middle (it's a subclassed QSizeGrip with the paintEvent re-implemented).

    So maybe I should use a QDialog, except far as I can tell you can either enable/disable sizeGrip, and not just have it enabled for one side (the bottom). Oh well, screw it.
    Attached Images Attached Images

  8. #8
    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: specify an Icon when mouseOver a QSizeGrip

    Hmm... Isn't QSplitter what you want?
    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.


Similar Threads

  1. QMessageBox missing icon
    By zanth in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2010, 21:20
  2. How to get pushbutton as an icon
    By Pembar in forum Newbie
    Replies: 1
    Last Post: 12th May 2009, 19:59
  3. Couple of questions: main window icon + toolbar icon
    By bpackard in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 19:03
  4. Mac application and the Dock Icon
    By sekelsenmat in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2007, 10:23
  5. QSystemTrayIcon doesn't show icon ?
    By probine in forum Qt Programming
    Replies: 3
    Last Post: 25th January 2007, 19:17

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.