Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [solved] Adding text over a grid of pushbuttons

    General and Desktop
    2
    3
    656
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      TimAnderson last edited by

      Hi everyone,

      This may be a very simple question but I couldn't find an answer while searching. I have written a simple memory game with pushbuttons in a grid layout and it is working perfectly. When the player uncovers the last match I would like to write "You Win" over the game screen but I would like to keep the game screen in the background. "Here":http://www.mobygames.com/images/shots/l/77636-yu-gi-oh-power-of-chaos-joey-the-passion-windows-screenshot.png is an example in a commercial game of what I am trying to do in case I wasn't clear. Is there a way of doing this in Qt? If the answer is no then I can always create a splash screen to display the message though that isn't quite the look I was going for.

      Thanks,

      Tim

      1 Reply Last reply Reply Quote 0
      • A
        agabor last edited by

        Hi Tim,

        You can certainly do this. If I understand correctly, the game board is a custom widget, which contains the buttons.
        You can paint over this widget, by overriding the paint event from QWidget. Check out this:
        http://qt-project.org/doc/qt-4.8/qwidget.html#paintEvent

        Gábor

        1 Reply Last reply Reply Quote 0
        • T
          TimAnderson last edited by

          Perfect! Thanks.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post