Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] Adding text over a grid of pushbuttons
QtWS25 Last Chance

[solved] Adding text over a grid of pushbuttons

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 826 Views
  • 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 Offline
    T Offline
    TimAnderson
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      agabor
      wrote on last edited by
      #2

      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
      0
      • T Offline
        T Offline
        TimAnderson
        wrote on last edited by
        #3

        Perfect! Thanks.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved