Qt World Summit: Submit your Presentation

Context Menu not showing entirely

  • I'm using QT 5.3.2 and in my whole app wherever I have a QLineEdit, rendered based on a UI file, the Context Menu shown on right click on an QLineEdit is not shown entirely.
    Can someone help me with this?

    Thanksalt text

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you provide a minimal sample code reproducing that behaviour ?

    Did you check with a more recent version of Qt whether it still happens ?

  • Hi SGaist,

    Thank you for your reply!
    Before going with providing that minimal sample code (which is not so easy) and changing the QT Version (which is also not so easy because we should perform a lot of testing as we have a lot of screens) can you suggest me some other approach so I could test different possibilities as the source of the bug?


  • Lifetime Qt Champion

    Are you using stylesheets ?
    If yes, could you disable it and see if that makes any difference ?

  • Yes, I'm using a lot of styleSheets but disabling them means giving up to my themes.

  • Lifetime Qt Champion


    if you really want to solve your problem, you should at least try the suggestion of @SGaist and @mrjj. otherwise its hard for us to help you.

    I know that its not easy to deploy an app with a new Qt version, but it is easy to build and test against another version.


  • Lifetime Qt Champion

    If was not meant as a permanent thing.
    Just to make sure its
    not due to styling.
    If it is, we must just find out why it cuts QMenu.
    if not, we must continue investigate why it happens.
    I have not seen that one before :)

  • I've solved it. I've added QLineEdit:ContextMenu {height: 200px;} in the stylesheet of the QLineEdit and it worked.
    That's my entire styleSheet for th e QLineEdit element. Don't know why without the ContextMenu part it would cut off the Context Menu...

    QLineEdit {background-color: #2b2b37; color: #FFFFFF; padding-left: 5px; font-family: 'Helvetica Neue'; height: 32px;} QLineEdit:ContextMenu {height: 200px;}

    Thanks guys!

Log in to reply