Results 1 to 6 of 6

Thread: Dialog on right click on windows?

  1. #1
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Dialog on right click on windows?

    Hi All,

    I am working on Qt 4.3.4 on my Windows.
    I have a QTreeWidget of items and I want to show a dialog when user right click on that item.
    How to do it?

    Plz help me out.

    Thanks.
    Vishal

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dialog on right click on windows?

    Hi,

    connect qtreewidget.html#itemClicked to a custom slot and there create your dialog.

    Ginsengelf
    Last edited by Ginsengelf; 4th August 2008 at 07:00. Reason: link wrong

  3. #3
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Dialog on right click on windows?

    But it will work on either click (right or left).
    But Actually I want to implement the right click property of windows.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Dialog on right click on windows?

    Do you mean "context menu"? If so, search the forums, please.
    J-P Nurmi

  5. #5
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Dialog on right click on windows?

    Yes I am talking about context menu.
    Thanks.

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Dialog on right click on windows?

    first, set next property for widget for which context menu is needed.
    Qt Code:
    1. yourWidget->setContextMenuPolicy(Qt::CustomContextMenu)
    To copy to clipboard, switch view to plain text mode 

    then,
    Qt Code:
    1. connect(yourWidget, SIGNAL(customContextMenuRequested(const QPoint &)),
    2. this, SLOT(yourContextMenuDisplayMethod(const QPoint &)));
    To copy to clipboard, switch view to plain text mode 

    and last you need to show context menu in
    Qt Code:
    1. yourContextMenuDisplayMethod(const QPoint &)
    To copy to clipboard, switch view to plain text mode 
    .

Similar Threads

  1. Replies: 2
    Last Post: 23rd April 2008, 14:13
  2. converting Windows dialog resources to ui
    By Thor28 in forum Qt Tools
    Replies: 3
    Last Post: 21st April 2008, 15:13
  3. Replies: 2
    Last Post: 2nd April 2008, 17:28
  4. Replies: 2
    Last Post: 5th February 2007, 17:42
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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
  •  
Qt is a trademark of The Qt Company.